Skip to content

Commit

Permalink
Rename LinkedList.prototype.map -> LinkedList.prototype.forEach
Browse files Browse the repository at this point in the history
It should impact #88
  • Loading branch information
felipernb committed Aug 14, 2014
1 parent d9927c5 commit a4b8d5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data_structures/linked_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ LinkedList.prototype.delNode = function (node) {
/**
* Performs the fn function with each element in the list
*/
LinkedList.prototype.map = function (fn) {
LinkedList.prototype.forEach = function (fn) {
var node = this.head;
while (node) {
fn(node.value);
Expand Down
4 changes: 2 additions & 2 deletions test/data_structures/linked_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('LinkedList', function () {
assert.equal(l.length, 0);
});

it('should perform a function to all elements with map', function () {
it('should perform a function to all elements with forEach', function () {
var l = new LinkedList();
l.add(5);
l.add(1);
Expand All @@ -142,7 +142,7 @@ describe('LinkedList', function () {
l.add(1000);

var a = [];
l.map(function (e) {
l.forEach(function (e) {
a.push(e);
});

Expand Down

0 comments on commit a4b8d5b

Please sign in to comment.