1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-14 17:45:45 +01:00

Settle stupid naming dispute.

This commit is contained in:
Kris Maglione
2010-12-07 01:13:22 -05:00
parent 175cd126b7
commit bf73483d42
5 changed files with 18 additions and 21 deletions

View File

@@ -1071,17 +1071,6 @@ const array = Class("array", Array, {
equals: function (ary1, ary2)
ary1.length === ary2.length && Array.every(ary1, function (e, i) e === ary2[i]),
/**
* Returns the first member of the given array that matches the
* given predicate.
*/
first: function first(ary, pred, self) {
for (let elem in values(ary))
if (pred.call(self, elem))
return elem;
return undefined;
},
/**
* Flattens an array, such that all elements of the array are
* joined into a single array:
@@ -1116,6 +1105,17 @@ const array = Class("array", Array, {
yield [i, ary[i]];
},
/**
* Returns the nth member of the given array that matches the
* given predicate.
*/
nth: function first(ary, pred, n, self) {
for (let elem in values(ary))
if (pred.call(self, elem) && n-- === 0)
return elem;
return undefined;
},
/**
* Filters out all duplicates from an array. If *unsorted* is false, the
* array is sorted before duplicates are removed.