Node.js lodash reduce()

Description

Node.js lodash reduce()


var _ = require('lodash');
var numbers = {a: 1, b:2, c:3};

var mapped = _.reduce(numbers, function(result, value, key) {
  result[key] = value * 2;/* w  w  w  .  j  av  a2  s  . c  o m*/
  return result;
}, {});

console.log(mapped);



PreviousNext

Related