Code coverage report for ./src/ocLazyLoad.polyfill.ie8.js

Statements: 5% (1 / 20)      Branches: 5.56% (1 / 18)      Functions: 0% (0 / 1)      Lines: 5% (1 / 20)      Ignored: none     

All files » ./src/ » ocLazyLoad.polyfill.ie8.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66      1                                                                                                                            
// Array.indexOf polyfill for IE8
'use strict';
 
Iif (!Array.prototype.indexOf) {
        Array.prototype.indexOf = function (searchElement, fromIndex) {
                var k;
 
                // 1. Let O be the result of calling ToObject passing
                //    the this value as the argument.
                if (this == null) {
                        throw new TypeError('"this" is null or not defined');
                }
 
                var O = Object(this);
 
                // 2. Let lenValue be the result of calling the Get
                //    internal method of O with the argument "length".
                // 3. Let len be ToUint32(lenValue).
                var len = O.length >>> 0;
 
                // 4. If len is 0, return -1.
                if (len === 0) {
                        return -1;
                }
 
                // 5. If argument fromIndex was passed let n be
                //    ToInteger(fromIndex); else let n be 0.
                var n = +fromIndex || 0;
 
                if (Math.abs(n) === Infinity) {
                        n = 0;
                }
 
                // 6. If n >= len, return -1.
                if (n >= len) {
                        return -1;
                }
 
                // 7. If n >= 0, then Let k be n.
                // 8. Else, n<0, Let k be len - abs(n).
                //    If k is less than 0, then let k be 0.
                k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
 
                // 9. Repeat, while k < len
                while (k < len) {
                        // a. Let Pk be ToString(k).
                        //   This is implicit for LHS operands of the in operator
                        // b. Let kPresent be the result of calling the
                        //    HasProperty internal method of O with argument Pk.
                        //   This step can be combined with c
                        // c. If kPresent is true, then
                        //    i.  Let elementK be the result of calling the Get
                        //        internal method of O with the argument ToString(k).
                        //   ii.  Let same be the result of applying the
                        //        Strict Equality Comparison Algorithm to
                        //        searchElement and elementK.
                        //  iii.  If same is true, return k.
                        if (k in O && O[k] === searchElement) {
                                return k;
                        }
                        k++;
                }
                return -1;
        };
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkM6L3d3dy9vY0xhenlMb2FkL3NyYy9vY0xhenlMb2FkLnBvbHlmaWxsLmllOC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxJQUFHLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxPQUFPLEVBQUU7QUFDekIsYUFBSyxDQUFDLFNBQVMsQ0FBQyxPQUFPLEdBQUcsVUFBUyxhQUFhLEVBQUUsU0FBUyxFQUFFO0FBQ3pELG9CQUFJLENBQUMsQ0FBQzs7OztBQUlOLG9CQUFHLElBQUksSUFBSSxJQUFJLEVBQUU7QUFDYiw4QkFBTSxJQUFJLFNBQVMsQ0FBQywrQkFBK0IsQ0FBQyxDQUFDO2lCQUN4RDs7QUFFRCxvQkFBSSxDQUFDLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFDOzs7OztBQUtyQixvQkFBSSxHQUFHLEdBQUcsQ0FBQyxDQUFDLE1BQU0sS0FBSyxDQUFDLENBQUM7OztBQUd6QixvQkFBRyxHQUFHLEtBQUssQ0FBQyxFQUFFO0FBQ1YsK0JBQU8sQ0FBQyxDQUFDLENBQUM7aUJBQ2I7Ozs7QUFJRCxvQkFBSSxDQUFDLEdBQUcsQ0FBQyxTQUFTLElBQUksQ0FBQyxDQUFDOztBQUV4QixvQkFBRyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxLQUFLLFFBQVEsRUFBRTtBQUN6Qix5QkFBQyxHQUFHLENBQUMsQ0FBQztpQkFDVDs7O0FBR0Qsb0JBQUcsQ0FBQyxJQUFJLEdBQUcsRUFBRTtBQUNULCtCQUFPLENBQUMsQ0FBQyxDQUFDO2lCQUNiOzs7OztBQUtELGlCQUFDLEdBQUcsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQU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