Skip to content

Conversation

@reckter
Copy link
Contributor

@reckter reckter commented Jul 15, 2020

Previously getting any value, where an object in the path was null, would throw an exception, while it being undefined would not.

Example:

const obj = {
   foo: null,
   baz: undefined
}

jsonpointer.get(obj, "/foo/baz") /// <--- This would throw
jsonpointer.get(obj, "/baz/foo") /// <---- This would not

The fix is simply also checking equality with null and then returning null (comparable to the undefined case, where it already returned null)

Copy link
Collaborator

@marcbachmann marcbachmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes. I've introduced some better test assertions in #59 and rebased against it to get it in.
I also did a small fix to return undefined for .get('/nullValue/something')
IMO we can merge this once the other PR is merged.

@reckter
Copy link
Contributor Author

reckter commented Jan 24, 2022

Feel free to merge at will, I don't actually work with this library anymore, because the project is over where I used it, so you have full authority to merge and change at will :)

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.

2 participants