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

deep-close-to

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-close-to

out of the box assert.deepCloseTo with configurable comparator

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

deep-close-to

Node's assert.deepEqual() but with configurable comparator. The default comparator compares the absolute difference to be below an epsilon, suitable for floats.

example

var closeTo = require('deep-close-to');
console.dir([
    closeTo(
        { a : [ 2, 3 ], b : [ 4 ] },
        { a : [ 2, 3 ], b : [ 4 ] }
    ),
    closeTo(
        { x : 36/5, y : [6] },
        { x : 72/10, y : 6 }
    )
]);

methods

var closeTo = require('deep-close-to')

deepEqual(a, b, opts)

Compare objects a and b, returning whether they are equal according to a recursive equality algorithm.

If opts.strict is true, use strict equality (===) to compare leaf nodes. The default is to compare their absolute difference to be below 0.0000001. Number.EPSILON was not used because numeric errors are often bigger than it.

install

With npm do:

npm install deep-close-to

test

With npm do:

npm test

license

MIT. Derived largely from substack's deep-equal.

Keywords

closeTo

FAQs

Package last updated on 15 May 2017

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