numcal
v4.0.0
Published
Basic numeric calculation functions.
Downloads
158
Readme
numcal
Basic numeric calculation functions.
Installation
npm install numcal --save
Usage
'use strict'
const numcal = require('numcal')
//------------------------
// min
//------------------------
console.log(numcal.min(3, 2, 4)) //-> 2
console.log(numcal.min([3, 2, 4])) //-> 2
//------------------------
// max
//------------------------
console.log(numcal.max(3, 2, 4)) //-> 4
console.log(numcal.max([3, 2, 4])) //-> 4
//------------------------
// sum
//------------------------
console.log(numcal.sum(3, 2, 4)) //-> 9
console.log(numcal.sum([3, 2, 4])) //-> 9
//------------------------
// ave
//------------------------
console.log(numcal.ave(3, 2, 4)) //-> 3
console.log(numcal.ave([3, 2, 4])) //-> 3
API
| Signature | Description | | --------- | ----------- | | .min(val1, val2...) | Get minimum value. | | .min([val1, val2...]) | Get minimum value in array. | | .max(val1, val2...) | Get maximum value. | | .max([val1, val2...]) | Get maximum value in array. | | .sum(val1, val2...) | Get sum value. | | .sum([val1, val2...]) | Get sum value for array. | | .ave(val1, val2...) | Get average value. | | .ave([val1, val2...]) | Get average value for array. |
License
This software is released under the MIT License.