Skip to content

Commit

Permalink
Adds documentation for remove
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelstofer committed Nov 9, 2013
1 parent b7089d2 commit 2cadf82
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![Build Status](https://travis-ci.org/manuelstofer/json-pointer.png)](https://travis-ci.org/manuelstofer/json-pointer)


Some utilities for JSON pointers described by RFC 6901

Provides some additional stuff i needed but is not included in [node-jsonpointer](https://github.com/janl/node-jsonpointer)
Expand All @@ -22,6 +21,7 @@ $ npm install json-pointer
$ component install manuelstofer/json-pointer
```


## API

```Javascript
Expand Down Expand Up @@ -50,13 +50,13 @@ objPointer('/new-value/bla') // gets '/new-value/bla' from `obj`

The wrapper supports chainable object oriented style.


```Javascript
var obj = {anything: 'bla'};
var objPointer = pointer(obj);
objPointer.set('/example', 'bla').dict();
```


### .get(object, pointer)

Looks up a JSON pointer in an object.
Expand All @@ -71,7 +71,6 @@ pointer.get(obj, '/example/bla');
```



### .set(object, pointer, value)

Sets a new value on object at the location described by pointer.
Expand All @@ -82,6 +81,19 @@ pointer.set(obj, '/example/bla', 'hello');
```


### .remove(object, pointer)

Removes an attribute of object referenced by pointer

```Javascript
var obj = {
example: 'hello'
};
pointer.remove(obj, '/example');
// obj -> {}
```


### .dict(object)

Creates a dictionary object (pointer -> value).
Expand Down Expand Up @@ -122,7 +134,6 @@ pointer.has(obj, '/non/existing'); // -> false
```



### .escape(str)

Escapes a reference token.
Expand All @@ -133,7 +144,6 @@ pointer.escape('hello/bla'); // -> 'hello~1bla'
```



### .unescape(str)

Unescape a reference token.
Expand Down

0 comments on commit 2cadf82

Please sign in to comment.