UNPKG

deepy

Version:

A fast algorithm for comparing equality of values with strict equality for value types.

45 lines (32 loc) 968 B
# Deepy [![Build Status](https://travis-ci.org/Kflash/deepy.svg?branch=master)](https://travis-ci.org/Kflash/deepy) A fast algorithm for value comparison and equality of value types. It's build for performance, and supports ES6 primitives among other things. Loosely based on algorithms from NodeJS, Jasmine, Lodash and others. # Install ```js $ npm install --save deepy ``` # Usage Returns either true or false depends if the values are the same according to the algorithm or not. ```js let deepy = require('deepy') deepy({a: 0}, {a: false}) // false deepy(['a'], {0: 'a'}) // false deepy({a: 1}, {a: 1}) // true deepy('/a/igmm', '/a/igm') // false deepy( [ {foo: {z: 100, y: 200, x: 300}}, 'bar', 11, {baz: {d: 4, a: 1, b: 2, c: 3}} ], [ {foo: {z: 100, y: 200, x: 300}}, 'bar', 11, {baz: {d: 4, a: 1, b: 2, c: 3}} ] ) // true ```