-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-multi.js
executable file
·48 lines (36 loc) · 1.05 KB
/
test-multi.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env node
const through = require('through2');
const duplexer = require('duplexer');
var vdiff = require('variable-diff');
var jsdiff = require('json-diff');
var { colorize } = require('json-diff/lib/colorize');
var jsondiffpatch = require("jsondiffpatch");
const expected = {
"one" : "val",
"two" : "val",
"three" : "val",
"four" : "val",
"five" : {
"someting" : "lorem ipsum dolor sit amet", "other" : "lorem ipsum is getting too long"
}
};
const actual = {
"five" : {
"someting" : "lorem ipsum dolor sit amet", "other" : "lorem1 ipsum is getting too long"
},
"four" : "val",
"three" : "val",
"two" : "val",
};
var difference = colorize(jsdiff.diff(expected, actual));
console.log("json-diff");
console.log(difference);
// ---------
console.log("variable-diff");
result = vdiff(expected, actual).text;
console.log(result);
// --------
console.log("jsondiffpatch");
var delta = jsondiffpatch.diff(expected, actual);
var deltaColor = jsondiffpatch.formatters.console.format(delta);
console.log(deltaColor);