From 089b93094a5f34277bf29790402a400516e22d15 Mon Sep 17 00:00:00 2001 From: Florian-R Date: Thu, 24 Nov 2016 14:49:31 +0100 Subject: [PATCH] Docs: Add links to iteratee --- index.html | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index 592b39e30..788b35d46 100644 --- a/index.html +++ b/index.html @@ -481,8 +481,9 @@

Collection Functions (Arrays or Objects)

each_.each(list, iteratee, [context]) Alias: forEach
- Iterates over a list of elements, yielding each in turn to an iteratee - function. The iteratee is bound to the context object, if one is + Iterates over a list of elements, yielding each in turn to an + iteratee function. + The iteratee is bound to the context object, if one is passed. Each invocation of iteratee is called with three arguments: (element, index, list). If list is a JavaScript object, iteratee's arguments will be (value, key, list). Returns the list for chaining. @@ -509,10 +510,10 @@

Collection Functions (Arrays or Objects)

Alias: collect
Produces a new array of values by mapping each value in list - through a transformation function (iteratee). The iteratee - is passed three arguments: the value, then the index - (or key) of the iteration, and finally a reference to the entire - list. + through a transformation function (iteratee). + The iteratee is passed three arguments: the value, + then the index (or key) of the iteration, + and finally a reference to the entire list.

 _.map([1, 2, 3], function(num){ return num * 3; });
@@ -564,6 +565,8 @@ 

Collection Functions (Arrays or Objects)

passes the test. The function returns as soon as it finds an acceptable element, and doesn't traverse the entire list. + predicate is transformed through iteratee + to facilitate shorthand syntaxes.

 var even = _.find([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
@@ -576,6 +579,8 @@ 

Collection Functions (Arrays or Objects)


Looks through each value in the list, returning an array of all the values that pass a truth test (predicate). + predicate is transformed through iteratee + to facilitate shorthand syntaxes.

 var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
@@ -617,6 +622,8 @@ 

Collection Functions (Arrays or Objects)


Returns the values in list without the elements that the truth test (predicate) passes. The opposite of filter. + predicate is transformed through iteratee + to facilitate shorthand syntaxes.

 var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
@@ -630,6 +637,8 @@ 

Collection Functions (Arrays or Objects)

Returns true if all of the values in the list pass the predicate truth test. Short-circuits and stops traversing the list if a false element is found. + predicate is transformed through iteratee + to facilitate shorthand syntaxes.

 _.every([2, 4, 5], function(num) { return num % 2 == 0; });
@@ -643,6 +652,8 @@ 

Collection Functions (Arrays or Objects)

Returns true if any of the values in the list pass the predicate truth test. Short-circuits and stops traversing the list if a true element is found. + predicate is transformed through iteratee + to facilitate shorthand syntaxes.

 _.some([null, 0, 'yes', false]);
@@ -689,7 +700,7 @@ 

Collection Functions (Arrays or Objects)

max_.max(list, [iteratee], [context])
- Returns the maximum value in list. If an iteratee + Returns the maximum value in list. If an iteratee function is provided, it will be used on each value to generate the criterion by which the value is ranked. -Infinity is returned if list is empty, so an isEmpty guard @@ -704,7 +715,7 @@

Collection Functions (Arrays or Objects)

min_.min(list, [iteratee], [context])
- Returns the minimum value in list. If an iteratee + Returns the minimum value in list. If an iteratee function is provided, it will be used on each value to generate the criterion by which the value is ranked. Infinity is returned if list is empty, so an isEmpty guard @@ -720,7 +731,7 @@

Collection Functions (Arrays or Objects)

sortBy_.sortBy(list, iteratee, [context])
Returns a (stably) sorted copy of list, ranked in ascending - order by the results of running each value through iteratee. + order by the results of running each value through iteratee. iteratee may also be the string name of the property to sort by (eg. length).

@@ -751,8 +762,8 @@

Collection Functions (Arrays or Objects)

indexBy_.indexBy(list, iteratee, [context])
- Given a list, and an iteratee function that returns a - key for each element in the list (or a property name), + Given a list, and an iteratee function + that returns a key for each element in the list (or a property name), returns an object with an index of each item. Just like groupBy, but for when you know your keys are unique. @@ -834,6 +845,8 @@

Collection Functions (Arrays or Objects)


Split array into two arrays: one whose elements all satisfy predicate and one whose elements all do not satisfy predicate. + predicate is transformed through iteratee + to facilitate shorthand syntaxes.

 _.partition([0, 1, 2, 3, 4, 5], isOdd);
@@ -975,7 +988,7 @@ 

Array Functions

If you know in advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If you want to compute unique items based on a transformation, pass an - iteratee function. + iteratee function.

 _.uniq([1, 2, 1, 4, 1, 3]);
@@ -1059,8 +1072,8 @@ 

Array Functions


Uses a binary search to determine the index at which the value should be inserted into the list in order to maintain the list's - sorted order. If an iteratee function is provided, it will be used to compute - the sort ranking of each value, including the value you pass. + sorted order. If an iteratee function is provided, + it will be used to compute the sort ranking of each value, including the value you pass. The iteratee may also be the string name of the property to sort by (eg. length).

@@ -1349,7 +1362,7 @@ 

Function (uh, ahem) Functions

negate_.negate(predicate)
- Returns a new negated version of the predicate function. + Returns a new negated version of the predicate function.

 var isFalsy = _.negate(Boolean);
@@ -1474,6 +1487,8 @@ 

Object Functions

Similar to _.findIndex but for keys in objects. Returns the key where the predicate truth test passes or undefined. + predicate is transformed through iteratee + to facilitate shorthand syntaxes.

@@ -1890,8 +1905,8 @@

Utility Functions

times_.times(n, iteratee, [context])
Invokes the given iteratee function n times. Each invocation of - iteratee is called with an index argument. Produces an - array of the returned values. + iteratee is called with an index argument. + Produces an array of the returned values.
Note: this example uses the object-oriented syntax.