A utility for working with RFC 6901 pointers, and a bit more.
npm install @collinbrewer/json-pointerThere are many fine implementations of the spec but JSONPointer offers additional functionality.
javascript
var doc={
"foo" : {
"bar" : "value"
}
};var pointer=new JSONPointer("/foo/bar");
pointer.evaluate(doc); // returns "value"
`Extensibility
JSONPointer can be extended to support various needs.`javascript
var pointer=new JSONPointer("foo.bar", {delimiter:"."});pointer.evaluate(doc); // returns "value"
`$3
JSONPointer also offers a class factory for creating custom pointer types.`javascript
var DotPointer=JSONPointer.Factory({delimiter:"."});var pointer=new DotPointer("foo.bar");
pointer.evaluate(doc); // returns "value"
``