* Checks if a given value is present in a collection using strict equality * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the * offset from the end of the collection. * * @static * @memberOf _ * @alias include * @category Collections
(collection, target, fromIndex)
| 38111 | * // => true |
| 38112 | */ |
| 38113 | function contains(collection, target, fromIndex) { |
| 38114 | var index = -1, |
| 38115 | indexOf = getIndexOf(), |
| 38116 | length = collection ? collection.length : 0, |
| 38117 | result = false; |
| 38118 | |
| 38119 | fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; |
| 38120 | if (isArray(collection)) { |
| 38121 | result = indexOf(collection, target, fromIndex) > -1; |
| 38122 | } else if (typeof length == 'number') { |
| 38123 | result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1; |
| 38124 | } else { |
| 38125 | forOwn(collection, function(value) { |
| 38126 | if (++index >= fromIndex) { |
| 38127 | return !(result = value === target); |
| 38128 | } |
| 38129 | }); |
| 38130 | } |
| 38131 | return result; |
| 38132 | } |
| 38133 | |
| 38134 | /** |
| 38135 | * Creates an object composed of keys generated from the results of running |
nothing calls this directly
no test coverage detected