Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does path need to start with '$'? #59

Open
shaunc opened this issue Apr 24, 2017 · 0 comments
Open

Does path need to start with '$'? #59

shaunc opened this issue Apr 24, 2017 · 0 comments

Comments

@shaunc
Copy link

shaunc commented Apr 24, 2017

const x = {a: 1};
jp.query(x, 'a')
// returns 1

jp.value(x, 'a', 2);
// returns 2, sets key 'a' to 2 in x

jp.value(x, 'b', 2);
// Error: couldn't understand path

jp.query(x, 'b')
// returns []

jp.value(x, '$..b', 2);
// returns 2 and sets key 'b' to 2 in x

I would prefer to be able to leave the '$' off -- which mostly works -- as it seems redundant. But it seems to be necessary using "value" if the location does not yet exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant