add models for reduceRight and filter

This commit is contained in:
Manu Sridharan 2015-03-17 16:47:12 -07:00
parent 42880c6516
commit f6167c6f0c
1 changed files with 31 additions and 0 deletions

View File

@ -378,7 +378,38 @@ Array$proto$__WALA__ = {
}
}
return result;
},
reduceRight: function Array_prototype_reduceRight(arg1, arg2) {
var result = arg2;
var n0 = this.length;
for (var i = 0; i < n0; i += 1) {
var n1 = ((n0-i)-1) in this;
if (n1) {
var n2 = this[(n0-i)-1];
var n3 = arg1.call(undefined, result, n2, (n0-i)-1, this);
result = n3;
}
}
return result;
},
filter: function Array_prototype_filter(arg1, arg2) {
var result = [];
var n0 = this.length;
for (var i = 0; i < n0; i += 1) {
var n1 = i in this;
if (n1) {
var n2 = this[i];
var n3 = arg1.call(arg2, n2, i, this);
if (n3) {
result[result.length] = n2;
}
}
}
return result;
}
};
Array.isArray = function Array_isArray(a) {