sumov
v1.2.0
Published
Computes the sum of all numeric values in an (multilevel) object
Maintainers
Readme
Sumov
Computes the sum of all numeric values in an (multilevel) object.
To sum up to N levels of an object, just pass N as a second parameter.
Usage
const sumov = require('sumov');
let sum = sumov({a: 2, b: ["2", null, [], {a: {a: -1.0}}], c: {quick: "maths"}});
// => 3
//sum up to 2 levels
sum = sumov({a: 2, b: ["2", null, [], {a: {a: -1.0}}], c: {quick: "maths"}}, 2);
// => 4Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js.
Installation is done using the
npm install command:
$ npm i --save sumovSee the package source for more details.
