jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/polyfills/array.js
2016-08-20 02:27:48 -04:00

25 lines
630 B
JavaScript

if (!Array.prototype.filter) {
Array.prototype.filter = function (fun /*, thisp*/) {
"use strict";
if (this == null)
throw new TypeError();
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun != "function")
throw new TypeError();
var res = [];
var thisp = arguments[1];
for (var i = 0; i < len; i++) {
if (i in t) {
var val = t[i]; // in case fun mutates this
if (fun.call(thisp, val, i, t))
res.push(val);
}
}
return res;
};
}