sum-values-in-object

1.0.7 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i sum-values-in-object

Weekly Downloads

3

Version

1.0.7

License

MIT

Last publish

Collaborators

  • billyzac