-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
Including docs and tests and method reference spreadsheet.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ List.prototype.find = function (value, equals, index) { | |
var head = this.head; | ||
var at = this.scan(index, head.next); | ||
while (at !== head) { | ||
if (equals(at.value, value)) { | ||
if (equals(value, at.value)) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kriskowal
Author
Member
|
||
return at; | ||
} | ||
at = at.next; | ||
|
@@ -49,7 +49,7 @@ List.prototype.findLast = function (value, equals, index) { | |
var head = this.head; | ||
var at = this.scan(index, head.prev); | ||
while (at !== head) { | ||
if (equals(at.value, value)) { | ||
if (equals(value, at.value)) { | ||
return at; | ||
} | ||
at = at.prev; | ||
|
@@ -88,6 +88,22 @@ List.prototype['delete'] = function (value, equals) { | |
return false; | ||
}; | ||
|
||
List.prototype.deleteAll = function (value, equals) { | ||
equals = equals || this.contentEquals; | ||
var head = this.head; | ||
var at = head.next; | ||
var count = 0; | ||
while (at !== head) { | ||
if (equals(value, at.value)) { | ||
at["delete"](); | ||
count++; | ||
} | ||
at = at.next; | ||
} | ||
this.length -= count; | ||
return count; | ||
}; | ||
|
||
List.prototype.clear = function () { | ||
var plus, minus; | ||
if (this.dispatchesRangeChanges) { | ||
|
@kriskowal: sorry for the digging but do you mind if I ask the point of this change ?
Is it because of type coercion rules (coercing
at.value
to primitive if needed) ? I can't see how coercing the old value is better than coercing the new one.again, sorry for the noise.