any

1.0.0 • Public • Published

any NPM version Build Status

Returns true if a value exists in the given string, array or object.

  • if a callback is passed, checks to see if a truthy value is returned for any element in a collection or for any sub-string in a string.
  • returns as soon as it finds a passing value and does not iterate over the entire collection.

Install with npm

npm i any --save

Usage

var any = require('any');
any('a-b-c', 'a');
//=> true
 
any('a-b-c', 'd');
//=> false
 
any({a: 'b', c: 'd'}, 'a');
//=> true
 
any([{a: 'b', c: 'd'}], {a: 'b'});
//=> true
 
any('a-b-c', 'd');
//=> false

Running tests

Install dev dependencies.

npm i -d && npm test

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on February 26, 2015.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    35,289
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    35,289
  • 0.1.2
    58
  • 0.1.0
    2

Package Sidebar

Install

npm i any

Weekly Downloads

35,349

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jonschlinkert