mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Add default accumulator values to doc examples. [ci skip]
This commit is contained in:
@@ -7920,7 +7920,7 @@
|
|||||||
*
|
*
|
||||||
* _.reduce([1, 2], function(sum, n) {
|
* _.reduce([1, 2], function(sum, n) {
|
||||||
* return sum + n;
|
* return sum + n;
|
||||||
* });
|
* }, 0);
|
||||||
* // => 3
|
* // => 3
|
||||||
*
|
*
|
||||||
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
||||||
@@ -11589,12 +11589,12 @@
|
|||||||
* _.transform([2, 3, 4], function(result, n) {
|
* _.transform([2, 3, 4], function(result, n) {
|
||||||
* result.push(n *= n);
|
* result.push(n *= n);
|
||||||
* return n % 2 == 0;
|
* return n % 2 == 0;
|
||||||
* });
|
* }, []);
|
||||||
* // => [4, 9]
|
* // => [4, 9]
|
||||||
*
|
*
|
||||||
* _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
* _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
||||||
* (result[value] || (result[value] = [])).push(key);
|
* (result[value] || (result[value] = [])).push(key);
|
||||||
* });
|
* }, {});
|
||||||
* // => { '1': ['a', 'c'], '2': ['b'] }
|
* // => { '1': ['a', 'c'], '2': ['b'] }
|
||||||
*/
|
*/
|
||||||
function transform(object, iteratee, accumulator) {
|
function transform(object, iteratee, accumulator) {
|
||||||
|
|||||||
Reference in New Issue
Block a user