Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.19 KB

.verb.md

File metadata and controls

33 lines (23 loc) · 1.19 KB

{%= include("install-bower", {save: true}) %}

Usage

the initial value (or value from the previous callback call), the value of the current property, the key of the current property, and the object over which the function is iterating. Node.js/JavaScript utility.)_

Params

  • object {Object}: The object to iterate over (the iteratee)
  • fn {Function}: The function invoked per iteration.
  • init {Object}: The initial value to use for the accumulator.
  • thisArg {Object}: (optional) Object to use as the invocation context for the iterator (expose as this inside the iterator)

Executes the given callback fn once for each own enumerable property in the object. The callback receives the following arguments:

  • acc: the initial value (or value from the previous callback call),
  • value: the of the current property,
  • key: the of the current property, and
  • the original object over which the function is iterating.

Example

var reduce = require('{%= name %}');
var a = {a: 'foo', b: 'bar', c: 'baz'};

reduce(a, function(acc, value, key, obj) {
  acc[key] = value.toUpperCase();
  return acc;
}, {});

//=> {a: 'FOO', b: 'BAR', c: 'BAZ'};