$ gnpm install @zoroaster/deep-equal
@zoroaster/deep-equal
is The Deep Equal Assertion With Color.
yarn add @zoroaster/deep-equal
The package is available by importing its default function:
import deepEqual from '@zoroaster/deep-equal'
deepEqual(
actual: ?,
expected: ?,
message?: string,
): void
Calls assert.deepStrictEqual
and then creates a visual representation of the difference between objects if it throws.
import deepEqual from '@zoroaster/deep-equal'
const compare = (a, b) => {
try {
deepEqual(a, b)
} catch (err) {
console.log(err.message)
}
}
compare('hello', 'world')
compare([10, 4, 20], [100, 4, 30])
compare({ a: 'example', b: 10 }, { b: 10, c: 'context-testing' })
|
(c) Context Testing 2019
Copyright 2013 - present © cnpmjs.org | Home |