0.0.2 • Published 11 years ago
browserify-json-bundle-diff v0.0.2
Generates a diff between two browserify-json-bundles. This is part of the browserify-diff toolchain.
Example
From:
{
"version" : 1,
"modules" : {
"./foo" : ["console.log('foo');",{}],
"./bar" : ["console.log('bar');",{}]
},
"entry" : ["./foo"]
}To:
{
"version" : 2,
"modules" : {
"./foo" : ["console.log('now I print something else');",{}],
"./baz" : ["console.log('baz');",{}]
},
"entry" : ["./baz"]
}Resulting diff:
{
"from" : 1,
"to" : 2,
"modules" : {
"./foo" : ["console.log('now I print something else');",{}],
"./bar" : null,
"./baz" : ["console.log('baz');",{}]
},
"entry" : ["./baz"]
}Methods
var diff = require('browserify-json-bundle-diff');
create(from, to)
Generates a diff between two browserify-json-bundles. It will:
- Put the version of
fromas the value for thefromkey in the diff - Put the version of
toas the value for thetokey in the diff - Add any module in
tothat is not present infromto themoduleshash - Add any module in
tothat is not equal to the same module infromto themoduleshash - Add any module that is present in
frombut not intoto themoduleshash with a value ofnull - Adds the
entryfromtoif it is not equal to theentryfromfrom.
merge(first, second)
Merges two diffs together. It is required that the second diff is a direct successor of the first diff, that is first.to === second.from.