* 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)
| 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 |
no test coverage detected