Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JSONPath.toPathArray returns different values for the same input #102

Copy link
Copy link
@andalal

Description

@andalal
Issue body actions

I am using the toPathArray method in the following way

const jsonpathTokens: string[] = JSONPath.toPathArray(propertyRef.propertyPath);

When I pass in the string "$.subsensor.temp" for the first time, it will return ["$", "subsensor", "temp"] as expected. However when the toPathArray is called again with the same input, it returns ["subsensor", "temp"]. This happens for other inputs of a similar type.

When I stepped through the debugger it seems like there is a JSONPath.cache object which is checked before the regex is run. I checked that the value saved to the cache exprList is correct. However on the immediate next call the cache object was already modified to exclude the "$".

I think this is a bug because the toPathArray method should return the same values for the same input.

I am using v1.0.0 and I'm using the library within typescript.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.