New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tiny-deep-equal

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-deep-equal

Tiny & Fast deep-equal check with various ES6 objects.

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

tiny-deep-equal

Tiny & Fast deep-equal check with various ES6 objects.

NPM version monthly downloads bundle size

  • No dependencies.
  • Tiny bundle size. (NPM Minified: 1.4kB, Gzipped: 586B)
  • Support for both CJS and ESM.
  • Typescript based code, support type declarations.
  • Comprehensive test coverage.

Install

  • Requirements: Node>=16.19.0
$ yarn add tiny-deep-equal // yarn
$ npm install tiny-deep-equal --save // npm
$ pnpm install tiny-deep-equal // pnpm

Usage

// esm
import equal from 'tiny-deep-equal';

equal({ a: 1, b: { c: 1 } }, { a: 1, b: { c: 1 } }) // true

// cjs
const equal = require('tiny-deep-equal');

equal({ a: 1, b: { c: 1 } }, { a: 1, b: { c: 1 } }) // true

tiny-deep-equal supports various objects with ES6.

+0 & -0

equal(+0, -0) // true

Set & Map

const set1 = new Set([1, 2, 3]);
const set2 = new Set([1, 2, 3]);

equal(set1, set2) // true

const map1 = new Map();
const map2 = new Map();

map1.set('a', 1);
map2.set('a', 1);

equal(map1, map2) // true

RegExp

const regex1 = /(?:foo)/g;
const regex2 = /(?:foo)/g;

expect(equal(regex1, regex2)) // true

ArrayBuffer

const buffer1 = new Uint8Array([1, 2, 3]);
const buffer2 = new Uint8Array([1, 2, 3]);

expect(equal(buffer1, buffer2)) // true

Error

const err1 = new Error('error!');
const err2 = new Error('error!');

expect(equal(err1, err2)) // true

BenchMark

$ pnpm run benchmark:performance

Test

$ pnpm run test

License

MIT

Keywords

tiny-deep-equal

FAQs

Package last updated on 19 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts