Files
dealplustech/dealplustech-astro/node_modules/deep-diff/examples/issue-48.js
Kunthawat Greethong 6402d885f9 Complete Astro migration - PDPA compliant website
- Migrated all pages from Next.js to Astro
- Added PDPA-compliant Privacy Policy (Thai)
- Added PDPA-compliant Terms & Conditions (Thai)
- Added Cookie Policy with disclosure (Thai)
- Implemented cookie consent banner (client-side)
- Integrated Umami Analytics placeholder
- Blog system with 3 posts
- Optimized Docker configuration for production
- Static site build (184KB, 11 pages)
- Ready for Easypanel deployment

Backup: /Users/kunthawatgreethong/Gitea/dealplustech-backup-nextjs-20260309.tar.gz
2026-03-09 18:28:01 +07:00

49 lines
1.0 KiB
JavaScript

var dd = require('../'); // deep-diff
var inspect = require('util').inspect;
var expect = require('expect.js');
var before = {
name: 'my object',
description: 'it\'s an object!',
details: {
it: 'has',
an: 'array',
with: ['a', 'few', 'elements']
}
};
var after = {
name: 'updated object',
description: 'it\'s an object!',
details: {
it: 'has',
an: 'array',
with: ['a', 'few', 'more', 'elements', { than: 'before' }]
}
};
var revertDiff = function (src, d) {
d.forEach(function (change) {
dd.revertChange(src, true, change);
});
return src;
};
var clone = function (src) {
return JSON.parse(JSON.stringify(src));
};
var df = dd.diff(before, after);
var b1 = clone(before);
var a1 = clone(after);
console.log(inspect(a1, false, 9)); // eslint-disable-line no-console
var reverted = revertDiff(a1, df);
console.log(inspect(reverted, false, 9)); // eslint-disable-line no-console
console.log(inspect(b1, false, 9)); // eslint-disable-line no-console
expect(reverted).to.eql(b1);