1// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys 2if (!Object.keys) { 3 Object.keys = (function () { 4 var hasOwnProperty = Object.prototype.hasOwnProperty, 5 hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), 6 dontEnums = [ 7 'toString', 8 'toLocaleString', 9 'valueOf', 10 'hasOwnProperty', 11 'isPrototypeOf', 12 'propertyIsEnumerable', 13 'constructor' 14 ], 15 dontEnumsLength = dontEnums.length; 16 17 return function (obj) { 18 if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) throw new TypeError('Object.keys called on non-object'); 19 20 var result = []; 21 22 for (var prop in obj) { 23 if (hasOwnProperty.call(obj, prop)) result.push(prop); 24 } 25 26 if (hasDontEnumBug) { 27 for (var i=0; i < dontEnumsLength; i++) { 28 if (hasOwnProperty.call(obj, dontEnums[i])) result.push(dontEnums[i]); 29 } 30 } 31 return result; 32 }; 33 })(); 34} 35 36// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter 37if (!Array.prototype.filter) 38{ 39 Array.prototype.filter = function(fun /*, thisp */) 40 { 41 "use strict"; 42 43 if (this == null) 44 throw new TypeError(); 45 46 var t = Object(this); 47 var len = t.length >>> 0; 48 if (typeof fun != "function") 49 throw new TypeError(); 50 51 var res = []; 52 var thisp = arguments[1]; 53 for (var i = 0; i < len; i++) 54 { 55 if (i in t) 56 { 57 var val = t[i]; // in case fun mutates this 58 if (fun.call(thisp, val, i, t)) 59 res.push(val); 60 } 61 } 62 63 return res; 64 }; 65} 66 67// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim 68if (!String.prototype.trim) { 69 String.prototype.trim = function () { 70 return this.replace(/^\s+|\s+$/g, ''); 71 }; 72} 73 74// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach 75if (!Array.prototype.forEach) 76{ 77 Array.prototype.forEach = function(fun /*, thisArg */) 78 { 79 "use strict"; 80 81 if (this === void 0 || this === null) 82 throw new TypeError(); 83 84 var t = Object(this); 85 var len = t.length >>> 0; 86 if (typeof fun !== "function") 87 throw new TypeError(); 88 89 var thisArg = arguments.length >= 2 ? arguments[1] : void 0; 90 for (var i = 0; i < len; i++) 91 { 92 if (i in t) 93 fun.call(thisArg, t[i], i, t); 94 } 95 }; 96} 97 98// Production steps of ECMA-262, Edition 5, 15.4.4.19 99// Reference: http://es5.github.com/#x15.4.4.19 100if (!Array.prototype.map) { 101 Array.prototype.map = function(callback, thisArg) { 102 103 var T, A, k; 104 105 if (this == null) { 106 throw new TypeError(" this is null or not defined"); 107 } 108 109 // 1. Let O be the result of calling ToObject passing the |this| value as the argument. 110 var O = Object(this); 111 112 // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". 113 // 3. Let len be ToUint32(lenValue). 114 var len = O.length >>> 0; 115 116 // 4. If IsCallable(callback) is false, throw a TypeError exception. 117 // See: http://es5.github.com/#x9.11 118 if (typeof callback !== "function") { 119 throw new TypeError(callback + " is not a function"); 120 } 121 122 // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. 123 if (thisArg) { 124 T = thisArg; 125 } 126 127 // 6. Let A be a new array created as if by the expression new Array(len) where Array is 128 // the standard built-in constructor with that name and len is the value of len. 129 A = new Array(len); 130 131 // 7. Let k be 0 132 k = 0; 133 134 // 8. Repeat, while k < len 135 while(k < len) { 136 137 var kValue, mappedValue; 138 139 // a. Let Pk be ToString(k). 140 // This is implicit for LHS operands of the in operator 141 // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. 142 // This step can be combined with c 143 // c. If kPresent is true, then 144 if (k in O) { 145 146 // i. Let kValue be the result of calling the Get internal method of O with argument Pk. 147 kValue = O[ k ]; 148 149 // ii. Let mappedValue be the result of calling the Call internal method of callback 150 // with T as the this value and argument list containing kValue, k, and O. 151 mappedValue = callback.call(T, kValue, k, O); 152 153 // iii. Call the DefineOwnProperty internal method of A with arguments 154 // Pk, Property Descriptor {Value: mappedValue, : true, Enumerable: true, Configurable: true}, 155 // and false. 156 157 // In browsers that support Object.defineProperty, use the following: 158 // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true }); 159 160 // For best browser support, use the following: 161 A[ k ] = mappedValue; 162 } 163 // d. Increase k by 1. 164 k++; 165 } 166 167 // 9. return A 168 return A; 169 }; 170} 171 172// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf 173if (!Array.prototype.indexOf) { 174 Array.prototype.indexOf = function (searchElement, fromIndex) { 175 if ( this === undefined || this === null ) { 176 throw new TypeError( '"this" is null or not defined' ); 177 } 178 179 var length = this.length >>> 0; // Hack to convert object.length to a UInt32 180 181 fromIndex = +fromIndex || 0; 182 183 if (Math.abs(fromIndex) === Infinity) { 184 fromIndex = 0; 185 } 186 187 if (fromIndex < 0) { 188 fromIndex += length; 189 if (fromIndex < 0) { 190 fromIndex = 0; 191 } 192 } 193 194 for (;fromIndex < length; fromIndex++) { 195 if (this[fromIndex] === searchElement) { 196 return fromIndex; 197 } 198 } 199 200 return -1; 201 }; 202} 203// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray 204 205if (! Array.isArray) { 206 Array.isArray = function(obj) { 207 return Object.prototype.toString.call(obj) === "[object Array]"; 208 }; 209} 210 211// https://github.com/ttaubert/node-arraybuffer-slice 212// (c) 2013 Tim Taubert <[email protected]> 213// arraybuffer-slice may be freely distributed under the MIT license. 214 215"use strict"; 216 217if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) { 218 ArrayBuffer.prototype.slice = function (begin, end) { 219 begin = (begin|0) || 0; 220 var num = this.byteLength; 221 end = end === (void 0) ? num : (end|0); 222 223 // Handle negative values. 224 if (begin < 0) begin += num; 225 if (end < 0) end += num; 226 227 if (num === 0 || begin >= num || begin >= end) { 228 return new ArrayBuffer(0); 229 } 230 231 var length = Math.min(num - begin, end - begin); 232 var target = new ArrayBuffer(length); 233 var targetArray = new Uint8Array(target); 234 targetArray.set(new Uint8Array(this, begin, length)); 235 return target; 236 }; 237}
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.