Skip to content

A minimal-weight lodash.isequal equivalent utility

License

Notifications You must be signed in to change notification settings

NickGard/tiny-isequal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiny-isequal

source bundle size build status license

A minimal-weight utility similar to lodash.isequal. For when every byte counts! Performs a deep (recursive) comparison between the two arguments. It differs from lodash.isequal in one significant way: it requires that the two values have the same prototype and properies, including unenumerable ones.


lodash.isequal: bundle size
tiny-isequal: bundle size


Install

npm install @ngard/tiny-isequal

Syntax

isEqual(/* value1, value2 */);

Parameters

value1 - Any Javascript value value2 - Any Javascript value

Return

true if the two values are deeply equal, false otherwise.


Examples

import { isEqual } from "@ngard/tiny-isequal";

const samesies = isEqual({ a: 1 }, { a: 1 });
// samesies is true
import { isEqual } from "@ngard/tiny-isequal";

const samesies = isEqual({ a: { b: "c" } }, { a: { b: "c" } });
// samesies is true
import { isEqual } from "@ngard/tiny-isequal";

const obj = [1, 2, 3];
const samesies = isEqual(obj, obj);
// samesies is true
import { isEqual } from "@ngard/tiny-isequal";

const samesies = isEqual(NaN, NaN);
// samesies is true

About

A minimal-weight lodash.isequal equivalent utility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published