Code Duplication    Length = 18-19 lines in 2 locations

shims.js 2 locations

@@ 290-308 (lines=19) @@
287
288
// ES5 15.4.4.19 Array.prototype.map ( callbackfn [ , thisArg ] )
289
// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/Map
290
if (!Array.prototype.map) {
291
  Array.prototype.map = function (fun /*, thisp */) {
292
    if (this === void 0 || this === null) { throw TypeError(); }
293
294
    var t = Object(this);
295
    var len = t.length >>> 0;
296
    if (typeof fun !== "function") { throw TypeError(); }
297
298
    var res = []; res.length = len;
299
    var thisp = arguments[1], i;
300
    for (i = 0; i < len; i++) {
301
      if (i in t) {
302
        res[i] = fun.call(thisp, t[i], i, t);
303
      }
304
    }
305
306
    return res;
307
  };
308
}
309
310
// ES5 15.4.4.20 Array.prototype.filter ( callbackfn [ , thisArg ] )
311
// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/Filter
@@ 249-266 (lines=18) @@
246
247
// ES5 15.4.4.17 Array.prototype.some ( callbackfn [ , thisArg ] )
248
// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
249
if (!Array.prototype.some) {
250
  Array.prototype.some = function (fun /*, thisp */) {
251
    if (this === void 0 || this === null) { throw TypeError(); }
252
253
    var t = Object(this);
254
    var len = t.length >>> 0;
255
    if (typeof fun !== "function") { throw TypeError(); }
256
257
    var thisp = arguments[1], i;
258
    for (i = 0; i < len; i++) {
259
      if (i in t && fun.call(thisp, t[i], i, t)) {
260
        return true;
261
      }
262
    }
263
264
    return false;
265
  };
266
}
267
268
// ES5 15.4.4.18 Array.prototype.forEach ( callbackfn [ , thisArg ] )
269
// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach