2diff 中文文档教程

发布于 3年前 浏览 22 项目主页 更新于 3年前

Node.js object difference

2diff

Instalation

npm i -S 2diff

Usage

const diff = require('2diff');

const before = {c: 3, a: 1, b: '2', e: {x: 9}};
const after = {a: 1, b: 1, e: {x: 9}, f: {x: 9}};

const result = diff(before, after);

console.log(result);

输出:

[
  { removed: true, key: 'c', value: 3 },
  { removed: true, key: 'b', value: '2' },
  { added: true, key: 'b', value: 1 },
  { added: true, key: 'f.x', value: 9 }
]

Node.js object difference

2diff

Instalation

npm i -S 2diff

Usage

const diff = require('2diff');

const before = {c: 3, a: 1, b: '2', e: {x: 9}};
const after = {a: 1, b: 1, e: {x: 9}, f: {x: 9}};

const result = diff(before, after);

console.log(result);

Output:

[
  { removed: true, key: 'c', value: 3 },
  { removed: true, key: 'b', value: '2' },
  { added: true, key: 'b', value: 1 },
  { added: true, key: 'f.x', value: 9 }
]
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文