mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
(breaking change) moving _.reduce's method signature to that of ECMA5. _.reduce(obj, iterator, memo). Updated tests and docs.
This commit is contained in:
@@ -12,11 +12,11 @@ $(document).ready(function() {
|
||||
var counts = _(lyrics).chain()
|
||||
.map(function(line) { return line.split(''); })
|
||||
.flatten()
|
||||
.reduce({}, function(hash, l) {
|
||||
.reduce(function(hash, l) {
|
||||
hash[l] = hash[l] || 0;
|
||||
hash[l]++;
|
||||
return hash;
|
||||
}).value();
|
||||
}, {}).value();
|
||||
ok(counts['a'] == 16 && counts['e'] == 10, 'counted all the letters in the song');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user