arithmetic
v1.0.1
Published
Simple javascript safe arithmetic functions
Downloads
16
Maintainers
Readme
arithmetic
Arithmetic safely conducts arithmetic operations by ensuring the values are valid numbers and typecasting them prior to evaluation.
Install
$ npm install --save arithmetic
Usage
var arithmetic = require('arithmetic')
arithmetic.add(4, 2)
// => 6
API
arithmetic.add(num1, num2)
-> number
num1/num2
Required
Type: number
arithmetic.sum(numbers)
-> number
numbers
Required
Type: number array
arithmetic.subtract(num1, num2)
-> number
num1/num2
Required
Type: number
arithmetic.difference(numbers)
-> number
numbers
Required
Type: number array
arithmetic.multiply(num1, num2)
-> number
num1/num2
Required
Type: number
arithmetic.product(numbers)
-> number
numbers
Required
Type: number array
arithmetic.divide(num1, num2)
-> number
num1/num2
Required
Type: number
arithmetic.quotient(numbers)
-> number
numbers
Required
Type: number array