New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arr-and

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arr-and

Generic array and. Supports predicate equals function.

1.0.0
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Array AND

Build Status

Generic array and function which supports equals predicate function.

Install

npm install arr-and

Usage

var and = require('arr-and');

and([1, 2], [2, 3]);
//=> [2]

and([1, 2, 3], [2, 3, 4], [3, 4, 5]);
//=> [3]

and([{id: 1}, {id: 2}], [{id: 2}, {id: 3}], function equals(a, b) {
    return a.id === b.id;
});
//=> [{id: 2}]

API

and(...arrays, [equalsPredicate])

Creates an array of unique values that is the logical conjuction of the provided arrays.

...arrays

Required
Type: array

Two or more arrays to do AND operation.

equalsPredicate

Type: function
Default: function(a, b) { return a === b; }

Equality function. Should return true if a and b items are equal.

License

MIT

Keywords

array

FAQs

Package last updated on 21 Sep 2015

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