Skip to content

Commit db4d691

Browse files
authored
Merge pull request #70 from variadicjs/minor_changes
Minor changes
2 parents 5829a5f + 3b43668 commit db4d691

25 files changed

Lines changed: 11513 additions & 1416 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ dist
6767
.DS_Store
6868
untitled.sublime-project
6969
untitled.sublime-workspace
70+
71+
.vscode

DOCUMENTATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ This function converts all numbers to a positive number
4949

5050
### average
5151

52-
This function caculates the average of the numerical parameters
52+
This function calculates the average of the numerical parameters
5353

5454
**Parameters**
5555

@@ -61,7 +61,7 @@ This function caculates the average of the numerical parameters
6161

6262
### factorial
6363

64-
This function caculates the factorial of each numerical parameter
64+
This function calculates the factorial of each numerical parameter
6565

6666
**Parameters**
6767

lib/absoluteValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
const handleErrors = (params) => {
3-
if (params.length === 0) throw new Error('Must provide one or more paramters');
3+
if (params.length === 0) throw new Error('Must provide one or more parameters');
44
if (params.some(param => typeof param !== 'number')) {
55
throw new Error('One of your parameters does not evaluate to a number');
66
}

lib/average.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { sum } = require('./sum');
22
const { floatPrecise } = require('./floatPrecise');
33

44
const handleErrors = (params) => {
5-
if (params.length === 0) throw new Error('Must provide one or more paramters');
5+
if (params.length === 0) throw new Error('Must provide one or more parameters');
66
if (params.some(param => typeof param !== 'number')) {
77
throw new Error('One of your parameters does not evaluate to a number');
88
}
@@ -14,7 +14,7 @@ const handleErrors = (params) => {
1414
};
1515

1616
/**
17-
* This function caculates the average of the numerical parameters
17+
* This function calculates the average of the numerical parameters
1818
* @memberof variadic
1919
* @author jmbothe
2020
* @param {...*} params - One or more parameters.
@@ -26,7 +26,7 @@ exports.average = (...params) => {
2626

2727
// I couldn't actually find any examples of float imprecision
2828
// when dividing a float by a whole number
29-
// so this might not be neccessary. I just put it in for safety's sake - jmbothe
29+
// so this might not be necessary. I just put it in for safety's sake - jmbothe
3030
return floatPrecise(result);
3131
};
3232

lib/factorial.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { isPositiveInteger } = require('./isPositiveInteger');
44

55
const handleErrors = (params) => {
6-
if (params.length === 0) throw new Error('Must provide one or more paramters');
6+
if (params.length === 0) throw new Error('Must provide one or more parameters');
77
if (params.some(param => !Number.isInteger(param))) {
88
throw new Error('One of your parameters does not evaluate to a integer');
99
}
@@ -19,7 +19,7 @@ const handleErrors = (params) => {
1919

2020
const factorialCache = [1, 1];
2121

22-
const caclulateFactorial = (num) => {
22+
const calculateFactorial = (num) => {
2323
if (typeof factorialCache[num] !== 'undefined') {
2424
return factorialCache[num];
2525
}
@@ -33,13 +33,13 @@ const caclulateFactorial = (num) => {
3333
};
3434

3535
/**
36-
* This function caculates the factorial of each numerical parameter
36+
* This function calculates the factorial of each numerical parameter
3737
* @memberof variadic
3838
* @author devNoiseConsulting
3939
* @param {...*} params - One or more parameters.
4040
*/
4141
exports.factorial = (...params) => {
4242
handleErrors(params);
4343

44-
return params.map(caclulateFactorial);
44+
return params.map(calculateFactorial);
4545
};

lib/floatPrecise.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exports.floatPrecise = (num) => {
66

77
// Reverse loop through number looking for index of last precise digit.
88
// Imprecise floats typically contain a long string of 9s or 0s,
9-
// somtimes terminating in some other number,
9+
// sometimes terminating in some other number,
1010
// so begin loop at second to last index.
1111
let i = str.length - 2;
1212
const imprecise = str[i] === '9' ? '9' : '0';

lib/isAscending.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @param {...*} params - One or more parameters.
88
*/
99
exports.isAscending = (...params) => {
10-
if (params.length < 2) throw new Error('Must provide two or more paramters');
10+
if (params.length < 2) throw new Error('Must provide two or more parameters');
1111
let value = params.shift();
1212
for (const param of params) {
1313
if (Number.isNaN(parseFloat(param))) throw new Error('One of your parameters does not evaluate to a number');

lib/isComposit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ const { isPrime } = require('./isPrime');
44
// `isPrime` checks if the number is an integer greater than 1
55
// but since we simply want `isPrime` to check if this number
66
// is prime, we need to do the check again to avoid a false result.
7-
const testComposit = num => (num % 1 || num < 2 ? false : !isPrime(num));
7+
const testComposite = num => (num % 1 || num < 2 ? false : !isPrime(num));
88

99
/**
10-
* This function evaluates whether all numerical parameters are composit
10+
* This function evaluates whether all numerical parameters are composite
1111
* @memberof variadic
1212
* @author tdnelson2
1313
* @param {...*} params - One or more parameters.
1414
*/
1515
exports.isComposit = (...params) => {
16-
if (params.length === 0) throw new Error('Must provide one or more paramters');
17-
return params.every(testComposit);
16+
if (params.length === 0) throw new Error('Must provide one or more parameters');
17+
return params.every(testComposite);
1818
};

lib/isDescending.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @param {...*} params - One or more parameters.
88
*/
99
exports.isDescending = (...params) => {
10-
if (params.length < 2) throw new Error('Must provide two or more paramters');
10+
if (params.length < 2) throw new Error('Must provide two or more parameters');
1111

1212
let value = params.shift();
1313
for (const param of params) {

lib/isEqual.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @param {...*} params - One or more parameters.
77
*/
88
exports.isEqual = (...params) => {
9-
if (params.length === 0) throw new Error('Must provide one or more paramters');
9+
if (params.length === 0) throw new Error('Must provide one or more parameters');
1010
const firstParam = params.shift();
1111
for (const param of params) {
1212
switch (typeof param) {

0 commit comments

Comments
 (0)