
Product
Introducing Supply Chain Attack Campaigns Tracking in the Socket Dashboard
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.
A find and match utility. Search for a string or an array of strings within a string or array or strings.

A find and match utility. Search for a string or an array of strings within a string or array or strings.
Install the module with: npm install haystack --save
var haystack = require('haystack');
Creates an array of unique values present in all provided arrays using strict equality for comparisons, i.e. ===.
haystack.filter([1, 2, 3], [5, 2, 1, 4]);
// => [1, 2]
haystack.filter('a', ['b', 'a']);
// => ['a']
haystack.filter(['a', 'b'], 'a');
// => ['a']
haystack.filter(['c', 'd'], ['d', 'e', 'c']);
// => ['c', 'd']
haystack.filter(['f', 'g'], 'f, h, i');
// => []
haystack.filter(['f', 'g'], 'f, h, i', ',');
// => ['f']
Optionally pass a string separator as a third parameter.
haystack.filter(['f', 'b'], 'a,f,k,l', ',');
// => ['f']
haystack.filter(['find', 'exclude'], 'A find and match utility', ' ');
// => ['find']
haystack.filter([1, 2, 3], [5, 2, 1, 4]);
// => true
haystack.filter('a', ['b', 'a']);
// => true
haystack.filter(['c', 'd'], ['d', 'e', 'c']);
// => true
haystack.filter(['f', 'g'], 'f, h, i');
// => false
haystack.filter(['f', 'g'], 'f, h, i', ',');
// => true
Find a bug? Have a feature request? Please create an Issue.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt, and build the documentation with grunt-readme.
Pull requests are also encouraged, and if you find this project useful please consider "starring" it to show your support! Thanks!
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license
This file was generated by grunt-readme on Wednesday, January 8, 2014.
FAQs
A find and match utility. Search for a string or an array of strings within a string or array or strings.
We found that haystack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Security News
Node.js 25.4.0 makes require(esm) stable, formalizing CommonJS and ESM compatibility across supported Node versions.