Skip to content

Commit 42f817d

Browse files
committed
README: Add API usage example
1 parent 1293beb commit 42f817d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@ Diff between two versions of a graph stored in git
4141

4242
fbp-git-diff master otherbranch ./graphs/MyGraph.json
4343

44+
## API Usage
45+
46+
fbp-diff also provides a JavaScript API.
47+
48+
var fbpDiff = require('fbp-diff');
49+
var options = {
50+
// fromFormat: 'object', // don't parse fromGraph, it is a JS object of a graph (default)
51+
// toFormat: 'json', // parse toGraph .json format
52+
format: 'fbp' // specify toFormat and fromFormat in one go
53+
};
54+
var fromGraph = "";
55+
var toGraph = "";
56+
var diff = fbpDiff.diff(fromGraph, toGraph, options);
57+
console.log(diff);
58+
4459
## TODO
4560

4661
Also see [./doc/braindump.md](./doc/braindump.md)

0 commit comments

Comments
 (0)