0.1.1 • Published 7 years ago

@collinbrewer/json-pointer v0.1.1

Weekly downloads
17
License
ISC
Repository
github
Last release
7 years ago

JSONPointer

A javascript implementation of the RFC 6901 Spec: http://tools.ietf.org/html/rfc6901

There are many fine implementations of the spec but JSONPointer offers additional functionality.

Basic Usage

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.

var pointer=new JSONPointer("foo.bar", {delimiter:"."});

pointer.evaluate(doc); // returns "value"

Class Factory

JSONPointer also offers a class factory for creating custom pointer types.

var DotPointer=JSONPointer.Factory({delimiter:"."});

var pointer=new DotPointer("foo.bar");

pointer.evaluate(doc); // returns "value"