||12 months ago|
|README.md||12 months ago|
|example.js||12 months ago|
|index.js||12 months ago|
|package.json||12 months ago|
Checks only whether two given arrays intersect (ie. have values in common), but not what that intersection is exactly. This allows it to stop searching when it finds the first match, which can be much faster.
License, donations, and other boilerplate
Licensed under either the WTFPL or CC0, at your choice. In practice, that means it's more or less public domain, and you can do whatever you want with it. Giving credit is not required, but still very much appreciated! I'd love to hear from you if this module was useful to you.
Creating and maintaining open-source modules is a lot of work. A donation is also not required, but much appreciated! You can donate here.
const doArraysIntersect = require("do-arrays-intersect"); let arrayA = [1, 3, 4, 6, 7, 8]; let arrayB = [2, 5, 6, 8, 9]; console.log(doArraysIntersect(arrayA, arrayB)); // true let arrayC = [1, 3, 4, 6, 7, 8]; let arrayD = [2, 5, 9, 10, 11]; console.log(doArraysIntersect(arrayC, arrayD)); // false
Checks whether two arrays intersect. The equivalence function is
===, and custom equivalence functions are not currently supported; please file an issue if you need this!
The order that you specify the arrays in, does not matter.
- arrayA: The first array.
- arrayB: The second array.
Returns a boolean indicating whether an intersection was found (
true) or not (