{"_id":"reduce-object","_rev":"81777","name":"reduce-object","description":"Reduces an object to a value that is the accumulated result of running each property in the object through a callback. Executes the callback function once for each own enumerable property in the object, receiving four arguments: the initial value (or valu","dist-tags":{"latest":"0.1.3"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:26:05.000Z","created":"2014-09-21T00:04:46.081Z","0.1.3":"2014-09-28T16:06:09.829Z","0.1.2":"2014-09-21T00:04:46.081Z"},"users":{"jonschlinkert":true,"zuojiang":true},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/reduce-object.git"},"versions":{"0.1.3":{"name":"reduce-object","description":"Reduces an object to a value that is the accumulated result of running each property in the object through a callback. Executes the callback function once for each own enumerable property in the object, receiving four arguments: the initial value (or valu","version":"0.1.3","homepage":"https://github.com/jonschlinkert/reduce-object","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/reduce-object.git"},"bugs":{"url":"https://github.com/jonschlinkert/reduce-object/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/reduce-object/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"mocha":"*","should":"^4.0.4"},"keywords":["accumulate","accumulator","callback","cb","find","for-in","for-own","has","has-own","hasOwn","index","iterate","iterator","javascript","js","key","keys","loop","node.js","object","own","prop","properties","property","reduce","util","utilities","utility","utils","value"],"dependencies":{"for-own":"^0.1.1"},"_id":"reduce-object@0.1.3","_shasum":"d549d40a6c2936fa4e3e9b78ca89c93314594218","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"d549d40a6c2936fa4e3e9b78ca89c93314594218","size":2990,"noattachment":false,"key":"/reduce-object/-/reduce-object-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/reduce-object/download/reduce-object-0.1.3.tgz"},"directories":{},"publish_time":1411920369829,"_cnpm_publish_time":1411920369829,"_hasShrinkwrap":false},"0.1.2":{"name":"reduce-object","description":"Reduces an object to a value that is the accumulated result of running each property in the object through a callback. Executes the callback function once for each own enumerable property in the object, receiving four arguments: the initial value (or valu","version":"0.1.2","homepage":"https://github.com/jonschlinkert/reduce-object","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/reduce-object.git"},"bugs":{"url":"https://github.com/jonschlinkert/reduce-object/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/reduce-object/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"mocha":"*","should":"^4.0.4"},"keywords":["accumulate","accumulator","callback","cb","find","for-in","for-own","has","has-own","hasOwn","index","iterate","iterator","javascript","js","key","keys","loop","node.js","object","own","prop","properties","property","reduce","util","utilities","utility","utils","value"],"dependencies":{"for-own":"^0.1.1"},"_id":"reduce-object@0.1.2","_shasum":"623d32530c8b30113a72aac564b12221cd118908","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"623d32530c8b30113a72aac564b12221cd118908","size":2984,"noattachment":false,"key":"/reduce-object/-/reduce-object-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/reduce-object/download/reduce-object-0.1.2.tgz"},"directories":{},"publish_time":1411257886081,"_cnpm_publish_time":1411257886081,"_hasShrinkwrap":false}},"readme":"# reduce-object [![NPM version](https://badge.fury.io/js/reduce-object.svg)](http://badge.fury.io/js/reduce-object)\n\n> Reduces an object to a value that is the accumulated result of running each property in the object through a callback.\n\n## Install\n#### Install with [npm](npmjs.org):\n\n```bash\nnpm i reduce-object --save\n```\n\n## Run tests\n\n```bash\nnpm test\n```\n\n## Usage\n\nExecutes the callback function once for each own enumerable property in the object, receiving four arguments:\n\n  - `acc`: the initial value (or value from the previous callback call),\n  - `value`: the of the current property,\n  - `key`: the of the current property, and\n  - the original `object` over which the function is iterating.\n\n```js\nvar reduce = require('reduce-object');\n\nvar a = {a: 'foo', b: 'bar', c: {}};\n\nvar obj = reduce(a, function (acc, value, key, orig) {\n  if (typeof value === 'object') {\n    acc[key] = {what: 'huh?'};\n  } else {\n    acc[key] = value.toUpperCase(); // why?\n  }\n  return acc;\n}, {});\n\nconsole.log(obj);\n//=> {a: 'FOO', b: 'BAR', c: {what: 'huh?'}};\n```\n\n## Author\n\n**Jon Schlinkert**\n\n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\nCopyright (c) 2014 Jon Schlinkert, contributors.\nReleased under the MIT license\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 20, 2014._","_attachments":{},"homepage":"https://github.com/jonschlinkert/reduce-object","bugs":{"url":"https://github.com/jonschlinkert/reduce-object/issues"}}