1.2.0 • Published 6 years ago

sumov v1.2.0

Weekly downloads
16
License
MIT
Repository
github
Last release
6 years ago

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);
// => 4

Installation

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 sumov

See the package source for more details.