summm

1.0.1 • Public • Published

summm

Build Status Code Climate Version Downloads

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.

/summm/

    Package Sidebar

    Install

    npm i summm

    Weekly Downloads

    5

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • bsiddiqui