A find and match utility. Search for a string or an array of strings within a string or array or strings.
npm install haystack --save
bower 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!
- helpers/resolve-dep
- helpers/matchkeys
- assemble/assemble
- assemble/assemble-less
- assemble/handlebars-helpers
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.