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

dbj.cond.comparators

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbj.cond.comparators

deep dbj.cond.comparators 'arr' and 'lookup'. Can be used with dbj.cond

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

dbj.cond.comparators

(c) 2009-2018 .. and beyond, by dbj.org
Licensed under the Apache License 2.0

dbj.cond() by dbj.org

 

dbj Comparators to be used either standalone or with dbj.cond

The purpose of this comparators is functionality not speed. They are most usefull when used with dbj.cond, or some such mechanism for complex conditional programing made feasible.

The API

npm install dbj.cond.comparators
require("dbj.cond.comparators");
// after this we have dbj.compare available
// standard strict equaility (aka '===')
// returns true
dbj.compare.standard(42,42); 
// arrays comparison
// is comparator argument is provided it is deep
// otherwise it is shallow "===" comparison
// for array elements comparing
// returns true
dbj.compare.arr([42],[42]);
// transforms both arguments to arrays
// returns true
dbj.compare.arr( 42 , 42 );
// two way lookup comparison
// if comparator argument is provided it is deep
// otherwise it is shallow "===" comparison
// returns false
dbj.compare.lookup( [42], [42]); 
// returns true
dbj.compare.lookup( 42, 42); 
// secondary comparator may be given 
// to both 'arr' and 'lookup'
// it is used for deep comparisons 
// it can be passed direct as third argument or factory
// method 'make' might be used as a better option
const fdeq = require('fast-deep-equal');
const arr = dbj.compare.make('arr', fdeq) ;
// returns true
arr([[42]],[[42]]);
// returns true
// arguments are transformed to arrays
arr({a:42},{a:42});
//
const lookup  = dbj.compare.make('lookup', fdeq );
// returns true
lookup([1,2,3], 2);
// also returns true
lookup([1,{a:2},3], {a:2})
//

For overview and usage with dbj.cond, please go to the short online manual on the GitHub project.

For testing project please go straight to dbj.cond.test on GitHub.

Please do feel free to send us your code and comments. We might publish it and discuss it on dbj.org site.

NOTE

Please do not hesitate to ask for a suport by mailing info@dbj.org

© 2018 dbj();

Keywords

equal

FAQs

Package last updated on 26 Jan 2018

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