🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

haystack

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

haystack

A find and match utility. Search for a string or an array of strings within a string or array or strings.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

haystack NPM version

A find and match utility. Search for a string or an array of strings within a string or array or strings.

Getting started

Install the module with: npm install haystack --save

var haystack = require('haystack');

Interface

filter

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']

hasMatch

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

Contributing

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!

Authors

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license

This file was generated by grunt-readme on Wednesday, January 8, 2014.

Keywords

regex

FAQs

Package last updated on 08 Jan 2014

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