MCPcopy Create free account
hub / github.com/RubyLouvre/anu / includes

Function includes

test/babel.js:10454–10463  ·  view source on GitHub ↗

* Checks if `value` is in `collection`. If `collection` is a string, it's * checked for a substring of `value`, otherwise * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * is used for equality comparisons. If `fromIndex` is negative, it's used as * the offs

(collection, value, fromIndex, guard)

Source from the content-addressed store, hash-verified

10452 * // => true
10453 */
10454 function includes(collection, value, fromIndex, guard) {
10455 collection = isArrayLike(collection) ? collection : values(collection);
10456 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10457
10458 var length = collection.length;
10459 if (fromIndex < 0) {
10460 fromIndex = nativeMax(length + fromIndex, 0);
10461 }
10462 return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10463 }
10464
10465 module.exports = includes;
10466

Callers 1

baseUniqFunction · 0.85

Calls 5

valuesFunction · 0.85
toIntegerFunction · 0.85
baseIndexOfFunction · 0.85
isArrayLikeFunction · 0.70
isStringFunction · 0.70

Tested by

no test coverage detected