Skip to content

Commit

Permalink
Moved position of IsSingular in class
Browse files Browse the repository at this point in the history
  • Loading branch information
bfarmer67 committed Jun 12, 2024
1 parent 21692d6 commit aadfe57
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/Hyperbee.Json/Tokenizer/JsonPathToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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;
Expand Down

0 comments on commit aadfe57

Please sign in to comment.