Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/okunishinishi/node-numcal

Node.js module for basic numeric calculations.
https://github.com/okunishinishi/node-numcal

Last synced: 12 days ago
JSON representation

Node.js module for basic numeric calculations.

Awesome Lists containing this project

README

        

numcal
==========

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![Code Climate][bd_codeclimate_shield_url]][bd_codeclimate_url]
[![Code Coverage][bd_codeclimate_coverage_shield_url]][bd_codeclimate_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/okunishinishi/node-numcal
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-numcal
[bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-numcal.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/okunishinishi/node-numcal
[bd_travis_com_shield_url]: https://api.travis-ci.com/okunishinishi/node-numcal.svg?token=
[bd_license_url]: https://github.com/okunishinishi/node-numcal/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-numcal
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-numcal.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-numcal.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-numcal
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-numcal.svg
[bd_npm_url]: http://www.npmjs.org/package/numcal
[bd_npm_shield_url]: http://img.shields.io/npm/v/numcal.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

Basic numeric calculation functions.

Installation
-----

```bash
npm install numcal --save
```

Usage
-----

```javascript
'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](https://github.com/okunishinishi/node-numcal/blob/master/LICENSE).

Links
------

+ [chopcal][chopcal_url]
+ [veccal][veccal_url]
+ [rangecal][rangecal_url]

[chopcal_url]: https://github.com/okunishinishi/node-chopcal
[veccal_url]: https://github.com/okunishinishi/node-veccal
[rangecal_url]: https://github.com/okunishinishi/node-rangecal