any
Returns `true` if a value exists in the given string, array or object.
Last updated 11 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install any 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.0                                ...           latest (11 years ago)

3 Versions

  • 1.0.0                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 1
Dependencies (2)
Dev Dependencies (2)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |