LoginSignup
0
1

More than 1 year has passed since last update.

JavaScript で 2 つのデータの差分を可視化したい場合は jest-diff

Last updated at Posted at 2022-11-25

https://jestjs.io/ja/docs/jest-platform#jest-diff

jest-diff は 2 つのデータの差分を可視化できる。
別に テスト用途でなくとも、独立した機能として使える

const { diff } = require('jest-diff');

const a = {a: {b: {c: 5}}};
const b = {a: {b: {c: 6}}};

const result = diff(a, b);

出力結果:

  Object {
    "a": Object {
      "b": Object {
-       "c": 5,
+       "c": 6,
      },
    },
  }
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1