Sha256: 86a611b7d557adb052b534aef69f17defed6d444304b5b0b8ec087541a7e0367

Contents?: true

Size: 699 Bytes

Versions: 8

Compression:

Stored size: 699 Bytes

Contents

// MSIE 8 doesn't support Array.prototype.filter
// From: http://stackoverflow.com/questions/2722159/javascript-how-to-filter-object-array-based-on-attributes
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter

if (!Array.prototype.filter) {
  Array.prototype.filter = function(fun /*, thisp*/) {
    var len = this.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 this) {
        var val = this[i]; // in case fun mutates this
        if (fun.call(thisp, val, i, this))
        res.push(val);
      }
    }
    return res;
  };
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hat-trick-0.4.0 vendor/assets/javascripts/array.filter.js
hat-trick-0.3.0 vendor/assets/javascripts/array.filter.js
hat-trick-0.2.2 vendor/assets/javascripts/array.filter.js
hat-trick-0.2.1 vendor/assets/javascripts/array.filter.js
hat-trick-0.2.0 vendor/assets/javascripts/array.filter.js
hat-trick-0.1.5 vendor/assets/javascripts/array.filter.js
hat-trick-0.1.4 vendor/assets/javascripts/array.filter.js
hat-trick-0.1.3 vendor/assets/javascripts/array.filter.js