Socket
Socket
Sign inDemoInstall

arr-and

Package Overview
Dependencies
22
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    arr-and

Generic array and. Supports predicate equals function.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 21 Sep 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc