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

Support /- and nested properties #19

Merged
merged 1 commit into from
Sep 29, 2015
Merged

Support /- and nested properties #19

merged 1 commit into from
Sep 29, 2015

Conversation

marcbachmann
Copy link
Collaborator

Adds set /- support, adds nested property setter:

// set nested properties
assert.equal(jsonpointer.set(obj, "/f/g/h/i", 6), undefined);
assert.equal(jsonpointer.get(obj, "/f/g/h/i"), 6);

// set an array
assert.equal(jsonpointer.set(obj, "/f/g/h/foo/-", 'test'), undefined);
arr = jsonpointer.get(obj, "/f/g/h/foo")
assert(Array.isArray(arr), 'set /- creates an array.');
assert.equal(arr[0], 'test');

Requested in #14

@marcbachmann
Copy link
Collaborator Author

This is an improvement over the current implementation where we've just returned null.
At least setting values works now.
There are no downsides as I can see. However, I will do a major release. I don't want to break other libraries.

marcbachmann added a commit that referenced this pull request Sep 29, 2015
@marcbachmann marcbachmann merged commit 7e9d053 into janl:master Sep 29, 2015
@marcbachmann marcbachmann deleted the set-improvement branch September 29, 2015 21:51
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

Successfully merging this pull request may close these issues.

None yet

1 participant