1.0.7 • Published 8 years ago

sum-values-in-object v1.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Sums values in an object

Usage

First install:

npm install --save

Then use it:

const sumValuesInObject = require('sum-values-in-object')

If you have an object like this:

const data = {
      acorns: 1,
      'Crumble cakes': 2,
      Dizzlepix: 1000
    }

Find the sum of the values associated with a set of keys, like this:

sumValuesInObject(data, ['acorns', 'Crumble cakes', 'Dizzlepix']) // 1003