source: frontend/node_modules/jsonpointer/README.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1# JSON Pointer for Node.js
2
3This is an implementation of [JSON Pointer](https://tools.ietf.org/html/rfc6901).
4
5## CLI
6
7Looking to filter JSON from the command line? Check out [jsonpointer-cli](https://github.com/joeyespo/jsonpointer-cli).
8
9## Usage
10```javascript
11var jsonpointer = require('jsonpointer');
12var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
13
14jsonpointer.get(obj, '/foo'); // returns 1
15jsonpointer.get(obj, '/bar/baz'); // returns 2
16jsonpointer.get(obj, '/qux/0'); // returns 3
17jsonpointer.get(obj, '/qux/1'); // returns 4
18jsonpointer.get(obj, '/qux/2'); // returns 5
19jsonpointer.get(obj, '/quo'); // returns undefined
20
21jsonpointer.set(obj, '/foo', 6); // sets obj.foo = 6;
22jsonpointer.set(obj, '/qux/-', 6) // sets obj.qux = [3, 4, 5, 6]
23
24var pointer = jsonpointer.compile('/foo')
25pointer.get(obj) // returns 1
26pointer.set(obj, 1) // sets obj.foo = 1
27```
28
29## Testing
30
31 $ npm test
32 All tests pass.
33 $
34
35[![Node.js CI](https://github.com/janl/node-jsonpointer/actions/workflows/node.js.yml/badge.svg)](https://github.com/janl/node-jsonpointer/actions/workflows/node.js.yml)
36
37## Author
38
39(c) 2011-2021 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
40
41Thanks to all contributors.
42
43## License
44
45MIT License.
Note: See TracBrowser for help on using the repository browser.