Skip to content

Commit 097864a

Browse files
Documentation updated
1 parent 51964ed commit 097864a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

README.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,28 @@ var patch = jsonpatch.generate(observer, true);
245245
// ];
246246
```
247247

248-
#### `jsonpatch.unobserve(document: any, observer: Observer): void`
248+
#### `jsonpatch.unobserve(document, observer)`
249+
```
250+
jsonpatch.unobserve(document: any, observer: Observer): void
251+
252+
type JsonableObj = { [key:string]: Jsonable };
253+
type JsonableArr = Jsonable[];
254+
type Jsonable = JsonableArr | JsonableObj | string | number | boolean | null;
255+
```
249256

250257
Destroys the observer set up on `document`.
251258

252259
Any remaining changes are delivered synchronously (as in `jsonpatch.generate`). Note: this is different that ES6/7 `Object.unobserve`, which delivers remaining changes asynchronously.
253260

254-
#### `jsonpatch.compare(document1: any, document2: any, invertible = false): Operation[]`
261+
#### `jsonpatch.compare(document1, document2, invertible)`
262+
263+
```
264+
jsonpatch.compare(document1: Jsonable, document2: Jsonable, invertible = false): Operation[]
265+
266+
type JsonableObj = { [key:string]: Jsonable };
267+
type JsonableArr = Jsonable[];
268+
type Jsonable = JsonableArr | JsonableObj | string | number | boolean | null;
269+
```
255270

256271
Compares object trees `document1` and `document2` and returns the difference relative to `document1` as a patches array. If `invertible` is true, then each change will be preceded by a test operation of the value in `document1`.
257272

0 commit comments

Comments
 (0)