Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('patch a1\n', JSON.stringify(dp.patch(a1, p)));
} catch (e) {
console.error('FAILED');
console.error(e);
}
console.log('--------------------------');
console.log('fast-json-patch (modified)');
console.log('--------------------------');
var fastJsonPatch = require('fast-json-patch/src/json-patch-duplex');
setup();
try {
// FAIL: The act of comparing 2 JSON objects/arrays causes one
// to be mutated!?
p = fastJsonPatch.compare(a1, a2);
console.log('diff a1 a2\n', JSON.stringify(p));
fastJsonPatch.apply(a1, p)
console.log('patch a1\n', JSON.stringify(a1));
// console.log('patch a1\n', JSON.stringify(jsonPatch.patch(p, a1)));
} catch (e) {
console.error('FAILED');
console.error(e);
}