Clarify docs for callback use in _.first, _.initial, _.last, and _.rest. [ci skip] [closes #189]

Former-commit-id: 12ee5f957fa67e93e40630e627d90b9aaa7eff37
This commit is contained in:
John-David Dalton
2013-02-23 21:49:02 -08:00
parent 39974b0982
commit 58d94ef61e
5 changed files with 115 additions and 103 deletions

31
dist/lodash.compat.js vendored
View File

@@ -3236,8 +3236,9 @@
/**
* Gets the first element of the `array`. If a number `n` is passed, the first
* `n` elements of the `array` are returned. If a `callback` function is passed,
* the first elements the `callback` returns truthy for are returned. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index, array).
* elements at the beginning of the array are returned as long as the `callback`
* returns truthy. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -3391,9 +3392,9 @@
/**
* Gets all but the last element of `array`. If a number `n` is passed, the
* last `n` elements are excluded from the result. If a `callback` function
* is passed, the last elements the `callback` returns truthy for are excluded
* from the result. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
* is passed, elements at the end of the array are excluded from the result
* as long as the `callback` returns truthy. The `callback` is bound to
* `thisArg` and invoked with three arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -3514,10 +3515,11 @@
}
/**
* Gets the last element of the `array`. If a number `n` is passed, the last
* `n` elements of the `array` are returned. If a `callback` function is passed,
* the last elements the `callback` returns truthy for are returned. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index, array).
* Gets the last element of the `array`. If a number `n` is passed, the
* last `n` elements of the `array` are returned. If a `callback` function
* is passed, elements at the end of the array are returned as long as the
* `callback` returns truthy. The `callback` is bound to `thisArg` and
* invoked with three arguments;(value, index, array).
*
*
* If a property name is passed for `callback`, the created "_.pluck" style
@@ -3706,11 +3708,12 @@
}
/**
* The opposite of `_.initial`, this method gets all but the first value of `array`.
* If a number `n` is passed, the first `n` values are excluded from the result.
* If a `callback` function is passed, the first elements the `callback` returns
* truthy for are excluded from the result. The `callback` is bound to `thisArg`
* and invoked with three arguments; (value, index, array).
* The opposite of `_.initial`, this method gets all but the first value of
* `array`. If a number `n` is passed, the first `n` values are excluded from
* the result. If a `callback` function is passed, elements at the beginning
* of the array are excluded from the result as long as the `callback` returns
* truthy. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.

31
dist/lodash.js vendored
View File

@@ -3080,8 +3080,9 @@
/**
* Gets the first element of the `array`. If a number `n` is passed, the first
* `n` elements of the `array` are returned. If a `callback` function is passed,
* the first elements the `callback` returns truthy for are returned. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index, array).
* elements at the beginning of the array are returned as long as the `callback`
* returns truthy. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -3235,9 +3236,9 @@
/**
* Gets all but the last element of `array`. If a number `n` is passed, the
* last `n` elements are excluded from the result. If a `callback` function
* is passed, the last elements the `callback` returns truthy for are excluded
* from the result. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
* is passed, elements at the end of the array are excluded from the result
* as long as the `callback` returns truthy. The `callback` is bound to
* `thisArg` and invoked with three arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -3358,10 +3359,11 @@
}
/**
* Gets the last element of the `array`. If a number `n` is passed, the last
* `n` elements of the `array` are returned. If a `callback` function is passed,
* the last elements the `callback` returns truthy for are returned. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index, array).
* Gets the last element of the `array`. If a number `n` is passed, the
* last `n` elements of the `array` are returned. If a `callback` function
* is passed, elements at the end of the array are returned as long as the
* `callback` returns truthy. The `callback` is bound to `thisArg` and
* invoked with three arguments;(value, index, array).
*
*
* If a property name is passed for `callback`, the created "_.pluck" style
@@ -3550,11 +3552,12 @@
}
/**
* The opposite of `_.initial`, this method gets all but the first value of `array`.
* If a number `n` is passed, the first `n` values are excluded from the result.
* If a `callback` function is passed, the first elements the `callback` returns
* truthy for are excluded from the result. The `callback` is bound to `thisArg`
* and invoked with three arguments; (value, index, array).
* The opposite of `_.initial`, this method gets all but the first value of
* `array`. If a number `n` is passed, the first `n` values are excluded from
* the result. If a `callback` function is passed, elements at the beginning
* of the array are excluded from the result as long as the `callback` returns
* truthy. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.

View File

@@ -2515,8 +2515,9 @@
/**
* Gets the first element of the `array`. If a number `n` is passed, the first
* `n` elements of the `array` are returned. If a `callback` function is passed,
* the first elements the `callback` returns truthy for are returned. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index, array).
* elements at the beginning of the array are returned as long as the `callback`
* returns truthy. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -2670,9 +2671,9 @@
/**
* Gets all but the last element of `array`. If a number `n` is passed, the
* last `n` elements are excluded from the result. If a `callback` function
* is passed, the last elements the `callback` returns truthy for are excluded
* from the result. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
* is passed, elements at the end of the array are excluded from the result
* as long as the `callback` returns truthy. The `callback` is bound to
* `thisArg` and invoked with three arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -2781,10 +2782,11 @@
}
/**
* Gets the last element of the `array`. If a number `n` is passed, the last
* `n` elements of the `array` are returned. If a `callback` function is passed,
* the last elements the `callback` returns truthy for are returned. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index, array).
* Gets the last element of the `array`. If a number `n` is passed, the
* last `n` elements of the `array` are returned. If a `callback` function
* is passed, elements at the end of the array are returned as long as the
* `callback` returns truthy. The `callback` is bound to `thisArg` and
* invoked with three arguments;(value, index, array).
*
*
* If a property name is passed for `callback`, the created "_.pluck" style
@@ -2973,11 +2975,12 @@
}
/**
* The opposite of `_.initial`, this method gets all but the first value of `array`.
* If a number `n` is passed, the first `n` values are excluded from the result.
* If a `callback` function is passed, the first elements the `callback` returns
* truthy for are excluded from the result. The `callback` is bound to `thisArg`
* and invoked with three arguments; (value, index, array).
* The opposite of `_.initial`, this method gets all but the first value of
* `array`. If a number `n` is passed, the first `n` values are excluded from
* the result. If a `callback` function is passed, elements at the beginning
* of the array are excluded from the result as long as the `callback` returns
* truthy. The `callback` is bound to `thisArg` and invoked with three
* arguments; (value, index, array).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.