Skip to content

Commit

Permalink
Removing .each
Browse files Browse the repository at this point in the history
This removes conflicts with the stache {{#each}} helper.
  • Loading branch information
phillipskevin committed Dec 12, 2017
1 parent 2f93501 commit 7888616
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
5 changes: 2 additions & 3 deletions can-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ assign(List.prototype, {
var filteredList = new this.constructor(),
self = this,
filtered;
this.each(function(item, index, list){
this.forEach(function(item, index, list){
filtered = callback.call( thisArg || self, item, index, self);
if(filtered){
filteredList.push(item);
Expand All @@ -756,7 +756,7 @@ assign(List.prototype, {
map: function (callback, thisArg) {
var filteredList = new List(),
self = this;
this.each(function(item, index, list){
this.forEach(function(item, index, list){
var mapped = callback.call( thisArg || self, item, index, self);
filteredList.push(mapped);

Expand Down Expand Up @@ -856,6 +856,5 @@ canReflect.assignSymbols(List.prototype,{

// @@can.keyHasDependencies and @@can.getKeyDependencies same as can-map

List.prototype.each = List.prototype.forEach;
Map.List = List;
module.exports = namespace.List = List;
11 changes: 0 additions & 11 deletions can-list_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,17 +413,6 @@ test('forEach callback', function () {
equal(counter, 1, 'Should not be invoked for uninitialized attr keys');
});

test('each callback', function () {
var list = new List([]),
counter = 0;
list.attr(9, 'foo');

list.each(function (item, index) {
counter++;
});
equal(counter, 1, 'Should not be invoked for uninitialized attr keys');
});

test('filter with context', function(){
var l = new List([{id: 1}]);
var context = {};
Expand Down
1 change: 1 addition & 0 deletions test/test.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!doctype hmtl>
<title>can-list</title>
<script src="../node_modules/steal/steal.js" main="can-list/can-list_test"></script>
<div id="qunit-fixture"></div>

0 comments on commit 7888616

Please sign in to comment.