diff --git a/src/Hyperbee.Json/Tokenizer/JsonPathToken.cs b/src/Hyperbee.Json/Tokenizer/JsonPathToken.cs index 5aca498b..7e23dd8d 100644 --- a/src/Hyperbee.Json/Tokenizer/JsonPathToken.cs +++ b/src/Hyperbee.Json/Tokenizer/JsonPathToken.cs @@ -20,20 +20,6 @@ internal record JsonPathToken public bool Singular { get; } - private bool IsSingular() - { - if ( Selectors.Length != 1 ) - return false; - - var selectorKind = Selectors[0].SelectorKind; - - return selectorKind == SelectorKind.UnspecifiedSingular || // prioritize runtime value - selectorKind == SelectorKind.Dot || - selectorKind == SelectorKind.Index || - selectorKind == SelectorKind.Name || - selectorKind == SelectorKind.Root; - } - public JsonPathToken( string selector, SelectorKind kind ) { Selectors = @@ -50,6 +36,20 @@ public JsonPathToken( SelectorDescriptor[] selectors ) Singular = IsSingular(); } + private bool IsSingular() + { + if ( Selectors.Length != 1 ) + return false; + + var selectorKind = Selectors[0].SelectorKind; + + return selectorKind == SelectorKind.UnspecifiedSingular || // prioritize runtime value + selectorKind == SelectorKind.Dot || + selectorKind == SelectorKind.Index || + selectorKind == SelectorKind.Name || + selectorKind == SelectorKind.Root; + } + public void Deconstruct( out bool singular, out SelectorDescriptor[] selectors ) { singular = Singular;