arithmetic
Version:
Simple javascript safe arithmetic functions
68 lines (46 loc) • 1.54 kB
Markdown
# arithmetic
[](https://travis-ci.org/bsiddiqui/arithmetic) [](https://codeclimate.com/github/bsiddiqui/arithmetic) [](http://badge.fury.io/js/arithmetic) [](https://www.npmjs.com/package/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
```js
var arithmetic = require('arithmetic')
arithmetic.add(4, 2)
// => 6
```
## API
#### `arithmetic.add(num1, num2)` -> `number`
##### num1/num2
*Required* <br>
Type: `number`
#### `arithmetic.sum(numbers)` -> `number`
##### numbers
*Required* <br>
Type: `number array`
#### `arithmetic.subtract(num1, num2)` -> `number`
##### num1/num2
*Required* <br>
Type: `number`
#### `arithmetic.difference(numbers)` -> `number`
##### numbers
*Required* <br>
Type: `number array`
#### `arithmetic.multiply(num1, num2)` -> `number`
##### num1/num2
*Required* <br>
Type: `number`
#### `arithmetic.product(numbers)` -> `number`
##### numbers
*Required* <br>
Type: `number array`
#### `arithmetic.divide(num1, num2)` -> `number`
##### num1/num2
*Required* <br>
Type: `number`
#### `arithmetic.quotient(numbers)` -> `number`
##### numbers
*Required* <br>
Type: `number array`