deep-equal-x

2.1.2 • Public • Published

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

deep-equal-x

node's deepEqual and deepStrictEqual algorithm.

module.exports(actual, expected, [strict])boolean

Tests for deep equality. Primitive values are compared with the equal comparison operator ( == ). This only considers enumerable properties. It does not test object prototypes, attached symbols, or non-enumerable properties. This can lead to some potentially surprising results. If strict is true then Primitive values are compared with the strict equal comparison operator ( === ).

Kind: Exported function
Returns: boolean - true if actual and expected are deemed equal, otherwise false.
See: https://nodejs.org/api/assert.html

Param Type Description
actual * First comparison object.
expected * Second comparison object.
[strict] boolean Comparison mode. If set to true use ===.

Example

import deepEqual from 'deep-equal-x';
 
deepEqual(Error('a'), Error('b'));
// => true
// This does not return `false` because the properties on the  Error object
// are non-enumerable:
 
deepEqual(4, '4');
// => true
 
deepEqual({a: 4, b: '1'}, {b: '1', a: 4});
// => true
 
deepEqual(new Date(), new Date(2000, 3, 14));
// => false
 
deepEqual(4, '4', true);
// => false

Package Sidebar

Install

npm i deep-equal-x

Weekly Downloads

91

Version

2.1.2

License

MIT

Unpacked Size

648 kB

Total Files

11

Last publish

Collaborators

  • xotic750