array-math
Advanced tools
Comparing version 1.1.2 to 1.1.3
{ | ||
"name": "array-math", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"main": "./index.js", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -5,24 +5,12 @@ array-math | ||
[![Build Status](https://travis-ci.org/ArtskydJ/array-math.svg?branch=master)](https://travis-ci.org/ArtskydJ/array-math) | ||
[![Github Repository](http://img.shields.io/badge/Repository-Github-brightgreen.svg)](https://github.com/ArtskydJ/array-math) | ||
- [Install](#install) | ||
- [Require](#require) | ||
- [Methods](#methods) | ||
- [aMath.factors(n)](#amathfactorsn) | ||
- [aMath.divisors(n)](#amathdivisorsn) | ||
- [aMath.isPrime(n)](#amathisprimen) | ||
- [aMath.range(n[, m])](#amathrangen-m) | ||
- [aMath.multiply(a)](#amathmultiplya) | ||
- [aMath.sum(a)](#amathsuma) | ||
- [aMath.factorial(h[, l])](#amathfactorialh-l) | ||
- [Example](#example) | ||
- [License](#license) | ||
## modularity | ||
##Install | ||
Sorry, I built this before I learned the truth about modularity. See the following links for enlightenment. ;-) | ||
Install with [NPM](http://nodejs.org) | ||
- http://substack.net/finding_modules | ||
- http://substack.net/how_I_write_modules | ||
- http://substack.net/many_things | ||
npm install array-math | ||
##Require | ||
# api | ||
@@ -33,5 +21,6 @@ ```js | ||
##Methods | ||
##aMath.factors(n) | ||
# aMath.factors(n) | ||
*If you only want this function, try [primefactors](https://www.npmjs.com/package/primefactors).* | ||
- `n` must be a positive integer | ||
@@ -45,4 +34,6 @@ | ||
##aMath.divisors(n[, opts]) | ||
# aMath.divisors(n[, opts]) | ||
*If you only want this function, you could factor it out, and send me a PR with a link to your module! (Grab the test file while you're at it.)* | ||
- `n` must be a positive number. | ||
@@ -59,4 +50,6 @@ - `opts` is an object with the options. Defaults to `{}`. | ||
##aMath.isPrime(n) | ||
# aMath.isPrime(n) | ||
*If you only want this function, try [isprime](https://www.npmjs.com/package/isprime).* | ||
- `n` must be a positive integer | ||
@@ -76,4 +69,6 @@ | ||
##aMath.range([start,] stop [,step]) | ||
# aMath.range([start,] stop [,step]) | ||
*If you only want this function, try [array-range](https://www.npmjs.com/package/array-range). (Does not have stepping built in.)* | ||
- `start` is the starting number of the range. Defaults to `0`. If there are 2 or 3 arguments, this is assumed to be the first. | ||
@@ -96,4 +91,10 @@ - `stop` is the ending number of the range. Defaults to `0`. If there is 1 argument, this is assumed to be it. | ||
##aMath.multiply(a) | ||
# aMath.multiply(a) | ||
*If you only want this function, it might be best to just write it yourself:* | ||
```js | ||
arr.reduce(function (prdct, fctr) { return prdct * fctr }, 1) | ||
``` | ||
- `a` must be an array of numbers (integers, floats, negative, whatever). | ||
@@ -108,4 +109,10 @@ | ||
##aMath.sum(a) | ||
# aMath.sum(a) | ||
*If you only want this function, it might be best to just write it yourself:* | ||
```js | ||
arr.reduce(function (sum, val) { return sum + val }, 0) | ||
``` | ||
- `a` must be an array of numbers (integers, floats, negative, whatever). | ||
@@ -119,4 +126,6 @@ | ||
##aMath.factorial(h[, l]) | ||
# aMath.factorial(h[, l]) | ||
*If you only want this function, try [factorial](https://www.npmjs.com/package/factorial). (Does not have low number built in.)* | ||
- `h` must be a number. It is the high number. It defaults to 0. | ||
@@ -143,4 +152,10 @@ - `l` must be a number. It is the low number. It defaults to 0. | ||
##License | ||
# install | ||
[MIT](http://opensource.org/licenses/MIT) | ||
Install with [NPM](http://nodejs.org/download) | ||
npm install array-math | ||
# license | ||
[VOL](http://veryopenlicense.com) |
@@ -7,14 +7,14 @@ var test = require('tap').test | ||
var checkAgainst = [ | ||
[1, 2], | ||
[1, 7], | ||
[1, 3, 5, 15], | ||
[1, 2, 4, 8, 16], | ||
[1, 23], | ||
[1, 7, 11, 77], | ||
[1, 2, 47, 94], | ||
[1, 5, 19, 95], | ||
[1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 96], | ||
[1, 2, 4, 5, 10, 20, 25, 50, 100], | ||
[1, 2, 4, 8, 47, 94, 188, 376] | ||
] | ||
[1, 2], | ||
[1, 7], | ||
[1, 3, 5, 15], | ||
[1, 2, 4, 8, 16], | ||
[1, 23], | ||
[1, 7, 11, 77], | ||
[1, 2, 47, 94], | ||
[1, 5, 19, 95], | ||
[1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 96], | ||
[1, 2, 4, 5, 10, 20, 25, 50, 100], | ||
[1, 2, 4, 8, 47, 94, 188, 376] | ||
] | ||
testThese.forEach(function (val, ind) { | ||
@@ -30,14 +30,14 @@ t.similar(aMath.divisors(val), checkAgainst[ind], | ||
var checkAgainst = [ | ||
[1], | ||
[1], | ||
[1, 3, 5], | ||
[1, 2, 4, 8], | ||
[1], | ||
[1, 7, 11], | ||
[1, 2, 47], | ||
[1, 5, 19], | ||
[1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48], | ||
[1, 2, 4, 5, 10, 20, 25, 50], | ||
[1, 2, 4, 8, 47, 94, 188] | ||
] | ||
[1], | ||
[1], | ||
[1, 3, 5], | ||
[1, 2, 4, 8], | ||
[1], | ||
[1, 7, 11], | ||
[1, 2, 47], | ||
[1, 5, 19], | ||
[1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48], | ||
[1, 2, 4, 5, 10, 20, 25, 50], | ||
[1, 2, 4, 8, 47, 94, 188] | ||
] | ||
testThese.forEach(function (val, ind) { | ||
@@ -44,0 +44,0 @@ t.similar(aMath.divisors(val, {proper:true}), checkAgainst[ind], |
@@ -7,17 +7,17 @@ var test = require('tap').test | ||
var checkAgainst = [ | ||
[2], | ||
[7], | ||
[3, 5], | ||
[2, 2, 2, 2], | ||
[23], | ||
[7, 11], | ||
[2, 47], | ||
[5, 19], | ||
[2, 2, 2, 2, 2, 3], | ||
[97], | ||
[2, 7, 7], | ||
[3, 3, 11], | ||
[2, 2, 5, 5], | ||
[2, 2, 2, 47] | ||
] | ||
[2], | ||
[7], | ||
[3, 5], | ||
[2, 2, 2, 2], | ||
[23], | ||
[7, 11], | ||
[2, 47], | ||
[5, 19], | ||
[2, 2, 2, 2, 2, 3], | ||
[97], | ||
[2, 7, 7], | ||
[3, 3, 11], | ||
[2, 2, 5, 5], | ||
[2, 2, 2, 47] | ||
] | ||
testThese.forEach(function (val, ind) { | ||
@@ -24,0 +24,0 @@ t.similar(aMath.factors(val), checkAgainst[ind], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13621
153