Merge pull request #209 from anatoliychakkaev/master

List methods
This commit is contained in:
Anatoliy Chakkaev 2013-02-18 00:18:52 -08:00
commit 07b6ad3731
1 changed files with 7 additions and 4 deletions

View File

@ -115,6 +115,13 @@ if (_) {
}); });
} }
['slice', 'forEach'].forEach(function (method) {
var slice = [].slice;
List.prototype[method] = function () {
return Array.prototype[method].apply(this.items, slice.call(arguments));
};
});;
List.prototype.toObject = function() { List.prototype.toObject = function() {
return this.items; return this.items;
}; };
@ -154,10 +161,6 @@ List.prototype.remove = function(obj) {
} }
}; };
List.prototype.forEach = function(cb) {
this.items.forEach(cb);
};
List.prototype.sort = function(cb) { List.prototype.sort = function(cb) {
return this.items.sort(cb); return this.items.sort(cb);
}; };