diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 0000000..8845b56 --- /dev/null +++ b/DOCUMENTATION.md @@ -0,0 +1,308 @@ +# Variadic.js + + + +### Table of Contents + +- [variadic](#variadic) + - [average](#average) + - [factorial](#factorial) + - [isAscending](#isascending) + - [isDecimal](#isdecimal) + - [isDescending](#isdescending) + - [isEmpty](#isempty) + - [isEqual](#isequal) + - [isEven](#iseven) + - [isNegativeInteger](#isnegativeinteger) + - [isNegativeNumber](#isnegativenumber) + - [isOdd](#isodd) + - [isPositiveInteger](#ispositiveinteger) + - [isPositiveNumber](#ispositivenumber) + - [isPrime](#isprime) + - [maximum](#maximum) + - [median](#median) + - [minimum](#minimum) + - [mode](#mode) + - [populationStandardDeviation](#populationstandarddeviation) + - [populationVariance](#populationvariance) + - [sampleStandardDeviation](#samplestandarddeviation) + - [sampleVariance](#samplevariance) + - [sum](#sum) + +## variadic + +### average + +This function caculates the average of the numerical parameters + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jmbothe + +### factorial + +This function caculates the factorial of each numerical parameter + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: devNoiseConsulting + +### isAscending + +This function evaluates whether the parameters are in ascending order + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: scottwestover + +### isDecimal + +This function evaluates whether all the parameters are decimal values + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: D1esel-Dev + +### isDescending + +This function evaluates whether the parameters are in ascending order + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jhowardjr + +### isEmpty + +This function evaluates if all the parameters are empty + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jhowardjr + +### isEqual + +This function evaluates whether all parameters are equal + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jhowardjr + +### isEven + +This function evaluates whether all parameters are even + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: scottwestover + +### isNegativeInteger + +This function evaluates whether all integer parameters are negative + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: khusbuchandra + +### isNegativeNumber + +This function evaluates whether all numerical parameters are negative + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: khusbuchandra + +### isOdd + +This function evaluates whether all numerical parameters are odd + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: khusbuchandra + +### isPositiveInteger + +This function evaluates whether all integer parameters are positive + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: scottwestover + +### isPositiveNumber + +This function evaluates whether all numerical parameters are positive + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: khusbuchandra + +### isPrime + +This function evaluates whether all numerical parameters are prime + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jmbothe + +### maximum + +This function finds the maximum parameter value + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jensenmeh + +### median + +This function finds the median parameter value + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jmbothe + +### minimum + +This function finds the minimum parameter value + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jensenmeh + +### mode + +This function finds the mode of the parameter values + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jmbothe + +### populationStandardDeviation + +This function calculates the population standard deviation + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: devNoiseConsulting + +### populationVariance + +This function calculates the variance + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: devNoiseConsulting + +### sampleStandardDeviation + +This function calculates the sample standard deviation + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: devNoiseConsulting + +### sampleVariance + +This function calculates the sample variance + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: devNoiseConsulting + +### sum + +This function calculates the sum of the parameters + +**Parameters** + +- `params` **...any** One or more parameters. + +**Meta** + +- **author**: jmbothe diff --git a/README.md b/README.md index 0a8bfce..f9270e5 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,10 @@ variadic.isEmpty([0, 2, 3], {}, 0); // false variadic.isEven(2, 4, 6); // error ``` +## Documenation + +See [DOCUMENTATION.md](DOCUMENTATION.md) + ## Running the tests ``` diff --git a/index.js b/index.js index 6d40d32..b99dc5c 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,8 @@ 'use strict'; -// REGISTER ALL MODULES +/** + * @module variadic + */ module.exports = Object.assign( {}, require('./lib/isEmpty.js'), diff --git a/lib/average.js b/lib/average.js index 72807f1..e71b3a7 100644 --- a/lib/average.js +++ b/lib/average.js @@ -13,6 +13,12 @@ const handleErrors = (params) => { } }; +/** + * This function caculates the average of the numerical parameters + * @memberof variadic + * @author jmbothe + * @param {...*} params - One or more parameters. + */ exports.average = (...params) => { handleErrors(params); diff --git a/lib/factorial.js b/lib/factorial.js index f0b5229..09ad841 100644 --- a/lib/factorial.js +++ b/lib/factorial.js @@ -32,6 +32,12 @@ const caclulateFactorial = (num) => { return factorialCache[num]; }; +/** + * This function caculates the factorial of each numerical parameter + * @memberof variadic + * @author devNoiseConsulting + * @param {...*} params - One or more parameters. + */ exports.factorial = (...params) => { handleErrors(params); diff --git a/lib/isAscending.js b/lib/isAscending.js index 4008bd8..8bfa34d 100644 --- a/lib/isAscending.js +++ b/lib/isAscending.js @@ -1,5 +1,11 @@ 'use strict'; +/** + * This function evaluates whether the parameters are in ascending order + * @memberof variadic + * @author scottwestover + * @param {...*} params - One or more parameters. + */ exports.isAscending = (...params) => { if (params.length < 2) throw new Error('Must provide two or more paramters'); let value = params.shift(); diff --git a/lib/isDecimal.js b/lib/isDecimal.js index 87e1661..7e7fb44 100644 --- a/lib/isDecimal.js +++ b/lib/isDecimal.js @@ -1,4 +1,10 @@ +/** + * This function evaluates whether all the parameters are decimal values + * @memberof variadic + * @author D1esel-Dev + * @param {...*} params - One or more parameters. + */ exports.isDecimal = (...params) => { for (const param of params) { // Only accept floating point numbers, infinite numbers can be allowed ie. repeating decimal diff --git a/lib/isDescending.js b/lib/isDescending.js index 5deb69b..aee9a6b 100644 --- a/lib/isDescending.js +++ b/lib/isDescending.js @@ -1,5 +1,11 @@ 'use strict'; +/** + * This function evaluates whether the parameters are in ascending order + * @memberof variadic + * @author jhowardjr + * @param {...*} params - One or more parameters. + */ exports.isDescending = (...params) => { if (params.length < 2) throw new Error('Must provide two or more paramters'); diff --git a/lib/isEmpty.js b/lib/isEmpty.js index b3dbce2..3c05f3a 100644 --- a/lib/isEmpty.js +++ b/lib/isEmpty.js @@ -1,5 +1,11 @@ 'use strict'; +/** + * This function evaluates if all the parameters are empty + * @memberof variadic + * @author jhowardjr + * @param {...*} params - One or more parameters. + */ exports.isEmpty = (...params) => { const invalid = params.some((param) => { switch (typeof param) { diff --git a/lib/isEqual.js b/lib/isEqual.js index a570a00..8aceb99 100644 --- a/lib/isEqual.js +++ b/lib/isEqual.js @@ -1,4 +1,10 @@ +/** + * This function evaluates whether all parameters are equal + * @memberof variadic + * @author jhowardjr + * @param {...*} params - One or more parameters. + */ exports.isEqual = (...params) => { if (params.length === 0) throw new Error('Must provide one or more paramters'); const firstParam = params.shift(); diff --git a/lib/isEven.js b/lib/isEven.js index 78c83bf..2644642 100644 --- a/lib/isEven.js +++ b/lib/isEven.js @@ -1,4 +1,10 @@ +/** + * This function evaluates whether all parameters are even + * @memberof variadic + * @author scottwestover + * @param {...*} params - One or more parameters. + */ exports.isEven = (...params) => { for (const param of params) { // Only accept finite numbers diff --git a/lib/isNegativeInteger.js b/lib/isNegativeInteger.js index b52966c..4d2251e 100644 --- a/lib/isNegativeInteger.js +++ b/lib/isNegativeInteger.js @@ -1,3 +1,9 @@ +/** + * This function evaluates whether all integer parameters are negative + * @memberof variadic + * @author khusbuchandra + * @param {...*} params - One or more parameters. + */ exports.isNegativeInteger = (...params) => { for (const param of params) { // Checks the type to be Number diff --git a/lib/isNegativeNumber.js b/lib/isNegativeNumber.js index 615eb73..7e75c61 100644 --- a/lib/isNegativeNumber.js +++ b/lib/isNegativeNumber.js @@ -1,3 +1,9 @@ +/** + * This function evaluates whether all numerical parameters are negative + * @memberof variadic + * @author khusbuchandra + * @param {...*} params - One or more parameters. + */ exports.isNegativeNumber = (...params) => { for (const param of params) { // Only accept finite numbers diff --git a/lib/isOdd.js b/lib/isOdd.js index a8f57e1..8fea55a 100644 --- a/lib/isOdd.js +++ b/lib/isOdd.js @@ -1,3 +1,9 @@ +/** + * This function evaluates whether all numerical parameters are odd + * @memberof variadic + * @author khusbuchandra + * @param {...*} params - One or more parameters. + */ exports.isOdd = (...params) => { for (const param of params) { // Only accept finite numbers diff --git a/lib/isPositiveInteger.js b/lib/isPositiveInteger.js index 1874efd..2887856 100644 --- a/lib/isPositiveInteger.js +++ b/lib/isPositiveInteger.js @@ -1,4 +1,10 @@ +/** + * This function evaluates whether all integer parameters are positive + * @memberof variadic + * @author scottwestover + * @param {...*} params - One or more parameters. + */ exports.isPositiveInteger = (...params) => { for (const param of params) { // Checks the type to be Number diff --git a/lib/isPositiveNumber.js b/lib/isPositiveNumber.js index 8e82c92..5c0471b 100644 --- a/lib/isPositiveNumber.js +++ b/lib/isPositiveNumber.js @@ -1,3 +1,9 @@ +/** + * This function evaluates whether all numerical parameters are positive + * @memberof variadic + * @author khusbuchandra + * @param {...*} params - One or more parameters. + */ exports.isPositiveNumber = (...params) => { for (const param of params) { // Only accept finite numbers diff --git a/lib/isPrime.js b/lib/isPrime.js index 8b4731e..1734b57 100644 --- a/lib/isPrime.js +++ b/lib/isPrime.js @@ -36,6 +36,12 @@ const testPrime = (num) => { return false; }; +/** + * This function evaluates whether all numerical parameters are prime + * @memberof variadic + * @author jmbothe + * @param {...*} params - One or more parameters. + */ exports.isPrime = (...params) => { if (params.length === 0) throw new Error('Must provide one or more paramters'); if (params.some(param => Number.isNaN(Number(param)))) throw new Error('One of your parameters does not evaluate to a number'); diff --git a/lib/maximum.js b/lib/maximum.js index d56fb88..2176158 100644 --- a/lib/maximum.js +++ b/lib/maximum.js @@ -12,6 +12,12 @@ const handleErrors = (params) => { } }; +/** + * This function finds the maximum parameter value + * @memberof variadic + * @author jensenmeh + * @param {...*} params - One or more parameters. + */ exports.maximum = (...params) => { handleErrors(params); diff --git a/lib/median.js b/lib/median.js index 8a3d457..b1d7257 100644 --- a/lib/median.js +++ b/lib/median.js @@ -12,6 +12,12 @@ const handleErrors = (params) => { } }; +/** + * This function finds the median parameter value + * @memberof variadic + * @author jmbothe + * @param {...*} params - One or more parameters. + */ exports.median = (...params) => { handleErrors(params); diff --git a/lib/minimum.js b/lib/minimum.js index dac1aa0..acd1449 100644 --- a/lib/minimum.js +++ b/lib/minimum.js @@ -12,6 +12,12 @@ const handleErrors = (params) => { } }; +/** + * This function finds the minimum parameter value + * @memberof variadic + * @author jensenmeh + * @param {...*} params - One or more parameters. + */ exports.minimum = (...params) => { handleErrors(params); diff --git a/lib/mode.js b/lib/mode.js index 828b32f..a2d57a5 100644 --- a/lib/mode.js +++ b/lib/mode.js @@ -10,6 +10,12 @@ const handleErrors = (params) => { } }; +/** + * This function finds the mode of the parameter values + * @memberof variadic + * @author jmbothe + * @param {...*} params - One or more parameters. + */ exports.mode = (...params) => { handleErrors(params); diff --git a/lib/populationStandardDeviation.js b/lib/populationStandardDeviation.js index 9475f0b..e6ae267 100644 --- a/lib/populationStandardDeviation.js +++ b/lib/populationStandardDeviation.js @@ -13,6 +13,12 @@ const handleErrors = (params) => { } }; +/** + * This function calculates the population standard deviation + * @memberof variadic + * @author devNoiseConsulting + * @param {...*} params - One or more parameters. + */ exports.populationStandardDeviation = (...params) => { handleErrors(params); diff --git a/lib/populationVariance.js b/lib/populationVariance.js index 6d6b47b..603de21 100644 --- a/lib/populationVariance.js +++ b/lib/populationVariance.js @@ -13,6 +13,12 @@ const handleErrors = (params) => { } }; +/** + * This function calculates the variance + * @memberof variadic + * @author devNoiseConsulting + * @param {...*} params - One or more parameters. + */ exports.populationVariance = (...params) => { handleErrors(params); diff --git a/lib/sampleStandardDeviation.js b/lib/sampleStandardDeviation.js index db94682..668cc6b 100644 --- a/lib/sampleStandardDeviation.js +++ b/lib/sampleStandardDeviation.js @@ -13,6 +13,12 @@ const handleErrors = (params) => { } }; +/** + * This function calculates the sample standard deviation + * @memberof variadic + * @author devNoiseConsulting + * @param {...*} params - One or more parameters. + */ exports.sampleStandardDeviation = (...params) => { handleErrors(params); diff --git a/lib/sampleVariance.js b/lib/sampleVariance.js index a0ef24f..6371308 100644 --- a/lib/sampleVariance.js +++ b/lib/sampleVariance.js @@ -13,6 +13,12 @@ const handleErrors = (params) => { } }; +/** + * This function calculates the sample variance + * @memberof variadic + * @author devNoiseConsulting + * @param {...*} params - One or more parameters. + */ exports.sampleVariance = (...params) => { handleErrors(params); diff --git a/lib/sum.js b/lib/sum.js index 38c300b..b4dbef4 100644 --- a/lib/sum.js +++ b/lib/sum.js @@ -12,6 +12,12 @@ const handleErrors = (params) => { } }; +/** + * This function calculates the sum of the parameters + * @memberof variadic + * @author jmbothe + * @param {...*} params - One or more parameters. + */ exports.sum = (...params) => { handleErrors(params); diff --git a/package.json b/package.json index 1d69fba..a627c12 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "lint": "eslint index.js lib/**/*.js spec/**/*.js", "fix": "eslint index.js lib/**/*.js spec/**/*.js --fix", "coveralls": "nyc jasmine && nyc report --reporter=text-lcov | coveralls", - "build": "BABEL_ENV=production babel index.js -d dist && BABEL_ENV=production babel lib/ -d dist/lib" + "build": "BABEL_ENV=production babel index.js -d dist && BABEL_ENV=production babel lib/ -d dist/lib", + "docs": "documentation readme --readme-file DOCUMENTATION.md -s Variadic.js index.js lib/**" }, "repository": { "type": "git", @@ -38,4 +39,4 @@ "nyc": "^11.4.1" }, "dependencies": {} -} +} \ No newline at end of file