1// Polyfill for patching IE11 Browsers 2// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find#Polyfill 3 4if (!Array.prototype.find) { 5 Object.defineProperty(Array.prototype, 'find', { // eslint-disable-line no-extend-native 6 value: function(predicate) { 7 'use strict'; 8 9 var o, len, thisArg, k, kValue; 10 11 // 1. Let O be ? ToObject(this value). 12 if (this == null) { 13 throw new TypeError('"this" is null or not defined'); 14 } 15 16 o = Object(this); 17 18 // 2. Let len be ? ToLength(? Get(O, "length")). 19 // eslint-disable-next-line no-bitwise 20 len = o.length >>> 0; 21 22 // 3. If IsCallable(predicate) is false, throw a TypeError exception. 23 if (typeof predicate !== 'function') { 24 throw new TypeError('predicate must be a function'); 25 } 26 27 // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. 28 thisArg = arguments[1]; 29 30 // 5. Let k be 0. 31 k = 0; 32 33 // 6. Repeat, while k < len 34 while (k < len) { 35 // a. Let Pk be ! ToString(k). 36 // b. Let kValue be ? Get(O, Pk). 37 // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). 38 // d. If testResult is true, return kValue. 39 kValue = o[k]; 40 if (predicate.call(thisArg, kValue, k, o)) { 41 return kValue; 42 } 43 // e. Increase k by 1. 44 k++; 45 } 46 47 // 7. Return undefined. 48 return undefined; 49 } 50 }); 51}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.