* Returns true if the element is in the array and false otherwise. * * @param {*} value * @param {number=} opt_fromIndex * @return {boolean} * @this {Array}
(value, opt_fromIndex)
| 7 | * @this {Array} |
| 8 | */ |
| 9 | function includes(value, opt_fromIndex) { |
| 10 | const fromIndex = opt_fromIndex || 0; |
| 11 | // eslint-disable-next-line local/no-invalid-this |
| 12 | const len = this.length; |
| 13 | let i = fromIndex >= 0 ? fromIndex : Math.max(len + fromIndex, 0); |
| 14 | for (; i < len; i++) { |
| 15 | // eslint-disable-next-line local/no-invalid-this |
| 16 | const other = this[i]; |
| 17 | // If value has been found OR (value is NaN AND other is NaN) |
| 18 | /*eslint "no-self-compare": 0*/ |
| 19 | if (other === value || (value !== value && other !== other)) { |
| 20 | return true; |
| 21 | } |
| 22 | } |
| 23 | return false; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Sets the Array.contains polyfill if it does not exist. |
nothing calls this directly
no outgoing calls
no test coverage detected