Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@ndhoule/includes

2.0.1 • Public • Published

includes CI

Determine whether or not a value is contained by a given collection.

Uses SameValueZero (the algorithm used by Object.is) for equality comparisons.

Installation

$ component install ndhoule/includes
$ npm install @ndhoule/includes

API

includes(searchElement : *, collection : Object|Array|string) => boolean

includes(2, [1, 2, 3]);
//=> true
 
includes(4, [1, 2, 3]);
//=> false
 
includes(2, { a: 1, b: 2, c: 3 });
//=> true
 
includes('a', { a: 1, b: 2, c: 3 });
//=> false
 
includes('abc', 'xyzabc opq');
//=> true
 
includes('nope', 'xyzabc opq');
//=> false

License

Released under the MIT license.

Install

npm i @ndhoule/includes

DownloadsWeekly Downloads

18,864

Version

2.0.1

License

MIT

Last publish

Collaborators

  • avatar