summm
v1.0.1
Published
Safely get the sum of numbers
Downloads
1
Readme
summm
Summm safely adds numbers in Javascript by ensuring the values are valid numbers and typecasting them prior to evaluation. This ensures that you actually add numbers instead of concating them.
Install
$ npm install --save summm
Usage
var sum = require('summm')
sum(4, 2)
// => 6
sum('4', 2)
// => 6
sum([4, 2, 1])
// => 7
API
sum(numbers)
-> number
numbers
Required
Type: number
\ array of numbers
The numbers you'd like to get the sum of. Can be an array of numbers or each number provided as an argument.