DefinitelyTyped/types/json8-patch/json8-patch-tests.ts

11 lines
293 B
TypeScript
Raw Permalink Normal View History

2020-01-07 23:35:08 +00:00
import * as jsonPatch from "json8-patch";
const doc1 = { foo: "bar" };
const doc2 = { bar: 42 };
const patch = jsonPatch.diff(doc1, doc2);
const { doc, revert } = jsonPatch.apply(doc1, patch, { reversible: true });
// $ExpectType ApplyResult
const reverted = jsonPatch.revert(doc, revert);