From 496bc38d6e696416fcfb1fb543062b5f4fedd197 Mon Sep 17 00:00:00 2001 From: King Date: Wed, 24 Jan 2018 06:24:33 -0500 Subject: [PATCH 1/4] fix crlf / cr / lf system file ending --- scripts/tdd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tdd.js b/scripts/tdd.js index bba8e57fd..c51226daf 100644 --- a/scripts/tdd.js +++ b/scripts/tdd.js @@ -61,7 +61,7 @@ snippetFiles .filter((_, i) => blockMarkers[2] < i && i < blockMarkers[3]); // Export template for snippetName.js - const exportFile = `${fileFunction.join('\n')}\n module.exports = ${fileName}`; + const exportFile = `${fileFunction.join('\n')}\nmodule.exports = ${fileName}`.trim(); // Export template for snippetName.test.js which generates a example test & other information const exportTest = [ From e1a17c769be6d8e2d33817b32a174889b9ed9140 Mon Sep 17 00:00:00 2001 From: King Date: Wed, 24 Jan 2018 06:29:38 -0500 Subject: [PATCH 2/4] ran npm run tester -> logged invertKeyValues test are invalid --- test/JSONToDate/JSONToDate.js | 2 +- test/JSONToFile/JSONToFile.js | 2 +- test/RGBToHex/RGBToHex.js | 2 +- test/URLJoin/URLJoin.js | 2 +- .../UUIDGeneratorBrowser.js | 2 +- test/UUIDGeneratorNode/UUIDGeneratorNode.js | 2 +- test/anagrams/anagrams.js | 2 +- test/arrayToHtmlList/arrayToHtmlList.js | 2 +- test/atob/atob.js | 2 +- test/average/average.js | 2 +- test/averageBy/averageBy.js | 2 +- test/binarySearch/binarySearch.js | 2 +- test/bottomVisible/bottomVisible.js | 2 +- test/btoa/btoa.js | 2 +- test/byteSize/byteSize.js | 2 +- test/call/call.js | 2 +- test/capitalize/capitalize.js | 2 +- .../capitalizeEveryWord.js | 2 +- test/castArray/castArray.js | 2 +- test/chainAsync/chainAsync.js | 2 +- test/chunk/chunk.js | 2 +- test/clampNumber/clampNumber.js | 2 +- test/cleanObj/cleanObj.js | 2 +- test/cloneRegExp/cloneRegExp.js | 2 +- test/coalesce/coalesce.js | 2 +- test/coalesceFactory/coalesceFactory.js | 2 +- test/collatz/collatz.js | 2 +- test/collectInto/collectInto.js | 2 +- test/colorize/colorize.js | 2 +- test/compact/compact.js | 2 +- test/compose/compose.js | 2 +- test/composeRight/composeRight.js | 2 + test/composeRight/composeRight.test.js | 13 + test/copyToClipboard/copyToClipboard.js | 2 +- test/countBy/countBy.js | 2 +- test/countOccurrences/countOccurrences.js | 2 +- test/countVowels/countVowels.js | 2 +- test/createElement/createElement.js | 2 +- test/createEventHub/createEventHub.js | 2 +- test/currentURL/currentURL.js | 2 +- test/curry/curry.js | 2 +- test/decapitalize/decapitalize.js | 2 +- test/deepClone/deepClone.js | 2 +- test/deepFlatten/deepFlatten.js | 2 +- test/defaults/defaults.js | 2 +- test/defer/defer.js | 2 +- test/detectDeviceType/detectDeviceType.js | 2 +- test/difference/difference.js | 2 +- test/differenceBy/differenceBy.js | 5 + test/differenceBy/differenceBy.test.js | 13 + test/differenceWith/differenceWith.js | 2 +- test/digitize/digitize.js | 2 +- test/distance/distance.js | 2 +- test/dropElements/dropElements.js | 2 +- test/dropRight/dropRight.js | 2 +- .../elementIsVisibleInViewport.js | 2 +- test/elo/elo.js | 2 +- test/equals/equals.js | 2 +- test/escapeHTML/escapeHTML.js | 2 +- test/escapeRegExp/escapeRegExp.js | 2 +- test/everyNth/everyNth.js | 2 +- test/extendHex/extendHex.js | 2 +- test/factorial/factorial.js | 2 +- test/factors/factors.js | 2 +- test/fibonacci/fibonacci.js | 2 +- .../fibonacciCountUntilNum.js | 2 +- test/fibonacciUntilNum/fibonacciUntilNum.js | 2 +- test/filterNonUnique/filterNonUnique.js | 2 +- test/findKey/findKey.js | 2 +- test/findLast/findLast.js | 4 +- test/findLastIndex/findLastIndex.js | 6 + test/findLastIndex/findLastIndex.test.js | 13 + test/findLastKey/findLastKey.js | 2 +- test/flatten/flatten.js | 2 +- test/flip/flip.js | 2 +- test/forEachRight/forEachRight.js | 2 +- test/forOwn/forOwn.js | 2 +- test/forOwnRight/forOwnRight.js | 2 +- test/formatDuration/formatDuration.js | 2 +- test/fromCamelCase/fromCamelCase.js | 2 +- test/functionName/functionName.js | 2 +- test/functions/functions.js | 2 +- test/gcd/gcd.js | 2 +- .../geometricProgression.js | 2 +- test/get/get.js | 2 +- .../getDaysDiffBetweenDates.js | 2 +- test/getScrollPosition/getScrollPosition.js | 2 +- test/getStyle/getStyle.js | 2 +- test/getType/getType.js | 2 +- test/getURLParameters/getURLParameters.js | 2 +- test/groupBy/groupBy.js | 2 +- test/hammingDistance/hammingDistance.js | 2 +- test/hasClass/hasClass.js | 2 +- test/hasFlags/hasFlags.js | 2 +- test/hashBrowser/hashBrowser.js | 2 +- test/hashNode/hashNode.js | 2 +- test/head/head.js | 2 +- test/hexToRGB/hexToRGB.js | 2 +- test/hide/hide.js | 2 +- test/howManyTimes/howManyTimes.js | 2 +- test/httpDelete/httpDelete.js | 2 +- test/httpGet/httpGet.js | 2 +- test/httpPost/httpPost.js | 2 +- test/httpPut/httpPut.js | 2 +- test/httpsRedirect/httpsRedirect.js | 2 +- test/inRange/inRange.js | 2 +- test/indexOfAll/indexOfAll.js | 2 +- test/initial/initial.js | 2 +- test/initialize2DArray/initialize2DArray.js | 2 +- .../initializeArrayWithRange.js | 2 +- .../initializeArrayWithRangeRight.js | 2 +- .../initializeArrayWithValues.js | 2 +- test/intersection/intersection.js | 2 +- test/intersectionBy/intersectionBy.js | 5 + test/intersectionBy/intersectionBy.test.js | 13 + test/intersectionWith/intersectionWith.js | 2 + .../intersectionWith/intersectionWith.test.js | 13 + test/invertKeyValues/invertKeyValues.js | 2 +- test/is/is.js | 2 +- test/isAbsoluteURL/isAbsoluteURL.js | 2 +- test/isArmstrongNumber/isArmstrongNumber.js | 2 +- test/isArrayLike/isArrayLike.js | 2 +- test/isBoolean/isBoolean.js | 2 +- test/isDivisible/isDivisible.js | 2 +- test/isEmpty/isEmpty.js | 2 +- test/isEven/isEven.js | 2 +- test/isFunction/isFunction.js | 2 +- test/isLowerCase/isLowerCase.js | 2 +- test/isNil/isNil.js | 2 +- test/isNull/isNull.js | 2 +- test/isNumber/isNumber.js | 2 +- test/isObject/isObject.js | 2 +- test/isObjectLike/isObjectLike.js | 2 +- test/isPlainObject/isPlainObject.js | 2 +- test/isPrime/isPrime.js | 2 +- test/isPrimitive/isPrimitive.js | 2 +- test/isPromiseLike/isPromiseLike.js | 2 +- test/isSorted/isSorted.js | 2 +- test/isString/isString.js | 2 +- test/isSymbol/isSymbol.js | 2 +- test/isTravisCI/isTravisCI.js | 2 +- test/isUndefined/isUndefined.js | 2 +- test/isUpperCase/isUpperCase.js | 2 +- test/isValidJSON/isValidJSON.js | 2 +- test/join/join.js | 2 +- test/last/last.js | 2 +- test/lcm/lcm.js | 2 +- test/longestItem/longestItem.js | 2 +- test/lowercaseKeys/lowercaseKeys.js | 2 +- test/luhnCheck/luhnCheck.js | 2 +- test/mapKeys/mapKeys.js | 2 +- test/mapObject/mapObject.js | 2 +- test/mapValues/mapValues.js | 2 +- test/mask/mask.js | 2 +- test/matches/matches.js | 2 +- test/matchesWith/matchesWith.js | 2 +- test/maxBy/maxBy.js | 2 +- test/maxN/maxN.js | 2 +- test/median/median.js | 2 +- test/memoize/memoize.js | 2 +- test/merge/merge.js | 2 +- test/minBy/minBy.js | 2 +- test/minN/minN.js | 2 +- test/negate/negate.js | 2 +- test/nthArg/nthArg.js | 2 +- test/nthElement/nthElement.js | 2 +- test/objectFromPairs/objectFromPairs.js | 2 +- test/objectToPairs/objectToPairs.js | 2 +- test/observeMutations/observeMutations.js | 2 +- test/off/off.js | 2 +- test/omit/omit.js | 2 +- test/omitBy/omitBy.js | 2 +- test/on/on.js | 2 +- test/onUserInputChange/onUserInputChange.js | 2 +- test/once/once.js | 2 +- test/orderBy/orderBy.js | 2 +- test/over/over.js | 2 +- test/palindrome/palindrome.js | 2 +- test/parseCookie/parseCookie.js | 2 +- test/partition/partition.js | 2 +- test/percentile/percentile.js | 2 +- test/pick/pick.js | 2 +- test/pickBy/pickBy.js | 2 +- test/pipeFunctions/pipeFunctions.js | 2 +- test/pluralize/pluralize.js | 2 +- test/powerset/powerset.js | 2 +- test/prettyBytes/prettyBytes.js | 2 +- test/primes/primes.js | 2 +- test/promisify/promisify.js | 2 +- test/pull/pull.js | 2 +- test/pullAtIndex/pullAtIndex.js | 2 +- test/pullAtValue/pullAtValue.js | 2 +- test/quickSort/quickSort.js | 2 +- test/randomHexColorCode/randomHexColorCode.js | 2 +- .../randomIntArrayInRange.js | 2 +- .../randomIntegerInRange.js | 2 +- .../randomNumberInRange.js | 2 +- test/readFileLines/readFileLines.js | 2 +- test/redirect/redirect.js | 2 +- test/reducedFilter/reducedFilter.js | 2 +- test/remove/remove.js | 2 +- test/removeVowels/removeVowels.js | 2 +- test/reverseString/reverseString.js | 2 +- test/round/round.js | 2 +- test/runAsync/runAsync.js | 2 +- .../runPromisesInSeries.js | 2 +- test/sample/sample.js | 2 +- test/sampleSize/sampleSize.js | 2 +- test/scrollToTop/scrollToTop.js | 2 +- test/sdbm/sdbm.js | 2 +- test/serializeCookie/serializeCookie.js | 2 +- test/setStyle/setStyle.js | 2 +- test/shallowClone/shallowClone.js | 2 +- test/show/show.js | 2 +- test/shuffle/shuffle.js | 2 +- test/similarity/similarity.js | 2 +- test/size/size.js | 2 +- test/sleep/sleep.js | 2 +- test/solveRPN/solveRPN.js | 2 +- .../sortCharactersInString.js | 2 +- test/sortedIndex/sortedIndex.js | 2 +- test/sortedLastIndex/sortedLastIndex.js | 9 + test/sortedLastIndex/sortedLastIndex.test.js | 13 + test/speechSynthesis/speechSynthesis.js | 2 +- test/splitLines/splitLines.js | 2 +- test/spreadOver/spreadOver.js | 2 +- test/standardDeviation/standardDeviation.js | 2 +- test/sum/sum.js | 2 +- test/sumBy/sumBy.js | 2 +- test/sumPower/sumPower.js | 2 +- .../symmetricDifference.js | 2 +- .../symmetricDifferenceBy.js | 6 + .../symmetricDifferenceBy.test.js | 13 + .../symmetricDifferenceWith.js | 5 + .../symmetricDifferenceWith.test.js | 13 + test/tail/tail.js | 2 +- test/take/take.js | 2 +- test/takeRight/takeRight.js | 2 +- test/testlog | 1299 +++++++++-------- test/timeTaken/timeTaken.js | 2 +- test/toCamelCase/toCamelCase.js | 2 +- test/toDecimalMark/toDecimalMark.js | 2 +- test/toKebabCase/toKebabCase.js | 2 +- test/toOrdinalSuffix/toOrdinalSuffix.js | 2 +- test/toSafeInteger/toSafeInteger.js | 2 +- test/toSnakeCase/toSnakeCase.js | 2 +- test/toggleClass/toggleClass.js | 2 +- test/tomorrow/tomorrow.js | 2 +- test/transform/transform.js | 2 +- test/truncateString/truncateString.js | 2 +- .../truthCheckCollection.js | 2 +- test/unescapeHTML/unescapeHTML.js | 2 +- test/union/union.js | 2 +- test/unionBy/unionBy.js | 5 + test/unionBy/unionBy.test.js | 13 + test/unionWith/unionWith.js | 3 + test/unionWith/unionWith.test.js | 13 + test/uniqueElements/uniqueElements.js | 2 +- test/untildify/untildify.js | 2 +- test/unzip/unzip.js | 8 + test/unzip/unzip.test.js | 13 + test/unzipWith/unzipWith.js | 10 + test/unzipWith/unzipWith.test.js | 13 + test/validateNumber/validateNumber.js | 2 +- test/without/without.js | 2 +- test/words/words.js | 2 +- test/yesNo/yesNo.js | 2 +- test/zip/zip.js | 2 +- test/zipObject/zipObject.js | 2 +- test/zipWith/zipWith.js | 2 +- 270 files changed, 1141 insertions(+), 872 deletions(-) create mode 100644 test/composeRight/composeRight.js create mode 100644 test/composeRight/composeRight.test.js create mode 100644 test/differenceBy/differenceBy.js create mode 100644 test/differenceBy/differenceBy.test.js create mode 100644 test/findLastIndex/findLastIndex.js create mode 100644 test/findLastIndex/findLastIndex.test.js create mode 100644 test/intersectionBy/intersectionBy.js create mode 100644 test/intersectionBy/intersectionBy.test.js create mode 100644 test/intersectionWith/intersectionWith.js create mode 100644 test/intersectionWith/intersectionWith.test.js create mode 100644 test/sortedLastIndex/sortedLastIndex.js create mode 100644 test/sortedLastIndex/sortedLastIndex.test.js create mode 100644 test/symmetricDifferenceBy/symmetricDifferenceBy.js create mode 100644 test/symmetricDifferenceBy/symmetricDifferenceBy.test.js create mode 100644 test/symmetricDifferenceWith/symmetricDifferenceWith.js create mode 100644 test/symmetricDifferenceWith/symmetricDifferenceWith.test.js create mode 100644 test/unionBy/unionBy.js create mode 100644 test/unionBy/unionBy.test.js create mode 100644 test/unionWith/unionWith.js create mode 100644 test/unionWith/unionWith.test.js create mode 100644 test/unzip/unzip.js create mode 100644 test/unzip/unzip.test.js create mode 100644 test/unzipWith/unzipWith.js create mode 100644 test/unzipWith/unzipWith.test.js diff --git a/test/JSONToDate/JSONToDate.js b/test/JSONToDate/JSONToDate.js index b22d17b2c..658c2f6fc 100644 --- a/test/JSONToDate/JSONToDate.js +++ b/test/JSONToDate/JSONToDate.js @@ -2,4 +2,4 @@ const JSONToDate = arr => { const dt = new Date(parseInt(arr.toString().substr(6))); return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`; }; - module.exports = JSONToDate \ No newline at end of file +module.exports = JSONToDate \ No newline at end of file diff --git a/test/JSONToFile/JSONToFile.js b/test/JSONToFile/JSONToFile.js index 695fd5ecd..450fe0d35 100644 --- a/test/JSONToFile/JSONToFile.js +++ b/test/JSONToFile/JSONToFile.js @@ -1,4 +1,4 @@ const fs = require('fs'); const JSONToFile = (obj, filename) => fs.writeFile(`${filename}.json`, JSON.stringify(obj, null, 2)); - module.exports = JSONToFile \ No newline at end of file +module.exports = JSONToFile \ No newline at end of file diff --git a/test/RGBToHex/RGBToHex.js b/test/RGBToHex/RGBToHex.js index 1caaf7cd4..4e84c450b 100644 --- a/test/RGBToHex/RGBToHex.js +++ b/test/RGBToHex/RGBToHex.js @@ -1,2 +1,2 @@ const RGBToHex = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0'); - module.exports = RGBToHex \ No newline at end of file +module.exports = RGBToHex \ No newline at end of file diff --git a/test/URLJoin/URLJoin.js b/test/URLJoin/URLJoin.js index 0ba1bad9a..ccff1cb75 100644 --- a/test/URLJoin/URLJoin.js +++ b/test/URLJoin/URLJoin.js @@ -7,4 +7,4 @@ args .replace(/\/(\?|&|#[^!])/g, '$1') .replace(/\?/g, '&') .replace('&', '?'); - module.exports = URLJoin \ No newline at end of file +module.exports = URLJoin \ No newline at end of file diff --git a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js index 78f421fef..bdd30d1f1 100644 --- a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js +++ b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js @@ -2,4 +2,4 @@ const UUIDGeneratorBrowser = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16) ); - module.exports = UUIDGeneratorBrowser \ No newline at end of file +module.exports = UUIDGeneratorBrowser \ No newline at end of file diff --git a/test/UUIDGeneratorNode/UUIDGeneratorNode.js b/test/UUIDGeneratorNode/UUIDGeneratorNode.js index 956d887c3..46afbd090 100644 --- a/test/UUIDGeneratorNode/UUIDGeneratorNode.js +++ b/test/UUIDGeneratorNode/UUIDGeneratorNode.js @@ -3,4 +3,4 @@ const UUIDGeneratorNode = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ (crypto.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16) ); - module.exports = UUIDGeneratorNode \ No newline at end of file +module.exports = UUIDGeneratorNode \ No newline at end of file diff --git a/test/anagrams/anagrams.js b/test/anagrams/anagrams.js index 2b31ca520..32a1b62ae 100644 --- a/test/anagrams/anagrams.js +++ b/test/anagrams/anagrams.js @@ -8,4 +8,4 @@ acc.concat(anagrams(str.slice(0, i) + str.slice(i + 1)).map(val => letter + val) [] ); }; - module.exports = anagrams \ No newline at end of file +module.exports = anagrams \ No newline at end of file diff --git a/test/arrayToHtmlList/arrayToHtmlList.js b/test/arrayToHtmlList/arrayToHtmlList.js index e85f273e7..ae6fed9c2 100644 --- a/test/arrayToHtmlList/arrayToHtmlList.js +++ b/test/arrayToHtmlList/arrayToHtmlList.js @@ -1,3 +1,3 @@ const arrayToHtmlList = (arr, listID) => arr.map(item => (document.querySelector('#' + listID).innerHTML += `
  • ${item}
  • `)); - module.exports = arrayToHtmlList \ No newline at end of file +module.exports = arrayToHtmlList \ No newline at end of file diff --git a/test/atob/atob.js b/test/atob/atob.js index 74b526ccd..fc39b89f8 100644 --- a/test/atob/atob.js +++ b/test/atob/atob.js @@ -1,2 +1,2 @@ const atob = str => new Buffer(str, 'base64').toString('binary'); - module.exports = atob \ No newline at end of file +module.exports = atob \ No newline at end of file diff --git a/test/average/average.js b/test/average/average.js index 4f414ff98..57c11529f 100644 --- a/test/average/average.js +++ b/test/average/average.js @@ -1,2 +1,2 @@ const average = (...nums) => [...nums].reduce((acc, val) => acc + val, 0) / nums.length; - module.exports = average \ No newline at end of file +module.exports = average \ No newline at end of file diff --git a/test/averageBy/averageBy.js b/test/averageBy/averageBy.js index 5e8bb3a27..fc38bc749 100644 --- a/test/averageBy/averageBy.js +++ b/test/averageBy/averageBy.js @@ -1,4 +1,4 @@ const averageBy = (arr, fn) => arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0) / arr.length; - module.exports = averageBy \ No newline at end of file +module.exports = averageBy \ No newline at end of file diff --git a/test/binarySearch/binarySearch.js b/test/binarySearch/binarySearch.js index b34d667bf..484a20638 100644 --- a/test/binarySearch/binarySearch.js +++ b/test/binarySearch/binarySearch.js @@ -5,4 +5,4 @@ if (arr[mid] > val) return binarySearch(arr, val, start, mid - 1); if (arr[mid] < val) return binarySearch(arr, val, mid + 1, end); return mid; } - module.exports = binarySearch \ No newline at end of file +module.exports = binarySearch \ No newline at end of file diff --git a/test/bottomVisible/bottomVisible.js b/test/bottomVisible/bottomVisible.js index abf32b046..68c5f357c 100644 --- a/test/bottomVisible/bottomVisible.js +++ b/test/bottomVisible/bottomVisible.js @@ -1,4 +1,4 @@ const bottomVisible = () => document.documentElement.clientHeight + window.scrollY >= (document.documentElement.scrollHeight || document.documentElement.clientHeight); - module.exports = bottomVisible \ No newline at end of file +module.exports = bottomVisible \ No newline at end of file diff --git a/test/btoa/btoa.js b/test/btoa/btoa.js index 4393d4d67..af14ade08 100644 --- a/test/btoa/btoa.js +++ b/test/btoa/btoa.js @@ -1,2 +1,2 @@ const btoa = str => new Buffer(str, 'binary').toString('base64'); - module.exports = btoa \ No newline at end of file +module.exports = btoa \ No newline at end of file diff --git a/test/byteSize/byteSize.js b/test/byteSize/byteSize.js index 74a857863..e9ef3735a 100644 --- a/test/byteSize/byteSize.js +++ b/test/byteSize/byteSize.js @@ -1,2 +1,2 @@ const byteSize = str => new Blob([str]).size; - module.exports = byteSize \ No newline at end of file +module.exports = byteSize \ No newline at end of file diff --git a/test/call/call.js b/test/call/call.js index 660de98a8..bcb7f341b 100644 --- a/test/call/call.js +++ b/test/call/call.js @@ -1,2 +1,2 @@ const call = (key, ...args) => context => context[key](...args); - module.exports = call \ No newline at end of file +module.exports = call \ No newline at end of file diff --git a/test/capitalize/capitalize.js b/test/capitalize/capitalize.js index edd95c811..bc1710773 100644 --- a/test/capitalize/capitalize.js +++ b/test/capitalize/capitalize.js @@ -1,3 +1,3 @@ const capitalize = ([first, ...rest], lowerRest = false) => first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join('')); - module.exports = capitalize \ No newline at end of file +module.exports = capitalize \ No newline at end of file diff --git a/test/capitalizeEveryWord/capitalizeEveryWord.js b/test/capitalizeEveryWord/capitalizeEveryWord.js index 2bec22dcf..28a8f6d0b 100644 --- a/test/capitalizeEveryWord/capitalizeEveryWord.js +++ b/test/capitalizeEveryWord/capitalizeEveryWord.js @@ -1,2 +1,2 @@ const capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCase()); - module.exports = capitalizeEveryWord \ No newline at end of file +module.exports = capitalizeEveryWord \ No newline at end of file diff --git a/test/castArray/castArray.js b/test/castArray/castArray.js index 83816cde7..963203b1f 100644 --- a/test/castArray/castArray.js +++ b/test/castArray/castArray.js @@ -1,2 +1,2 @@ const castArray = val => (Array.isArray(val) ? val : [val]); - module.exports = castArray \ No newline at end of file +module.exports = castArray \ No newline at end of file diff --git a/test/chainAsync/chainAsync.js b/test/chainAsync/chainAsync.js index 4454d477d..8322779ad 100644 --- a/test/chainAsync/chainAsync.js +++ b/test/chainAsync/chainAsync.js @@ -3,4 +3,4 @@ let curr = 0; const next = () => fns[curr++](next); next(); }; - module.exports = chainAsync \ No newline at end of file +module.exports = chainAsync \ No newline at end of file diff --git a/test/chunk/chunk.js b/test/chunk/chunk.js index 6b27e7f1c..39ffc5d71 100644 --- a/test/chunk/chunk.js +++ b/test/chunk/chunk.js @@ -2,4 +2,4 @@ const chunk = (arr, size) => Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => arr.slice(i * size, i * size + size) ); - module.exports = chunk \ No newline at end of file +module.exports = chunk \ No newline at end of file diff --git a/test/clampNumber/clampNumber.js b/test/clampNumber/clampNumber.js index 5033a0372..ecd804f73 100644 --- a/test/clampNumber/clampNumber.js +++ b/test/clampNumber/clampNumber.js @@ -1,2 +1,2 @@ const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); - module.exports = clampNumber \ No newline at end of file +module.exports = clampNumber \ No newline at end of file diff --git a/test/cleanObj/cleanObj.js b/test/cleanObj/cleanObj.js index 16f414bec..d3dfc14d3 100644 --- a/test/cleanObj/cleanObj.js +++ b/test/cleanObj/cleanObj.js @@ -8,4 +8,4 @@ delete obj[key]; }); return obj; }; - module.exports = cleanObj \ No newline at end of file +module.exports = cleanObj \ No newline at end of file diff --git a/test/cloneRegExp/cloneRegExp.js b/test/cloneRegExp/cloneRegExp.js index 41d81e621..d0fdb3953 100644 --- a/test/cloneRegExp/cloneRegExp.js +++ b/test/cloneRegExp/cloneRegExp.js @@ -1,2 +1,2 @@ const cloneRegExp = regExp => new RegExp(regExp.source, regExp.flags); - module.exports = cloneRegExp \ No newline at end of file +module.exports = cloneRegExp \ No newline at end of file diff --git a/test/coalesce/coalesce.js b/test/coalesce/coalesce.js index 6147c753e..839e85f10 100644 --- a/test/coalesce/coalesce.js +++ b/test/coalesce/coalesce.js @@ -1,2 +1,2 @@ const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_)); - module.exports = coalesce \ No newline at end of file +module.exports = coalesce \ No newline at end of file diff --git a/test/coalesceFactory/coalesceFactory.js b/test/coalesceFactory/coalesceFactory.js index 808d4c517..356ab50bb 100644 --- a/test/coalesceFactory/coalesceFactory.js +++ b/test/coalesceFactory/coalesceFactory.js @@ -1,2 +1,2 @@ const coalesceFactory = valid => (...args) => args.find(valid); - module.exports = coalesceFactory \ No newline at end of file +module.exports = coalesceFactory \ No newline at end of file diff --git a/test/collatz/collatz.js b/test/collatz/collatz.js index 90f826b59..a5ea21085 100644 --- a/test/collatz/collatz.js +++ b/test/collatz/collatz.js @@ -1,2 +1,2 @@ const collatz = n => (n % 2 == 0 ? n / 2 : 3 * n + 1); - module.exports = collatz \ No newline at end of file +module.exports = collatz \ No newline at end of file diff --git a/test/collectInto/collectInto.js b/test/collectInto/collectInto.js index d8873dcec..829b8844b 100644 --- a/test/collectInto/collectInto.js +++ b/test/collectInto/collectInto.js @@ -1,2 +1,2 @@ const collectInto = fn => (...args) => fn(args); - module.exports = collectInto \ No newline at end of file +module.exports = collectInto \ No newline at end of file diff --git a/test/colorize/colorize.js b/test/colorize/colorize.js index 47c88dd49..63e7f7d29 100644 --- a/test/colorize/colorize.js +++ b/test/colorize/colorize.js @@ -16,4 +16,4 @@ bgMagenta: `\x1b[45m${args.join(' ')}\x1b[0m`, bgCyan: `\x1b[46m${args.join(' ')}\x1b[0m`, bgWhite: `\x1b[47m${args.join(' ')}\x1b[0m` }); - module.exports = colorize \ No newline at end of file +module.exports = colorize \ No newline at end of file diff --git a/test/compact/compact.js b/test/compact/compact.js index da480df6b..24866fe96 100644 --- a/test/compact/compact.js +++ b/test/compact/compact.js @@ -1,2 +1,2 @@ const compact = arr => arr.filter(Boolean); - module.exports = compact \ No newline at end of file +module.exports = compact \ No newline at end of file diff --git a/test/compose/compose.js b/test/compose/compose.js index ec5564b31..b4e352b0b 100644 --- a/test/compose/compose.js +++ b/test/compose/compose.js @@ -1,2 +1,2 @@ const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); - module.exports = compose \ No newline at end of file +module.exports = compose \ No newline at end of file diff --git a/test/composeRight/composeRight.js b/test/composeRight/composeRight.js new file mode 100644 index 000000000..3e17a2b91 --- /dev/null +++ b/test/composeRight/composeRight.js @@ -0,0 +1,2 @@ +const composeRight = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); +module.exports = composeRight \ No newline at end of file diff --git a/test/composeRight/composeRight.test.js b/test/composeRight/composeRight.test.js new file mode 100644 index 000000000..c96397e9f --- /dev/null +++ b/test/composeRight/composeRight.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const composeRight = require('./composeRight.js'); + +test('Testing composeRight', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof composeRight === 'function', 'composeRight is a Function'); + //t.deepEqual(composeRight(args..), 'Expected'); + //t.equal(composeRight(args..), 'Expected'); + //t.false(composeRight(args..), 'Expected'); + //t.throws(composeRight(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/copyToClipboard/copyToClipboard.js b/test/copyToClipboard/copyToClipboard.js index c1a18c196..5af7138b6 100644 --- a/test/copyToClipboard/copyToClipboard.js +++ b/test/copyToClipboard/copyToClipboard.js @@ -15,4 +15,4 @@ document.getSelection().removeAllRanges(); document.getSelection().addRange(selected); } }; - module.exports = copyToClipboard \ No newline at end of file +module.exports = copyToClipboard \ No newline at end of file diff --git a/test/countBy/countBy.js b/test/countBy/countBy.js index dc5aea920..fdd3f3f92 100644 --- a/test/countBy/countBy.js +++ b/test/countBy/countBy.js @@ -3,4 +3,4 @@ arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => acc[val] = (acc[val] || 0) + 1; return acc; }, {}); - module.exports = countBy \ No newline at end of file +module.exports = countBy \ No newline at end of file diff --git a/test/countOccurrences/countOccurrences.js b/test/countOccurrences/countOccurrences.js index cb03497f6..bc76c8bc3 100644 --- a/test/countOccurrences/countOccurrences.js +++ b/test/countOccurrences/countOccurrences.js @@ -1,2 +1,2 @@ const countOccurrences = (arr, val) => arr.reduce((a, v) => (v === val ? a + 1 : a + 0), 0); - module.exports = countOccurrences \ No newline at end of file +module.exports = countOccurrences \ No newline at end of file diff --git a/test/countVowels/countVowels.js b/test/countVowels/countVowels.js index 62194dc8b..cf9730c41 100644 --- a/test/countVowels/countVowels.js +++ b/test/countVowels/countVowels.js @@ -1,2 +1,2 @@ const countVowels = str => (str.match(/[aeiou]/gi) || []).length; - module.exports = countVowels \ No newline at end of file +module.exports = countVowels \ No newline at end of file diff --git a/test/createElement/createElement.js b/test/createElement/createElement.js index 8786e0056..a9d6062e8 100644 --- a/test/createElement/createElement.js +++ b/test/createElement/createElement.js @@ -3,4 +3,4 @@ const el = document.createElement('div'); el.innerHTML = str; return el.firstElementChild; }; - module.exports = createElement \ No newline at end of file +module.exports = createElement \ No newline at end of file diff --git a/test/createEventHub/createEventHub.js b/test/createEventHub/createEventHub.js index 6b85e5613..82a792026 100644 --- a/test/createEventHub/createEventHub.js +++ b/test/createEventHub/createEventHub.js @@ -12,4 +12,4 @@ const i = (this.hub[event] || []).findIndex(h => h === handler); if (i > -1) this.hub[event].splice(i, 1); } }); - module.exports = createEventHub \ No newline at end of file +module.exports = createEventHub \ No newline at end of file diff --git a/test/currentURL/currentURL.js b/test/currentURL/currentURL.js index e7f2b6885..47c9e8867 100644 --- a/test/currentURL/currentURL.js +++ b/test/currentURL/currentURL.js @@ -1,2 +1,2 @@ const currentURL = () => window.location.href; - module.exports = currentURL \ No newline at end of file +module.exports = currentURL \ No newline at end of file diff --git a/test/curry/curry.js b/test/curry/curry.js index d0109e427..ca08777f9 100644 --- a/test/curry/curry.js +++ b/test/curry/curry.js @@ -1,3 +1,3 @@ const curry = (fn, arity = fn.length, ...args) => arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args); - module.exports = curry \ No newline at end of file +module.exports = curry \ No newline at end of file diff --git a/test/decapitalize/decapitalize.js b/test/decapitalize/decapitalize.js index c42322649..b27279ebc 100644 --- a/test/decapitalize/decapitalize.js +++ b/test/decapitalize/decapitalize.js @@ -1,3 +1,3 @@ const decapitalize = ([first, ...rest], upperRest = false) => first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); - module.exports = decapitalize \ No newline at end of file +module.exports = decapitalize \ No newline at end of file diff --git a/test/deepClone/deepClone.js b/test/deepClone/deepClone.js index dd6573dab..fdb424f30 100644 --- a/test/deepClone/deepClone.js +++ b/test/deepClone/deepClone.js @@ -5,4 +5,4 @@ key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[ke ); return clone; }; - module.exports = deepClone \ No newline at end of file +module.exports = deepClone \ No newline at end of file diff --git a/test/deepFlatten/deepFlatten.js b/test/deepFlatten/deepFlatten.js index f6e7cc6d6..7b6736558 100644 --- a/test/deepFlatten/deepFlatten.js +++ b/test/deepFlatten/deepFlatten.js @@ -1,2 +1,2 @@ const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); - module.exports = deepFlatten \ No newline at end of file +module.exports = deepFlatten \ No newline at end of file diff --git a/test/defaults/defaults.js b/test/defaults/defaults.js index 39e951cab..bb66f6cc1 100644 --- a/test/defaults/defaults.js +++ b/test/defaults/defaults.js @@ -1,2 +1,2 @@ const defaults = (obj, ...defs) => Object.assign({}, obj, ...defs.reverse(), obj); - module.exports = defaults \ No newline at end of file +module.exports = defaults \ No newline at end of file diff --git a/test/defer/defer.js b/test/defer/defer.js index f5562f3c7..fd555a267 100644 --- a/test/defer/defer.js +++ b/test/defer/defer.js @@ -1,2 +1,2 @@ const defer = (fn, ...args) => setTimeout(fn, 1, ...args); - module.exports = defer \ No newline at end of file +module.exports = defer \ No newline at end of file diff --git a/test/detectDeviceType/detectDeviceType.js b/test/detectDeviceType/detectDeviceType.js index d66cb7429..e2d834fd0 100644 --- a/test/detectDeviceType/detectDeviceType.js +++ b/test/detectDeviceType/detectDeviceType.js @@ -2,4 +2,4 @@ const detectDeviceType = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? 'Mobile' : 'Desktop'; - module.exports = detectDeviceType \ No newline at end of file +module.exports = detectDeviceType \ No newline at end of file diff --git a/test/difference/difference.js b/test/difference/difference.js index 48fa645c5..3a2642b5b 100644 --- a/test/difference/difference.js +++ b/test/difference/difference.js @@ -2,4 +2,4 @@ const difference = (a, b) => { const s = new Set(b); return a.filter(x => !s.has(x)); }; - module.exports = difference \ No newline at end of file +module.exports = difference \ No newline at end of file diff --git a/test/differenceBy/differenceBy.js b/test/differenceBy/differenceBy.js new file mode 100644 index 000000000..84e5548bb --- /dev/null +++ b/test/differenceBy/differenceBy.js @@ -0,0 +1,5 @@ +const differenceBy = (a, b, fn) => { +const s = new Set(b.map(v => fn(v))); +return a.filter(x => !s.has(fn(x))); +}; +module.exports = differenceBy \ No newline at end of file diff --git a/test/differenceBy/differenceBy.test.js b/test/differenceBy/differenceBy.test.js new file mode 100644 index 000000000..d4be8a710 --- /dev/null +++ b/test/differenceBy/differenceBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const differenceBy = require('./differenceBy.js'); + +test('Testing differenceBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof differenceBy === 'function', 'differenceBy is a Function'); + //t.deepEqual(differenceBy(args..), 'Expected'); + //t.equal(differenceBy(args..), 'Expected'); + //t.false(differenceBy(args..), 'Expected'); + //t.throws(differenceBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/differenceWith/differenceWith.js b/test/differenceWith/differenceWith.js index 2d173c9c3..83db305b1 100644 --- a/test/differenceWith/differenceWith.js +++ b/test/differenceWith/differenceWith.js @@ -1,2 +1,2 @@ const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1); - module.exports = differenceWith \ No newline at end of file +module.exports = differenceWith \ No newline at end of file diff --git a/test/digitize/digitize.js b/test/digitize/digitize.js index d34c01e6a..b6324fe65 100644 --- a/test/digitize/digitize.js +++ b/test/digitize/digitize.js @@ -1,2 +1,2 @@ const digitize = n => [...`${n}`].map(i => parseInt(i)); - module.exports = digitize \ No newline at end of file +module.exports = digitize \ No newline at end of file diff --git a/test/distance/distance.js b/test/distance/distance.js index 426517fd3..fdcbc4f15 100644 --- a/test/distance/distance.js +++ b/test/distance/distance.js @@ -1,2 +1,2 @@ const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); - module.exports = distance \ No newline at end of file +module.exports = distance \ No newline at end of file diff --git a/test/dropElements/dropElements.js b/test/dropElements/dropElements.js index 6484de16d..bb87783f9 100644 --- a/test/dropElements/dropElements.js +++ b/test/dropElements/dropElements.js @@ -2,4 +2,4 @@ const dropElements = (arr, func) => { while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1); return arr; }; - module.exports = dropElements \ No newline at end of file +module.exports = dropElements \ No newline at end of file diff --git a/test/dropRight/dropRight.js b/test/dropRight/dropRight.js index 8e89e36b4..6e5e6725b 100644 --- a/test/dropRight/dropRight.js +++ b/test/dropRight/dropRight.js @@ -1,2 +1,2 @@ const dropRight = (arr, n = 1) => arr.slice(0, -n); - module.exports = dropRight \ No newline at end of file +module.exports = dropRight \ No newline at end of file diff --git a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js index 1925c72cd..e8033fcfa 100644 --- a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js +++ b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js @@ -6,4 +6,4 @@ return partiallyVisible ((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth)) : top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth; }; - module.exports = elementIsVisibleInViewport \ No newline at end of file +module.exports = elementIsVisibleInViewport \ No newline at end of file diff --git a/test/elo/elo.js b/test/elo/elo.js index 812ee1af1..19952b6b2 100644 --- a/test/elo/elo.js +++ b/test/elo/elo.js @@ -16,4 +16,4 @@ j++; } return ratings; }; - module.exports = elo \ No newline at end of file +module.exports = elo \ No newline at end of file diff --git a/test/equals/equals.js b/test/equals/equals.js index f418aa5cd..d9959f799 100644 --- a/test/equals/equals.js +++ b/test/equals/equals.js @@ -8,4 +8,4 @@ let keys = Object.keys(a); if (keys.length !== Object.keys(b).length) return false; return keys.every(k => equals(a[k], b[k])); }; - module.exports = equals \ No newline at end of file +module.exports = equals \ No newline at end of file diff --git a/test/escapeHTML/escapeHTML.js b/test/escapeHTML/escapeHTML.js index 94cb8e7fe..f1d9c874c 100644 --- a/test/escapeHTML/escapeHTML.js +++ b/test/escapeHTML/escapeHTML.js @@ -10,4 +10,4 @@ tag => '"': '"' }[tag] || tag) ); - module.exports = escapeHTML \ No newline at end of file +module.exports = escapeHTML \ No newline at end of file diff --git a/test/escapeRegExp/escapeRegExp.js b/test/escapeRegExp/escapeRegExp.js index 9164cc532..cfd2d03bf 100644 --- a/test/escapeRegExp/escapeRegExp.js +++ b/test/escapeRegExp/escapeRegExp.js @@ -1,2 +1,2 @@ const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - module.exports = escapeRegExp \ No newline at end of file +module.exports = escapeRegExp \ No newline at end of file diff --git a/test/everyNth/everyNth.js b/test/everyNth/everyNth.js index 723c4f5ca..12285c8f0 100644 --- a/test/everyNth/everyNth.js +++ b/test/everyNth/everyNth.js @@ -1,2 +1,2 @@ const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1); - module.exports = everyNth \ No newline at end of file +module.exports = everyNth \ No newline at end of file diff --git a/test/extendHex/extendHex.js b/test/extendHex/extendHex.js index 6e1b6d535..fe39c39fa 100644 --- a/test/extendHex/extendHex.js +++ b/test/extendHex/extendHex.js @@ -5,4 +5,4 @@ shortHex .split('') .map(x => x + x) .join(''); - module.exports = extendHex \ No newline at end of file +module.exports = extendHex \ No newline at end of file diff --git a/test/factorial/factorial.js b/test/factorial/factorial.js index 928826dea..b09e3ab26 100644 --- a/test/factorial/factorial.js +++ b/test/factorial/factorial.js @@ -4,4 +4,4 @@ n < 0 throw new TypeError('Negative numbers are not allowed!'); })() : n <= 1 ? 1 : n * factorial(n - 1); - module.exports = factorial \ No newline at end of file +module.exports = factorial \ No newline at end of file diff --git a/test/factors/factors.js b/test/factors/factors.js index b34e1ded4..d0d789e83 100644 --- a/test/factors/factors.js +++ b/test/factors/factors.js @@ -17,4 +17,4 @@ return acc; }, []); return primes ? array.filter(isPrime) : array; }; - module.exports = factors \ No newline at end of file +module.exports = factors \ No newline at end of file diff --git a/test/fibonacci/fibonacci.js b/test/fibonacci/fibonacci.js index c6dbaf313..2fe873dc3 100644 --- a/test/fibonacci/fibonacci.js +++ b/test/fibonacci/fibonacci.js @@ -3,4 +3,4 @@ Array.from({ length: n }).reduce( (acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), [] ); - module.exports = fibonacci \ No newline at end of file +module.exports = fibonacci \ No newline at end of file diff --git a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js index a23fab23b..7746208c2 100644 --- a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js +++ b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js @@ -1,3 +1,3 @@ const fibonacciCountUntilNum = num => Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2)); - module.exports = fibonacciCountUntilNum \ No newline at end of file +module.exports = fibonacciCountUntilNum \ No newline at end of file diff --git a/test/fibonacciUntilNum/fibonacciUntilNum.js b/test/fibonacciUntilNum/fibonacciUntilNum.js index 9f5a4ac32..649bd6e25 100644 --- a/test/fibonacciUntilNum/fibonacciUntilNum.js +++ b/test/fibonacciUntilNum/fibonacciUntilNum.js @@ -5,4 +5,4 @@ return Array.from({ length: n }).reduce( [] ); }; - module.exports = fibonacciUntilNum \ No newline at end of file +module.exports = fibonacciUntilNum \ No newline at end of file diff --git a/test/filterNonUnique/filterNonUnique.js b/test/filterNonUnique/filterNonUnique.js index 712cf074e..30a039b67 100644 --- a/test/filterNonUnique/filterNonUnique.js +++ b/test/filterNonUnique/filterNonUnique.js @@ -1,2 +1,2 @@ const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i)); - module.exports = filterNonUnique \ No newline at end of file +module.exports = filterNonUnique \ No newline at end of file diff --git a/test/findKey/findKey.js b/test/findKey/findKey.js index b97dc0b7f..66a5edc1c 100644 --- a/test/findKey/findKey.js +++ b/test/findKey/findKey.js @@ -1,2 +1,2 @@ const findKey = (obj, fn) => Object.keys(obj).find(key => fn(obj[key], key, obj)); - module.exports = findKey \ No newline at end of file +module.exports = findKey \ No newline at end of file diff --git a/test/findLast/findLast.js b/test/findLast/findLast.js index 00daa5d5d..1586a1b46 100644 --- a/test/findLast/findLast.js +++ b/test/findLast/findLast.js @@ -1,2 +1,2 @@ -const findLast = (arr, fn) => arr.filter(fn).slice(-1); - module.exports = findLast \ No newline at end of file +const findLast = (arr, fn) => arr.filter(fn).slice(-1)[0]; +module.exports = findLast \ No newline at end of file diff --git a/test/findLastIndex/findLastIndex.js b/test/findLastIndex/findLastIndex.js new file mode 100644 index 000000000..378a0e244 --- /dev/null +++ b/test/findLastIndex/findLastIndex.js @@ -0,0 +1,6 @@ +const findLastIndex = (arr, fn) => +arr +.map((val, i) => [i, val]) +.filter(val => fn(val[1], val[0], arr)) +.slice(-1)[0][0]; +module.exports = findLastIndex \ No newline at end of file diff --git a/test/findLastIndex/findLastIndex.test.js b/test/findLastIndex/findLastIndex.test.js new file mode 100644 index 000000000..c0bf93814 --- /dev/null +++ b/test/findLastIndex/findLastIndex.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const findLastIndex = require('./findLastIndex.js'); + +test('Testing findLastIndex', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof findLastIndex === 'function', 'findLastIndex is a Function'); + //t.deepEqual(findLastIndex(args..), 'Expected'); + //t.equal(findLastIndex(args..), 'Expected'); + //t.false(findLastIndex(args..), 'Expected'); + //t.throws(findLastIndex(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/findLastKey/findLastKey.js b/test/findLastKey/findLastKey.js index 0484b644c..0033cf1e8 100644 --- a/test/findLastKey/findLastKey.js +++ b/test/findLastKey/findLastKey.js @@ -2,4 +2,4 @@ const findLastKey = (obj, fn) => Object.keys(obj) .reverse() .find(key => fn(obj[key], key, obj)); - module.exports = findLastKey \ No newline at end of file +module.exports = findLastKey \ No newline at end of file diff --git a/test/flatten/flatten.js b/test/flatten/flatten.js index 027441ea1..6563b70fd 100644 --- a/test/flatten/flatten.js +++ b/test/flatten/flatten.js @@ -2,4 +2,4 @@ const flatten = (arr, depth = 1) => depth != 1 ? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flatten(v, depth - 1) : v), []) : arr.reduce((a, v) => a.concat(v), []); - module.exports = flatten \ No newline at end of file +module.exports = flatten \ No newline at end of file diff --git a/test/flip/flip.js b/test/flip/flip.js index 1c3e94247..79d2e19e6 100644 --- a/test/flip/flip.js +++ b/test/flip/flip.js @@ -1,2 +1,2 @@ const flip = fn => (first, ...rest) => fn(...rest, first); - module.exports = flip \ No newline at end of file +module.exports = flip \ No newline at end of file diff --git a/test/forEachRight/forEachRight.js b/test/forEachRight/forEachRight.js index a6e0f7a9e..f23c83b8f 100644 --- a/test/forEachRight/forEachRight.js +++ b/test/forEachRight/forEachRight.js @@ -3,4 +3,4 @@ arr .slice(0) .reverse() .forEach(callback); - module.exports = forEachRight \ No newline at end of file +module.exports = forEachRight \ No newline at end of file diff --git a/test/forOwn/forOwn.js b/test/forOwn/forOwn.js index de8b06fcc..52fdf433b 100644 --- a/test/forOwn/forOwn.js +++ b/test/forOwn/forOwn.js @@ -1,2 +1,2 @@ const forOwn = (obj, fn) => Object.keys(obj).forEach(key => fn(obj[key], key, obj)); - module.exports = forOwn \ No newline at end of file +module.exports = forOwn \ No newline at end of file diff --git a/test/forOwnRight/forOwnRight.js b/test/forOwnRight/forOwnRight.js index a74205dca..c29f23464 100644 --- a/test/forOwnRight/forOwnRight.js +++ b/test/forOwnRight/forOwnRight.js @@ -2,4 +2,4 @@ const forOwnRight = (obj, fn) => Object.keys(obj) .reverse() .forEach(key => fn(obj[key], key, obj)); - module.exports = forOwnRight \ No newline at end of file +module.exports = forOwnRight \ No newline at end of file diff --git a/test/formatDuration/formatDuration.js b/test/formatDuration/formatDuration.js index ae1075e92..ed0d60595 100644 --- a/test/formatDuration/formatDuration.js +++ b/test/formatDuration/formatDuration.js @@ -12,4 +12,4 @@ return Object.entries(time) .map(val => val[1] + ' ' + (val[1] !== 1 ? val[0] + 's' : val[0])) .join(', '); }; - module.exports = formatDuration \ No newline at end of file +module.exports = formatDuration \ No newline at end of file diff --git a/test/fromCamelCase/fromCamelCase.js b/test/fromCamelCase/fromCamelCase.js index 10c6fac30..3538c0f2e 100644 --- a/test/fromCamelCase/fromCamelCase.js +++ b/test/fromCamelCase/fromCamelCase.js @@ -3,4 +3,4 @@ str .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2') .toLowerCase(); - module.exports = fromCamelCase \ No newline at end of file +module.exports = fromCamelCase \ No newline at end of file diff --git a/test/functionName/functionName.js b/test/functionName/functionName.js index 2181fe74a..ffca87364 100644 --- a/test/functionName/functionName.js +++ b/test/functionName/functionName.js @@ -1,2 +1,2 @@ const functionName = fn => (console.debug(fn.name), fn); - module.exports = functionName \ No newline at end of file +module.exports = functionName \ No newline at end of file diff --git a/test/functions/functions.js b/test/functions/functions.js index 7a451527d..93e11a78a 100644 --- a/test/functions/functions.js +++ b/test/functions/functions.js @@ -3,4 +3,4 @@ const functions = (obj, inherited = false) => ? [...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))] : Object.keys(obj) ).filter(key => typeof obj[key] === 'function'); - module.exports = functions \ No newline at end of file +module.exports = functions \ No newline at end of file diff --git a/test/gcd/gcd.js b/test/gcd/gcd.js index 201d996ae..877cd3763 100644 --- a/test/gcd/gcd.js +++ b/test/gcd/gcd.js @@ -2,4 +2,4 @@ const gcd = (...arr) => { const _gcd = (x, y) => (!y ? x : gcd(y, x % y)); return [...arr].reduce((a, b) => _gcd(a, b)); }; - module.exports = gcd \ No newline at end of file +module.exports = gcd \ No newline at end of file diff --git a/test/geometricProgression/geometricProgression.js b/test/geometricProgression/geometricProgression.js index c42691c59..afaeaf136 100644 --- a/test/geometricProgression/geometricProgression.js +++ b/test/geometricProgression/geometricProgression.js @@ -2,4 +2,4 @@ const geometricProgression = (end, start = 1, step = 2) => Array.from({ length: Math.floor(Math.log(end / start) / Math.log(step)) + 1 }).map( (v, i) => start * step ** i ); - module.exports = geometricProgression \ No newline at end of file +module.exports = geometricProgression \ No newline at end of file diff --git a/test/get/get.js b/test/get/get.js index b83862c51..568160c84 100644 --- a/test/get/get.js +++ b/test/get/get.js @@ -6,4 +6,4 @@ s .filter(t => t !== '') .reduce((prev, cur) => prev && prev[cur], from) ); - module.exports = get \ No newline at end of file +module.exports = get \ No newline at end of file diff --git a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js index e2157f0d3..899f75ae4 100644 --- a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js +++ b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js @@ -1,3 +1,3 @@ const getDaysDiffBetweenDates = (dateInitial, dateFinal) => (dateFinal - dateInitial) / (1000 * 3600 * 24); - module.exports = getDaysDiffBetweenDates \ No newline at end of file +module.exports = getDaysDiffBetweenDates \ No newline at end of file diff --git a/test/getScrollPosition/getScrollPosition.js b/test/getScrollPosition/getScrollPosition.js index 4d3e12a62..a5fa12a18 100644 --- a/test/getScrollPosition/getScrollPosition.js +++ b/test/getScrollPosition/getScrollPosition.js @@ -2,4 +2,4 @@ const getScrollPosition = (el = window) => ({ x: el.pageXOffset !== undefined ? el.pageXOffset : el.scrollLeft, y: el.pageYOffset !== undefined ? el.pageYOffset : el.scrollTop }); - module.exports = getScrollPosition \ No newline at end of file +module.exports = getScrollPosition \ No newline at end of file diff --git a/test/getStyle/getStyle.js b/test/getStyle/getStyle.js index 6df1c1394..6303f0993 100644 --- a/test/getStyle/getStyle.js +++ b/test/getStyle/getStyle.js @@ -1,2 +1,2 @@ const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; - module.exports = getStyle \ No newline at end of file +module.exports = getStyle \ No newline at end of file diff --git a/test/getType/getType.js b/test/getType/getType.js index 02973563b..8c9f93a75 100644 --- a/test/getType/getType.js +++ b/test/getType/getType.js @@ -1,3 +1,3 @@ const getType = v => v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); - module.exports = getType \ No newline at end of file +module.exports = getType \ No newline at end of file diff --git a/test/getURLParameters/getURLParameters.js b/test/getURLParameters/getURLParameters.js index 029711f48..622c99769 100644 --- a/test/getURLParameters/getURLParameters.js +++ b/test/getURLParameters/getURLParameters.js @@ -2,4 +2,4 @@ const getURLParameters = url => url .match(/([^?=&]+)(=([^&]*))/g) .reduce((a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), {}); - module.exports = getURLParameters \ No newline at end of file +module.exports = getURLParameters \ No newline at end of file diff --git a/test/groupBy/groupBy.js b/test/groupBy/groupBy.js index f1083e4fe..25bb573d9 100644 --- a/test/groupBy/groupBy.js +++ b/test/groupBy/groupBy.js @@ -3,4 +3,4 @@ arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => acc[val] = (acc[val] || []).concat(arr[i]); return acc; }, {}); - module.exports = groupBy \ No newline at end of file +module.exports = groupBy \ No newline at end of file diff --git a/test/hammingDistance/hammingDistance.js b/test/hammingDistance/hammingDistance.js index e6e4c81e0..356304ed4 100644 --- a/test/hammingDistance/hammingDistance.js +++ b/test/hammingDistance/hammingDistance.js @@ -1,2 +1,2 @@ const hammingDistance = (num1, num2) => ((num1 ^ num2).toString(2).match(/1/g) || '').length; - module.exports = hammingDistance \ No newline at end of file +module.exports = hammingDistance \ No newline at end of file diff --git a/test/hasClass/hasClass.js b/test/hasClass/hasClass.js index 8f6f09234..c14590500 100644 --- a/test/hasClass/hasClass.js +++ b/test/hasClass/hasClass.js @@ -1,2 +1,2 @@ const hasClass = (el, className) => el.classList.contains(className); - module.exports = hasClass \ No newline at end of file +module.exports = hasClass \ No newline at end of file diff --git a/test/hasFlags/hasFlags.js b/test/hasFlags/hasFlags.js index c0312e5fc..9b8740692 100644 --- a/test/hasFlags/hasFlags.js +++ b/test/hasFlags/hasFlags.js @@ -1,3 +1,3 @@ const hasFlags = (...flags) => flags.every(flag => process.argv.includes(/^-{1,2}/.test(flag) ? flag : '--' + flag)); - module.exports = hasFlags \ No newline at end of file +module.exports = hasFlags \ No newline at end of file diff --git a/test/hashBrowser/hashBrowser.js b/test/hashBrowser/hashBrowser.js index 59db15021..ea13e46a2 100644 --- a/test/hashBrowser/hashBrowser.js +++ b/test/hashBrowser/hashBrowser.js @@ -6,4 +6,4 @@ for (let i = 0; i < view.byteLength; i += 4) hexes.push(('00000000' + view.getUint32(i).toString(16)).slice(-8)); return hexes.join(''); }); - module.exports = hashBrowser \ No newline at end of file +module.exports = hashBrowser \ No newline at end of file diff --git a/test/hashNode/hashNode.js b/test/hashNode/hashNode.js index e6124fe5d..9041dec36 100644 --- a/test/hashNode/hashNode.js +++ b/test/hashNode/hashNode.js @@ -12,4 +12,4 @@ crypto 0 ) ); - module.exports = hashNode \ No newline at end of file +module.exports = hashNode \ No newline at end of file diff --git a/test/head/head.js b/test/head/head.js index 0c4e9eb90..bf2039dd0 100644 --- a/test/head/head.js +++ b/test/head/head.js @@ -1,2 +1,2 @@ const head = arr => arr[0]; - module.exports = head \ No newline at end of file +module.exports = head \ No newline at end of file diff --git a/test/hexToRGB/hexToRGB.js b/test/hexToRGB/hexToRGB.js index 090ec2a35..516050b8a 100644 --- a/test/hexToRGB/hexToRGB.js +++ b/test/hexToRGB/hexToRGB.js @@ -17,4 +17,4 @@ return ( ')' ); }; - module.exports = hexToRGB \ No newline at end of file +module.exports = hexToRGB \ No newline at end of file diff --git a/test/hide/hide.js b/test/hide/hide.js index 56bc848c9..d16add1ce 100644 --- a/test/hide/hide.js +++ b/test/hide/hide.js @@ -1,2 +1,2 @@ const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); - module.exports = hide \ No newline at end of file +module.exports = hide \ No newline at end of file diff --git a/test/howManyTimes/howManyTimes.js b/test/howManyTimes/howManyTimes.js index 85d57b0d5..51313c194 100644 --- a/test/howManyTimes/howManyTimes.js +++ b/test/howManyTimes/howManyTimes.js @@ -8,4 +8,4 @@ num = num / divisor; } return i; }; - module.exports = howManyTimes \ No newline at end of file +module.exports = howManyTimes \ No newline at end of file diff --git a/test/httpDelete/httpDelete.js b/test/httpDelete/httpDelete.js index 8a3ff97e6..0892b1819 100644 --- a/test/httpDelete/httpDelete.js +++ b/test/httpDelete/httpDelete.js @@ -5,4 +5,4 @@ request.onload = () => callback(request); request.onerror = () => err(request); request.send(); }; - module.exports = httpDelete \ No newline at end of file +module.exports = httpDelete \ No newline at end of file diff --git a/test/httpGet/httpGet.js b/test/httpGet/httpGet.js index 04564234a..413049085 100644 --- a/test/httpGet/httpGet.js +++ b/test/httpGet/httpGet.js @@ -5,4 +5,4 @@ request.onload = () => callback(request.responseText); request.onerror = () => err(request); request.send(); }; - module.exports = httpGet \ No newline at end of file +module.exports = httpGet \ No newline at end of file diff --git a/test/httpPost/httpPost.js b/test/httpPost/httpPost.js index bb7345f83..e81331645 100644 --- a/test/httpPost/httpPost.js +++ b/test/httpPost/httpPost.js @@ -6,4 +6,4 @@ request.onload = () => callback(request.responseText); request.onerror = () => err(request); request.send(data); }; - module.exports = httpPost \ No newline at end of file +module.exports = httpPost \ No newline at end of file diff --git a/test/httpPut/httpPut.js b/test/httpPut/httpPut.js index fba715694..71a0f79d9 100644 --- a/test/httpPut/httpPut.js +++ b/test/httpPut/httpPut.js @@ -6,4 +6,4 @@ request.onload = () => callback(request); request.onerror = () => err(request); request.send(data); }; - module.exports = httpPut \ No newline at end of file +module.exports = httpPut \ No newline at end of file diff --git a/test/httpsRedirect/httpsRedirect.js b/test/httpsRedirect/httpsRedirect.js index 832563f07..c1e3d2c5a 100644 --- a/test/httpsRedirect/httpsRedirect.js +++ b/test/httpsRedirect/httpsRedirect.js @@ -1,4 +1,4 @@ const httpsRedirect = () => { if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]); }; - module.exports = httpsRedirect \ No newline at end of file +module.exports = httpsRedirect \ No newline at end of file diff --git a/test/inRange/inRange.js b/test/inRange/inRange.js index f0f16154b..8eaa567cf 100644 --- a/test/inRange/inRange.js +++ b/test/inRange/inRange.js @@ -2,4 +2,4 @@ const inRange = (n, start, end = null) => { if (end && start > end) end = [start, (start = end)][0]; return end == null ? n >= 0 && n < start : n >= start && n < end; }; - module.exports = inRange \ No newline at end of file +module.exports = inRange \ No newline at end of file diff --git a/test/indexOfAll/indexOfAll.js b/test/indexOfAll/indexOfAll.js index 8eebcf8a4..e99be6004 100644 --- a/test/indexOfAll/indexOfAll.js +++ b/test/indexOfAll/indexOfAll.js @@ -3,4 +3,4 @@ const indices = []; arr.forEach((el, i) => el === val && indices.push(i)); return indices; }; - module.exports = indexOfAll \ No newline at end of file +module.exports = indexOfAll \ No newline at end of file diff --git a/test/initial/initial.js b/test/initial/initial.js index 66869d7d1..c7ed44b13 100644 --- a/test/initial/initial.js +++ b/test/initial/initial.js @@ -1,2 +1,2 @@ const initial = arr => arr.slice(0, -1); - module.exports = initial \ No newline at end of file +module.exports = initial \ No newline at end of file diff --git a/test/initialize2DArray/initialize2DArray.js b/test/initialize2DArray/initialize2DArray.js index b8a85fd93..00b71e6af 100644 --- a/test/initialize2DArray/initialize2DArray.js +++ b/test/initialize2DArray/initialize2DArray.js @@ -1,3 +1,3 @@ const initialize2DArray = (w, h, val = null) => Array.from({ length: h }).map(() => Array.from({ length: w }).fill(val)); - module.exports = initialize2DArray \ No newline at end of file +module.exports = initialize2DArray \ No newline at end of file diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.js b/test/initializeArrayWithRange/initializeArrayWithRange.js index 2b875d6b9..11132582e 100644 --- a/test/initializeArrayWithRange/initializeArrayWithRange.js +++ b/test/initializeArrayWithRange/initializeArrayWithRange.js @@ -1,3 +1,3 @@ const initializeArrayWithRange = (end, start = 0, step = 1) => Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i) => i * step + start); - module.exports = initializeArrayWithRange \ No newline at end of file +module.exports = initializeArrayWithRange \ No newline at end of file diff --git a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js b/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js index 957361046..478a73f2c 100644 --- a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js +++ b/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js @@ -2,4 +2,4 @@ const initializeArrayWithRangeRight = (end, start = 0, step = 1) => Array.from({ length: Math.ceil((end + 1 - start) / step) }).map( (v, i, arr) => (arr.length - i - 1) * step + start ); - module.exports = initializeArrayWithRangeRight \ No newline at end of file +module.exports = initializeArrayWithRangeRight \ No newline at end of file diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.js b/test/initializeArrayWithValues/initializeArrayWithValues.js index a9e77c805..32e55933a 100644 --- a/test/initializeArrayWithValues/initializeArrayWithValues.js +++ b/test/initializeArrayWithValues/initializeArrayWithValues.js @@ -1,2 +1,2 @@ const initializeArrayWithValues = (n, val = 0) => Array(n).fill(val); - module.exports = initializeArrayWithValues \ No newline at end of file +module.exports = initializeArrayWithValues \ No newline at end of file diff --git a/test/intersection/intersection.js b/test/intersection/intersection.js index b547b9136..c637ae88f 100644 --- a/test/intersection/intersection.js +++ b/test/intersection/intersection.js @@ -2,4 +2,4 @@ const intersection = (a, b) => { const s = new Set(b); return a.filter(x => s.has(x)); }; - module.exports = intersection \ No newline at end of file +module.exports = intersection \ No newline at end of file diff --git a/test/intersectionBy/intersectionBy.js b/test/intersectionBy/intersectionBy.js new file mode 100644 index 000000000..78b3549c5 --- /dev/null +++ b/test/intersectionBy/intersectionBy.js @@ -0,0 +1,5 @@ +const intersectionBy = (a, b, fn) => { +const s = new Set(b.map(x => fn(x))); +return a.filter(x => s.has(fn(x))); +}; +module.exports = intersectionBy \ No newline at end of file diff --git a/test/intersectionBy/intersectionBy.test.js b/test/intersectionBy/intersectionBy.test.js new file mode 100644 index 000000000..e4c5af9b0 --- /dev/null +++ b/test/intersectionBy/intersectionBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const intersectionBy = require('./intersectionBy.js'); + +test('Testing intersectionBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof intersectionBy === 'function', 'intersectionBy is a Function'); + //t.deepEqual(intersectionBy(args..), 'Expected'); + //t.equal(intersectionBy(args..), 'Expected'); + //t.false(intersectionBy(args..), 'Expected'); + //t.throws(intersectionBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/intersectionWith/intersectionWith.js b/test/intersectionWith/intersectionWith.js new file mode 100644 index 000000000..4d01fb1a9 --- /dev/null +++ b/test/intersectionWith/intersectionWith.js @@ -0,0 +1,2 @@ +const intersectionWith = (a, b, comp) => a.filter(x => b.findIndex(y => comp(x, y)) !== -1); +module.exports = intersectionWith \ No newline at end of file diff --git a/test/intersectionWith/intersectionWith.test.js b/test/intersectionWith/intersectionWith.test.js new file mode 100644 index 000000000..12501f66a --- /dev/null +++ b/test/intersectionWith/intersectionWith.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const intersectionWith = require('./intersectionWith.js'); + +test('Testing intersectionWith', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof intersectionWith === 'function', 'intersectionWith is a Function'); + //t.deepEqual(intersectionWith(args..), 'Expected'); + //t.equal(intersectionWith(args..), 'Expected'); + //t.false(intersectionWith(args..), 'Expected'); + //t.throws(intersectionWith(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/invertKeyValues/invertKeyValues.js b/test/invertKeyValues/invertKeyValues.js index 93ef7c7a2..0b2b5f35b 100644 --- a/test/invertKeyValues/invertKeyValues.js +++ b/test/invertKeyValues/invertKeyValues.js @@ -5,4 +5,4 @@ acc[val] = acc[val] || []; acc[val].push(key); return acc; }, {}); - module.exports = invertKeyValues \ No newline at end of file +module.exports = invertKeyValues \ No newline at end of file diff --git a/test/is/is.js b/test/is/is.js index 829c5d16e..59035ba79 100644 --- a/test/is/is.js +++ b/test/is/is.js @@ -1,2 +1,2 @@ const is = (type, val) => val instanceof type; - module.exports = is \ No newline at end of file +module.exports = is \ No newline at end of file diff --git a/test/isAbsoluteURL/isAbsoluteURL.js b/test/isAbsoluteURL/isAbsoluteURL.js index fcfb3e490..31accb72d 100644 --- a/test/isAbsoluteURL/isAbsoluteURL.js +++ b/test/isAbsoluteURL/isAbsoluteURL.js @@ -1,2 +1,2 @@ const isAbsoluteURL = str => /^[a-z][a-z0-9+.-]*:/.test(str); - module.exports = isAbsoluteURL \ No newline at end of file +module.exports = isAbsoluteURL \ No newline at end of file diff --git a/test/isArmstrongNumber/isArmstrongNumber.js b/test/isArmstrongNumber/isArmstrongNumber.js index dbbb3bc7f..e71055d5d 100644 --- a/test/isArmstrongNumber/isArmstrongNumber.js +++ b/test/isArmstrongNumber/isArmstrongNumber.js @@ -2,4 +2,4 @@ const isArmstrongNumber = digits => (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)( (digits + '').split('') ); - module.exports = isArmstrongNumber \ No newline at end of file +module.exports = isArmstrongNumber \ No newline at end of file diff --git a/test/isArrayLike/isArrayLike.js b/test/isArrayLike/isArrayLike.js index ce5a35eb5..4930908ec 100644 --- a/test/isArrayLike/isArrayLike.js +++ b/test/isArrayLike/isArrayLike.js @@ -5,4 +5,4 @@ return [...val], true; return false; } }; - module.exports = isArrayLike \ No newline at end of file +module.exports = isArrayLike \ No newline at end of file diff --git a/test/isBoolean/isBoolean.js b/test/isBoolean/isBoolean.js index 96d35cc5b..1ae8e4c9c 100644 --- a/test/isBoolean/isBoolean.js +++ b/test/isBoolean/isBoolean.js @@ -1,2 +1,2 @@ const isBoolean = val => typeof val === 'boolean'; - module.exports = isBoolean \ No newline at end of file +module.exports = isBoolean \ No newline at end of file diff --git a/test/isDivisible/isDivisible.js b/test/isDivisible/isDivisible.js index cb4cf5ace..a0f9d226d 100644 --- a/test/isDivisible/isDivisible.js +++ b/test/isDivisible/isDivisible.js @@ -1,2 +1,2 @@ const isDivisible = (dividend, divisor) => dividend % divisor === 0; - module.exports = isDivisible \ No newline at end of file +module.exports = isDivisible \ No newline at end of file diff --git a/test/isEmpty/isEmpty.js b/test/isEmpty/isEmpty.js index 10e93f435..189bdf0fd 100644 --- a/test/isEmpty/isEmpty.js +++ b/test/isEmpty/isEmpty.js @@ -1,2 +1,2 @@ const isEmpty = val => val == null || !(Object.keys(val) || val).length; - module.exports = isEmpty \ No newline at end of file +module.exports = isEmpty \ No newline at end of file diff --git a/test/isEven/isEven.js b/test/isEven/isEven.js index 255ea706e..6807815ad 100644 --- a/test/isEven/isEven.js +++ b/test/isEven/isEven.js @@ -1,2 +1,2 @@ const isEven = num => num % 2 === 0; - module.exports = isEven \ No newline at end of file +module.exports = isEven \ No newline at end of file diff --git a/test/isFunction/isFunction.js b/test/isFunction/isFunction.js index c7879e596..2afc19f96 100644 --- a/test/isFunction/isFunction.js +++ b/test/isFunction/isFunction.js @@ -1,2 +1,2 @@ const isFunction = val => typeof val === 'function'; - module.exports = isFunction \ No newline at end of file +module.exports = isFunction \ No newline at end of file diff --git a/test/isLowerCase/isLowerCase.js b/test/isLowerCase/isLowerCase.js index 2eb3496a3..b717cbc36 100644 --- a/test/isLowerCase/isLowerCase.js +++ b/test/isLowerCase/isLowerCase.js @@ -1,2 +1,2 @@ const isLowerCase = str => str === str.toLowerCase(); - module.exports = isLowerCase \ No newline at end of file +module.exports = isLowerCase \ No newline at end of file diff --git a/test/isNil/isNil.js b/test/isNil/isNil.js index f7a372152..aed4ee641 100644 --- a/test/isNil/isNil.js +++ b/test/isNil/isNil.js @@ -1,2 +1,2 @@ const isNil = val => val === undefined || val === null; - module.exports = isNil \ No newline at end of file +module.exports = isNil \ No newline at end of file diff --git a/test/isNull/isNull.js b/test/isNull/isNull.js index 89d25db2d..a741e6a67 100644 --- a/test/isNull/isNull.js +++ b/test/isNull/isNull.js @@ -1,2 +1,2 @@ const isNull = val => val === null; - module.exports = isNull \ No newline at end of file +module.exports = isNull \ No newline at end of file diff --git a/test/isNumber/isNumber.js b/test/isNumber/isNumber.js index 49ada847c..89c9390bf 100644 --- a/test/isNumber/isNumber.js +++ b/test/isNumber/isNumber.js @@ -1,2 +1,2 @@ const isNumber = val => typeof val === 'number'; - module.exports = isNumber \ No newline at end of file +module.exports = isNumber \ No newline at end of file diff --git a/test/isObject/isObject.js b/test/isObject/isObject.js index e6b532d48..087cedddd 100644 --- a/test/isObject/isObject.js +++ b/test/isObject/isObject.js @@ -1,2 +1,2 @@ const isObject = obj => obj === Object(obj); - module.exports = isObject \ No newline at end of file +module.exports = isObject \ No newline at end of file diff --git a/test/isObjectLike/isObjectLike.js b/test/isObjectLike/isObjectLike.js index 17073de4c..c7088e7ad 100644 --- a/test/isObjectLike/isObjectLike.js +++ b/test/isObjectLike/isObjectLike.js @@ -1,2 +1,2 @@ const isObjectLike = val => val !== null && typeof val === 'object'; - module.exports = isObjectLike \ No newline at end of file +module.exports = isObjectLike \ No newline at end of file diff --git a/test/isPlainObject/isPlainObject.js b/test/isPlainObject/isPlainObject.js index d740bf7c9..3e85aaf92 100644 --- a/test/isPlainObject/isPlainObject.js +++ b/test/isPlainObject/isPlainObject.js @@ -1,2 +1,2 @@ const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object; - module.exports = isPlainObject \ No newline at end of file +module.exports = isPlainObject \ No newline at end of file diff --git a/test/isPrime/isPrime.js b/test/isPrime/isPrime.js index 227aae1d4..3691324d3 100644 --- a/test/isPrime/isPrime.js +++ b/test/isPrime/isPrime.js @@ -3,4 +3,4 @@ const boundary = Math.floor(Math.sqrt(num)); for (var i = 2; i <= boundary; i++) if (num % i == 0) return false; return num >= 2; }; - module.exports = isPrime \ No newline at end of file +module.exports = isPrime \ No newline at end of file diff --git a/test/isPrimitive/isPrimitive.js b/test/isPrimitive/isPrimitive.js index 45a2bc136..46c9a0568 100644 --- a/test/isPrimitive/isPrimitive.js +++ b/test/isPrimitive/isPrimitive.js @@ -1,2 +1,2 @@ const isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null; - module.exports = isPrimitive \ No newline at end of file +module.exports = isPrimitive \ No newline at end of file diff --git a/test/isPromiseLike/isPromiseLike.js b/test/isPromiseLike/isPromiseLike.js index a25cb7b37..736b6ced9 100644 --- a/test/isPromiseLike/isPromiseLike.js +++ b/test/isPromiseLike/isPromiseLike.js @@ -2,4 +2,4 @@ const isPromiseLike = obj => obj !== null && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; - module.exports = isPromiseLike \ No newline at end of file +module.exports = isPromiseLike \ No newline at end of file diff --git a/test/isSorted/isSorted.js b/test/isSorted/isSorted.js index 51f645c54..c80495eb6 100644 --- a/test/isSorted/isSorted.js +++ b/test/isSorted/isSorted.js @@ -4,4 +4,4 @@ for (let [i, val] of arr.entries()) if (i === arr.length - 1) return direction; else if ((val - arr[i + 1]) * direction > 0) return 0; }; - module.exports = isSorted \ No newline at end of file +module.exports = isSorted \ No newline at end of file diff --git a/test/isString/isString.js b/test/isString/isString.js index 4d866cf60..2ca94c27d 100644 --- a/test/isString/isString.js +++ b/test/isString/isString.js @@ -1,2 +1,2 @@ const isString = val => typeof val === 'string'; - module.exports = isString \ No newline at end of file +module.exports = isString \ No newline at end of file diff --git a/test/isSymbol/isSymbol.js b/test/isSymbol/isSymbol.js index cf18ba27d..f9956e85b 100644 --- a/test/isSymbol/isSymbol.js +++ b/test/isSymbol/isSymbol.js @@ -1,2 +1,2 @@ const isSymbol = val => typeof val === 'symbol'; - module.exports = isSymbol \ No newline at end of file +module.exports = isSymbol \ No newline at end of file diff --git a/test/isTravisCI/isTravisCI.js b/test/isTravisCI/isTravisCI.js index 19a9125c6..9dcc7e8c3 100644 --- a/test/isTravisCI/isTravisCI.js +++ b/test/isTravisCI/isTravisCI.js @@ -1,2 +1,2 @@ const isTravisCI = () => 'TRAVIS' in process.env && 'CI' in process.env; - module.exports = isTravisCI \ No newline at end of file +module.exports = isTravisCI \ No newline at end of file diff --git a/test/isUndefined/isUndefined.js b/test/isUndefined/isUndefined.js index fa0f75d88..7eb3f9b03 100644 --- a/test/isUndefined/isUndefined.js +++ b/test/isUndefined/isUndefined.js @@ -1,2 +1,2 @@ const isUndefined = val => val === undefined; - module.exports = isUndefined \ No newline at end of file +module.exports = isUndefined \ No newline at end of file diff --git a/test/isUpperCase/isUpperCase.js b/test/isUpperCase/isUpperCase.js index 319409a0b..9f255968e 100644 --- a/test/isUpperCase/isUpperCase.js +++ b/test/isUpperCase/isUpperCase.js @@ -1,2 +1,2 @@ const isUpperCase = str => str === str.toUpperCase(); - module.exports = isUpperCase \ No newline at end of file +module.exports = isUpperCase \ No newline at end of file diff --git a/test/isValidJSON/isValidJSON.js b/test/isValidJSON/isValidJSON.js index c18f03a49..b06d5538c 100644 --- a/test/isValidJSON/isValidJSON.js +++ b/test/isValidJSON/isValidJSON.js @@ -6,4 +6,4 @@ return true; return false; } }; - module.exports = isValidJSON \ No newline at end of file +module.exports = isValidJSON \ No newline at end of file diff --git a/test/join/join.js b/test/join/join.js index 0d24968e8..7fc8e49f7 100644 --- a/test/join/join.js +++ b/test/join/join.js @@ -6,4 +6,4 @@ i == arr.length - 2 : i == arr.length - 1 ? acc + val : acc + val + separator, '' ); - module.exports = join \ No newline at end of file +module.exports = join \ No newline at end of file diff --git a/test/last/last.js b/test/last/last.js index 294839092..322078184 100644 --- a/test/last/last.js +++ b/test/last/last.js @@ -1,2 +1,2 @@ const last = arr => arr[arr.length - 1]; - module.exports = last \ No newline at end of file +module.exports = last \ No newline at end of file diff --git a/test/lcm/lcm.js b/test/lcm/lcm.js index fd197ae0c..871e8bdb9 100644 --- a/test/lcm/lcm.js +++ b/test/lcm/lcm.js @@ -3,4 +3,4 @@ const gcd = (x, y) => (!y ? x : gcd(y, x % y)); const _lcm = (x, y) => x * y / gcd(x, y); return [...arr].reduce((a, b) => _lcm(a, b)); }; - module.exports = lcm \ No newline at end of file +module.exports = lcm \ No newline at end of file diff --git a/test/longestItem/longestItem.js b/test/longestItem/longestItem.js index 2df777176..9d1e5c007 100644 --- a/test/longestItem/longestItem.js +++ b/test/longestItem/longestItem.js @@ -1,2 +1,2 @@ const longestItem = (...vals) => [...vals].sort((a, b) => b.length - a.length)[0]; - module.exports = longestItem \ No newline at end of file +module.exports = longestItem \ No newline at end of file diff --git a/test/lowercaseKeys/lowercaseKeys.js b/test/lowercaseKeys/lowercaseKeys.js index 34abc71ff..5fafc126c 100644 --- a/test/lowercaseKeys/lowercaseKeys.js +++ b/test/lowercaseKeys/lowercaseKeys.js @@ -3,4 +3,4 @@ Object.keys(obj).reduce((acc, key) => { acc[key.toLowerCase()] = obj[key]; return acc; }, {}); - module.exports = lowercaseKeys \ No newline at end of file +module.exports = lowercaseKeys \ No newline at end of file diff --git a/test/luhnCheck/luhnCheck.js b/test/luhnCheck/luhnCheck.js index 240a8b0a3..b8742e21d 100644 --- a/test/luhnCheck/luhnCheck.js +++ b/test/luhnCheck/luhnCheck.js @@ -8,4 +8,4 @@ let sum = arr.reduce((acc, val, i) => (i % 2 !== 0 ? acc + val : acc + (val * 2) sum += lastDigit; return sum % 10 === 0; }; - module.exports = luhnCheck \ No newline at end of file +module.exports = luhnCheck \ No newline at end of file diff --git a/test/mapKeys/mapKeys.js b/test/mapKeys/mapKeys.js index 6d53b64c7..a1ca80202 100644 --- a/test/mapKeys/mapKeys.js +++ b/test/mapKeys/mapKeys.js @@ -3,4 +3,4 @@ Object.keys(obj).reduce((acc, k) => { acc[fn(obj[k], k, obj)] = obj[k]; return acc; }, {}); - module.exports = mapKeys \ No newline at end of file +module.exports = mapKeys \ No newline at end of file diff --git a/test/mapObject/mapObject.js b/test/mapObject/mapObject.js index 821847f1b..5bb4603c9 100644 --- a/test/mapObject/mapObject.js +++ b/test/mapObject/mapObject.js @@ -2,4 +2,4 @@ const mapObject = (arr, fn) => (a => ( (a = [arr, arr.map(fn)]), a[0].reduce((acc, val, ind) => ((acc[val] = a[1][ind]), acc), {}) ))(); - module.exports = mapObject \ No newline at end of file +module.exports = mapObject \ No newline at end of file diff --git a/test/mapValues/mapValues.js b/test/mapValues/mapValues.js index bebb7700e..89f62920a 100644 --- a/test/mapValues/mapValues.js +++ b/test/mapValues/mapValues.js @@ -3,4 +3,4 @@ Object.keys(obj).reduce((acc, k) => { acc[k] = fn(obj[k], k, obj); return acc; }, {}); - module.exports = mapValues \ No newline at end of file +module.exports = mapValues \ No newline at end of file diff --git a/test/mask/mask.js b/test/mask/mask.js index fab75a1ea..8f725dea7 100644 --- a/test/mask/mask.js +++ b/test/mask/mask.js @@ -1,3 +1,3 @@ const mask = (cc, num = 4, mask = '*') => ('' + cc).slice(0, -num).replace(/./g, mask) + ('' + cc).slice(-num); - module.exports = mask \ No newline at end of file +module.exports = mask \ No newline at end of file diff --git a/test/matches/matches.js b/test/matches/matches.js index 21412bb9b..4c774e710 100644 --- a/test/matches/matches.js +++ b/test/matches/matches.js @@ -1,3 +1,3 @@ const matches = (obj, source) => Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); - module.exports = matches \ No newline at end of file +module.exports = matches \ No newline at end of file diff --git a/test/matchesWith/matchesWith.js b/test/matchesWith/matchesWith.js index 09b61f457..0b9ae8d96 100644 --- a/test/matchesWith/matchesWith.js +++ b/test/matchesWith/matchesWith.js @@ -5,4 +5,4 @@ obj.hasOwnProperty(key) && fn ? fn(obj[key], source[key], key, obj, source) : obj[key] == source[key] ); - module.exports = matchesWith \ No newline at end of file +module.exports = matchesWith \ No newline at end of file diff --git a/test/maxBy/maxBy.js b/test/maxBy/maxBy.js index 66cbfe8f6..68292b944 100644 --- a/test/maxBy/maxBy.js +++ b/test/maxBy/maxBy.js @@ -1,2 +1,2 @@ const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); - module.exports = maxBy \ No newline at end of file +module.exports = maxBy \ No newline at end of file diff --git a/test/maxN/maxN.js b/test/maxN/maxN.js index d7da949d0..2883c00cc 100644 --- a/test/maxN/maxN.js +++ b/test/maxN/maxN.js @@ -1,2 +1,2 @@ const maxN = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n); - module.exports = maxN \ No newline at end of file +module.exports = maxN \ No newline at end of file diff --git a/test/median/median.js b/test/median/median.js index 59f6c6641..63b0b2bdc 100644 --- a/test/median/median.js +++ b/test/median/median.js @@ -3,4 +3,4 @@ const mid = Math.floor(arr.length / 2), nums = [...arr].sort((a, b) => a - b); return arr.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2; }; - module.exports = median \ No newline at end of file +module.exports = median \ No newline at end of file diff --git a/test/memoize/memoize.js b/test/memoize/memoize.js index 6f7ebc106..f95372c10 100644 --- a/test/memoize/memoize.js +++ b/test/memoize/memoize.js @@ -6,4 +6,4 @@ return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && c cached.cache = cache; return cached; }; - module.exports = memoize \ No newline at end of file +module.exports = memoize \ No newline at end of file diff --git a/test/merge/merge.js b/test/merge/merge.js index bc9774fb4..5a816f96f 100644 --- a/test/merge/merge.js +++ b/test/merge/merge.js @@ -7,4 +7,4 @@ return acc; }, {}), {} ); - module.exports = merge \ No newline at end of file +module.exports = merge \ No newline at end of file diff --git a/test/minBy/minBy.js b/test/minBy/minBy.js index 135bbecb3..c5a3505dd 100644 --- a/test/minBy/minBy.js +++ b/test/minBy/minBy.js @@ -1,2 +1,2 @@ const minBy = (arr, fn) => Math.min(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); - module.exports = minBy \ No newline at end of file +module.exports = minBy \ No newline at end of file diff --git a/test/minN/minN.js b/test/minN/minN.js index 18b052d21..1a6974e9e 100644 --- a/test/minN/minN.js +++ b/test/minN/minN.js @@ -1,2 +1,2 @@ const minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n); - module.exports = minN \ No newline at end of file +module.exports = minN \ No newline at end of file diff --git a/test/negate/negate.js b/test/negate/negate.js index 65a7033e3..228a224f0 100644 --- a/test/negate/negate.js +++ b/test/negate/negate.js @@ -1,2 +1,2 @@ const negate = func => (...args) => !func(...args); - module.exports = negate \ No newline at end of file +module.exports = negate \ No newline at end of file diff --git a/test/nthArg/nthArg.js b/test/nthArg/nthArg.js index 4a2ca5f0a..a43475e8a 100644 --- a/test/nthArg/nthArg.js +++ b/test/nthArg/nthArg.js @@ -1,2 +1,2 @@ const nthArg = n => (...args) => args.slice(n)[0]; - module.exports = nthArg \ No newline at end of file +module.exports = nthArg \ No newline at end of file diff --git a/test/nthElement/nthElement.js b/test/nthElement/nthElement.js index 0fb6ce650..2e88831c1 100644 --- a/test/nthElement/nthElement.js +++ b/test/nthElement/nthElement.js @@ -1,2 +1,2 @@ const nthElement = (arr, n = 0) => (n > 0 ? arr.slice(n, n + 1) : arr.slice(n))[0]; - module.exports = nthElement \ No newline at end of file +module.exports = nthElement \ No newline at end of file diff --git a/test/objectFromPairs/objectFromPairs.js b/test/objectFromPairs/objectFromPairs.js index 2114c882f..a51048410 100644 --- a/test/objectFromPairs/objectFromPairs.js +++ b/test/objectFromPairs/objectFromPairs.js @@ -1,2 +1,2 @@ const objectFromPairs = arr => arr.reduce((a, v) => ((a[v[0]] = v[1]), a), {}); - module.exports = objectFromPairs \ No newline at end of file +module.exports = objectFromPairs \ No newline at end of file diff --git a/test/objectToPairs/objectToPairs.js b/test/objectToPairs/objectToPairs.js index 0f06a0cbe..1f09bf226 100644 --- a/test/objectToPairs/objectToPairs.js +++ b/test/objectToPairs/objectToPairs.js @@ -1,2 +1,2 @@ const objectToPairs = obj => Object.keys(obj).map(k => [k, obj[k]]); - module.exports = objectToPairs \ No newline at end of file +module.exports = objectToPairs \ No newline at end of file diff --git a/test/observeMutations/observeMutations.js b/test/observeMutations/observeMutations.js index 065f7fff3..ab05e3fef 100644 --- a/test/observeMutations/observeMutations.js +++ b/test/observeMutations/observeMutations.js @@ -16,4 +16,4 @@ options ); return observer; }; - module.exports = observeMutations \ No newline at end of file +module.exports = observeMutations \ No newline at end of file diff --git a/test/off/off.js b/test/off/off.js index 94c2aa43d..fb19a0434 100644 --- a/test/off/off.js +++ b/test/off/off.js @@ -1,2 +1,2 @@ const off = (el, evt, fn, opts = false) => el.removeEventListener(evt, fn, opts); - module.exports = off \ No newline at end of file +module.exports = off \ No newline at end of file diff --git a/test/omit/omit.js b/test/omit/omit.js index 9c695ba28..3963ed455 100644 --- a/test/omit/omit.js +++ b/test/omit/omit.js @@ -2,4 +2,4 @@ const omit = (obj, arr) => Object.keys(obj) .filter(k => !arr.includes(k)) .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); - module.exports = omit \ No newline at end of file +module.exports = omit \ No newline at end of file diff --git a/test/omitBy/omitBy.js b/test/omitBy/omitBy.js index d3cbc009a..3beabf15d 100644 --- a/test/omitBy/omitBy.js +++ b/test/omitBy/omitBy.js @@ -2,4 +2,4 @@ const omitBy = (obj, fn) => Object.keys(obj) .filter(k => !fn(obj[k], k)) .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); - module.exports = omitBy \ No newline at end of file +module.exports = omitBy \ No newline at end of file diff --git a/test/on/on.js b/test/on/on.js index 12c958ab5..a8f53f65c 100644 --- a/test/on/on.js +++ b/test/on/on.js @@ -3,4 +3,4 @@ const delegatorFn = e => e.target.matches(opts.target) && fn.call(e.target, e); el.addEventListener(evt, opts.target ? delegatorFn : fn, opts.options || false); if (opts.target) return delegatorFn; }; - module.exports = on \ No newline at end of file +module.exports = on \ No newline at end of file diff --git a/test/onUserInputChange/onUserInputChange.js b/test/onUserInputChange/onUserInputChange.js index 13cd2b44f..1850c9dec 100644 --- a/test/onUserInputChange/onUserInputChange.js +++ b/test/onUserInputChange/onUserInputChange.js @@ -12,4 +12,4 @@ if (type === 'touch') return; (type = 'touch'), callback(type), document.addEventListener('mousemove', mousemoveHandler); }); }; - module.exports = onUserInputChange \ No newline at end of file +module.exports = onUserInputChange \ No newline at end of file diff --git a/test/once/once.js b/test/once/once.js index 36225aa17..35f512e35 100644 --- a/test/once/once.js +++ b/test/once/once.js @@ -6,4 +6,4 @@ called = true; return fn.apply(this, args); }; }; - module.exports = once \ No newline at end of file +module.exports = once \ No newline at end of file diff --git a/test/orderBy/orderBy.js b/test/orderBy/orderBy.js index e7db465e5..ae7f113c7 100644 --- a/test/orderBy/orderBy.js +++ b/test/orderBy/orderBy.js @@ -8,4 +8,4 @@ acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0; return acc; }, 0) ); - module.exports = orderBy \ No newline at end of file +module.exports = orderBy \ No newline at end of file diff --git a/test/over/over.js b/test/over/over.js index 557bbd8d3..5a972c2f7 100644 --- a/test/over/over.js +++ b/test/over/over.js @@ -1,2 +1,2 @@ const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args)); - module.exports = over \ No newline at end of file +module.exports = over \ No newline at end of file diff --git a/test/palindrome/palindrome.js b/test/palindrome/palindrome.js index 59557dcd3..1b17b4023 100644 --- a/test/palindrome/palindrome.js +++ b/test/palindrome/palindrome.js @@ -8,4 +8,4 @@ s .join('') ); }; - module.exports = palindrome \ No newline at end of file +module.exports = palindrome \ No newline at end of file diff --git a/test/parseCookie/parseCookie.js b/test/parseCookie/parseCookie.js index 20dcb1039..63656448c 100644 --- a/test/parseCookie/parseCookie.js +++ b/test/parseCookie/parseCookie.js @@ -6,4 +6,4 @@ str acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); return acc; }, {}); - module.exports = parseCookie \ No newline at end of file +module.exports = parseCookie \ No newline at end of file diff --git a/test/partition/partition.js b/test/partition/partition.js index 9acd0309f..3e03d4e52 100644 --- a/test/partition/partition.js +++ b/test/partition/partition.js @@ -6,4 +6,4 @@ return acc; }, [[], []] ); - module.exports = partition \ No newline at end of file +module.exports = partition \ No newline at end of file diff --git a/test/percentile/percentile.js b/test/percentile/percentile.js index b345bb0d8..45e69c0a6 100644 --- a/test/percentile/percentile.js +++ b/test/percentile/percentile.js @@ -1,3 +1,3 @@ const percentile = (arr, val) => 100 * arr.reduce((acc, v) => acc + (v < val ? 1 : 0) + (v === val ? 0.5 : 0), 0) / arr.length; - module.exports = percentile \ No newline at end of file +module.exports = percentile \ No newline at end of file diff --git a/test/pick/pick.js b/test/pick/pick.js index 465a5373a..649a25a9b 100644 --- a/test/pick/pick.js +++ b/test/pick/pick.js @@ -1,3 +1,3 @@ const pick = (obj, arr) => arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); - module.exports = pick \ No newline at end of file +module.exports = pick \ No newline at end of file diff --git a/test/pickBy/pickBy.js b/test/pickBy/pickBy.js index 8ecc72551..f8671e0bb 100644 --- a/test/pickBy/pickBy.js +++ b/test/pickBy/pickBy.js @@ -2,4 +2,4 @@ const pickBy = (obj, fn) => Object.keys(obj) .filter(k => fn(obj[k], k)) .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); - module.exports = pickBy \ No newline at end of file +module.exports = pickBy \ No newline at end of file diff --git a/test/pipeFunctions/pipeFunctions.js b/test/pipeFunctions/pipeFunctions.js index ea4ac5fb1..46b2ec419 100644 --- a/test/pipeFunctions/pipeFunctions.js +++ b/test/pipeFunctions/pipeFunctions.js @@ -1,2 +1,2 @@ const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); - module.exports = pipeFunctions \ No newline at end of file +module.exports = pipeFunctions \ No newline at end of file diff --git a/test/pluralize/pluralize.js b/test/pluralize/pluralize.js index df86b72dd..7e1c477c9 100644 --- a/test/pluralize/pluralize.js +++ b/test/pluralize/pluralize.js @@ -4,4 +4,4 @@ const _pluralize = (num, word, plural = word + 's') => if (typeof val === 'object') return (num, word) => _pluralize(num, word, val[word]); return _pluralize(val, word, plural); }; - module.exports = pluralize \ No newline at end of file +module.exports = pluralize \ No newline at end of file diff --git a/test/powerset/powerset.js b/test/powerset/powerset.js index 0e71c52b1..0804d4c0b 100644 --- a/test/powerset/powerset.js +++ b/test/powerset/powerset.js @@ -1,2 +1,2 @@ const powerset = arr => arr.reduce((a, v) => a.concat(a.map(r => [v].concat(r))), [[]]); - module.exports = powerset \ No newline at end of file +module.exports = powerset \ No newline at end of file diff --git a/test/prettyBytes/prettyBytes.js b/test/prettyBytes/prettyBytes.js index dc5d0a5a1..110b723ce 100644 --- a/test/prettyBytes/prettyBytes.js +++ b/test/prettyBytes/prettyBytes.js @@ -5,4 +5,4 @@ const exponent = Math.min(Math.floor(Math.log10(num < 0 ? -num : num) / 3), UNIT const n = Number(((num < 0 ? -num : num) / 1000 ** exponent).toPrecision(precision)); return (num < 0 ? '-' : '') + n + (addSpace ? ' ' : '') + UNITS[exponent]; }; - module.exports = prettyBytes \ No newline at end of file +module.exports = prettyBytes \ No newline at end of file diff --git a/test/primes/primes.js b/test/primes/primes.js index 3ac251eed..a7a67a86a 100644 --- a/test/primes/primes.js +++ b/test/primes/primes.js @@ -5,4 +5,4 @@ numsTillSqroot = Array.from({ length: sqroot - 1 }).map((x, i) => i + 2); numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y == x))); return arr; }; - module.exports = primes \ No newline at end of file +module.exports = primes \ No newline at end of file diff --git a/test/promisify/promisify.js b/test/promisify/promisify.js index a642e309e..c41f99772 100644 --- a/test/promisify/promisify.js +++ b/test/promisify/promisify.js @@ -2,4 +2,4 @@ const promisify = func => (...args) => new Promise((resolve, reject) => func(...args, (err, result) => (err ? reject(err) : resolve(result))) ); - module.exports = promisify \ No newline at end of file +module.exports = promisify \ No newline at end of file diff --git a/test/pull/pull.js b/test/pull/pull.js index 08e191399..3b526fd6a 100644 --- a/test/pull/pull.js +++ b/test/pull/pull.js @@ -4,4 +4,4 @@ let pulled = arr.filter((v, i) => !argState.includes(v)); arr.length = 0; pulled.forEach(v => arr.push(v)); }; - module.exports = pull \ No newline at end of file +module.exports = pull \ No newline at end of file diff --git a/test/pullAtIndex/pullAtIndex.js b/test/pullAtIndex/pullAtIndex.js index 965071754..f85941a9b 100644 --- a/test/pullAtIndex/pullAtIndex.js +++ b/test/pullAtIndex/pullAtIndex.js @@ -7,4 +7,4 @@ arr.length = 0; pulled.forEach(v => arr.push(v)); return removed; }; - module.exports = pullAtIndex \ No newline at end of file +module.exports = pullAtIndex \ No newline at end of file diff --git a/test/pullAtValue/pullAtValue.js b/test/pullAtValue/pullAtValue.js index db317da51..5750b4b82 100644 --- a/test/pullAtValue/pullAtValue.js +++ b/test/pullAtValue/pullAtValue.js @@ -6,4 +6,4 @@ arr.length = 0; mutateTo.forEach(v => arr.push(v)); return removed; }; - module.exports = pullAtValue \ No newline at end of file +module.exports = pullAtValue \ No newline at end of file diff --git a/test/quickSort/quickSort.js b/test/quickSort/quickSort.js index 06075d924..3b17b2f89 100644 --- a/test/quickSort/quickSort.js +++ b/test/quickSort/quickSort.js @@ -6,4 +6,4 @@ isNaN(n) n, ...quickSort(nums.filter(v => (!desc ? v > n : v <= n)), desc) ]; - module.exports = quickSort \ No newline at end of file +module.exports = quickSort \ No newline at end of file diff --git a/test/randomHexColorCode/randomHexColorCode.js b/test/randomHexColorCode/randomHexColorCode.js index ae49ab185..4ff05e1f9 100644 --- a/test/randomHexColorCode/randomHexColorCode.js +++ b/test/randomHexColorCode/randomHexColorCode.js @@ -2,4 +2,4 @@ const randomHexColorCode = () => { let n = ((Math.random() * 0xfffff) | 0).toString(16); return '#' + (n.length !== 6 ? ((Math.random() * 0xf) | 0).toString(16) + n : n); }; - module.exports = randomHexColorCode \ No newline at end of file +module.exports = randomHexColorCode \ No newline at end of file diff --git a/test/randomIntArrayInRange/randomIntArrayInRange.js b/test/randomIntArrayInRange/randomIntArrayInRange.js index 74c999acc..8136f6f4c 100644 --- a/test/randomIntArrayInRange/randomIntArrayInRange.js +++ b/test/randomIntArrayInRange/randomIntArrayInRange.js @@ -1,3 +1,3 @@ const randomIntArrayInRange = (min, max, n = 1) => Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min); - module.exports = randomIntArrayInRange \ No newline at end of file +module.exports = randomIntArrayInRange \ No newline at end of file diff --git a/test/randomIntegerInRange/randomIntegerInRange.js b/test/randomIntegerInRange/randomIntegerInRange.js index 7c6ad38db..2031f2c76 100644 --- a/test/randomIntegerInRange/randomIntegerInRange.js +++ b/test/randomIntegerInRange/randomIntegerInRange.js @@ -1,2 +1,2 @@ const randomIntegerInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; - module.exports = randomIntegerInRange \ No newline at end of file +module.exports = randomIntegerInRange \ No newline at end of file diff --git a/test/randomNumberInRange/randomNumberInRange.js b/test/randomNumberInRange/randomNumberInRange.js index 15a6d3169..db50d7486 100644 --- a/test/randomNumberInRange/randomNumberInRange.js +++ b/test/randomNumberInRange/randomNumberInRange.js @@ -1,2 +1,2 @@ const randomNumberInRange = (min, max) => Math.random() * (max - min) + min; - module.exports = randomNumberInRange \ No newline at end of file +module.exports = randomNumberInRange \ No newline at end of file diff --git a/test/readFileLines/readFileLines.js b/test/readFileLines/readFileLines.js index 8e7db19aa..fc286c8eb 100644 --- a/test/readFileLines/readFileLines.js +++ b/test/readFileLines/readFileLines.js @@ -4,4 +4,4 @@ fs .readFileSync(filename) .toString('UTF8') .split('\n'); - module.exports = readFileLines \ No newline at end of file +module.exports = readFileLines \ No newline at end of file diff --git a/test/redirect/redirect.js b/test/redirect/redirect.js index f7cecfd2b..7959a5f01 100644 --- a/test/redirect/redirect.js +++ b/test/redirect/redirect.js @@ -1,3 +1,3 @@ const redirect = (url, asLink = true) => asLink ? (window.location.href = url) : window.location.replace(url); - module.exports = redirect \ No newline at end of file +module.exports = redirect \ No newline at end of file diff --git a/test/reducedFilter/reducedFilter.js b/test/reducedFilter/reducedFilter.js index 778c6179f..6e4662f37 100644 --- a/test/reducedFilter/reducedFilter.js +++ b/test/reducedFilter/reducedFilter.js @@ -5,4 +5,4 @@ acc[key] = el[key]; return acc; }, {}) ); - module.exports = reducedFilter \ No newline at end of file +module.exports = reducedFilter \ No newline at end of file diff --git a/test/remove/remove.js b/test/remove/remove.js index 75afb01bc..9132f4290 100644 --- a/test/remove/remove.js +++ b/test/remove/remove.js @@ -5,4 +5,4 @@ arr.splice(arr.indexOf(val), 1); return acc.concat(val); }, []) : []; - module.exports = remove \ No newline at end of file +module.exports = remove \ No newline at end of file diff --git a/test/removeVowels/removeVowels.js b/test/removeVowels/removeVowels.js index 770f01b90..8f9fd62bf 100644 --- a/test/removeVowels/removeVowels.js +++ b/test/removeVowels/removeVowels.js @@ -1,2 +1,2 @@ const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi,repl); - module.exports = removeVowels \ No newline at end of file +module.exports = removeVowels \ No newline at end of file diff --git a/test/reverseString/reverseString.js b/test/reverseString/reverseString.js index b5abbf1d5..1b98ef6c1 100644 --- a/test/reverseString/reverseString.js +++ b/test/reverseString/reverseString.js @@ -1,2 +1,2 @@ const reverseString = str => [...str].reverse().join(''); - module.exports = reverseString \ No newline at end of file +module.exports = reverseString \ No newline at end of file diff --git a/test/round/round.js b/test/round/round.js index 778e00441..2f86eb4d9 100644 --- a/test/round/round.js +++ b/test/round/round.js @@ -1,2 +1,2 @@ const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`); - module.exports = round \ No newline at end of file +module.exports = round \ No newline at end of file diff --git a/test/runAsync/runAsync.js b/test/runAsync/runAsync.js index 1778fde70..c5cc4c1a3 100644 --- a/test/runAsync/runAsync.js +++ b/test/runAsync/runAsync.js @@ -14,4 +14,4 @@ rej(err), worker.terminate(); }; }); }; - module.exports = runAsync \ No newline at end of file +module.exports = runAsync \ No newline at end of file diff --git a/test/runPromisesInSeries/runPromisesInSeries.js b/test/runPromisesInSeries/runPromisesInSeries.js index ced59e23e..8ce9536f2 100644 --- a/test/runPromisesInSeries/runPromisesInSeries.js +++ b/test/runPromisesInSeries/runPromisesInSeries.js @@ -1,2 +1,2 @@ const runPromisesInSeries = ps => ps.reduce((p, next) => p.then(next), Promise.resolve()); - module.exports = runPromisesInSeries \ No newline at end of file +module.exports = runPromisesInSeries \ No newline at end of file diff --git a/test/sample/sample.js b/test/sample/sample.js index 992949efe..b230d5b89 100644 --- a/test/sample/sample.js +++ b/test/sample/sample.js @@ -1,2 +1,2 @@ const sample = arr => arr[Math.floor(Math.random() * arr.length)]; - module.exports = sample \ No newline at end of file +module.exports = sample \ No newline at end of file diff --git a/test/sampleSize/sampleSize.js b/test/sampleSize/sampleSize.js index 231810f54..dba6acd68 100644 --- a/test/sampleSize/sampleSize.js +++ b/test/sampleSize/sampleSize.js @@ -6,4 +6,4 @@ const i = Math.floor(Math.random() * m--); } return arr.slice(0, n); }; - module.exports = sampleSize \ No newline at end of file +module.exports = sampleSize \ No newline at end of file diff --git a/test/scrollToTop/scrollToTop.js b/test/scrollToTop/scrollToTop.js index d45b2a44e..b99155274 100644 --- a/test/scrollToTop/scrollToTop.js +++ b/test/scrollToTop/scrollToTop.js @@ -5,4 +5,4 @@ window.requestAnimationFrame(scrollToTop); window.scrollTo(0, c - c / 8); } }; - module.exports = scrollToTop \ No newline at end of file +module.exports = scrollToTop \ No newline at end of file diff --git a/test/sdbm/sdbm.js b/test/sdbm/sdbm.js index ff9012a7f..43f750617 100644 --- a/test/sdbm/sdbm.js +++ b/test/sdbm/sdbm.js @@ -6,4 +6,4 @@ return arr.reduce( 0 ); }; - module.exports = sdbm \ No newline at end of file +module.exports = sdbm \ No newline at end of file diff --git a/test/serializeCookie/serializeCookie.js b/test/serializeCookie/serializeCookie.js index ed4f462a7..62c174699 100644 --- a/test/serializeCookie/serializeCookie.js +++ b/test/serializeCookie/serializeCookie.js @@ -1,2 +1,2 @@ const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`; - module.exports = serializeCookie \ No newline at end of file +module.exports = serializeCookie \ No newline at end of file diff --git a/test/setStyle/setStyle.js b/test/setStyle/setStyle.js index 71db449eb..49574a009 100644 --- a/test/setStyle/setStyle.js +++ b/test/setStyle/setStyle.js @@ -1,2 +1,2 @@ const setStyle = (el, ruleName, val) => (el.style[ruleName] = val); - module.exports = setStyle \ No newline at end of file +module.exports = setStyle \ No newline at end of file diff --git a/test/shallowClone/shallowClone.js b/test/shallowClone/shallowClone.js index 8247d3f8e..a502e8a17 100644 --- a/test/shallowClone/shallowClone.js +++ b/test/shallowClone/shallowClone.js @@ -1,2 +1,2 @@ const shallowClone = obj => Object.assign({}, obj); - module.exports = shallowClone \ No newline at end of file +module.exports = shallowClone \ No newline at end of file diff --git a/test/show/show.js b/test/show/show.js index db22eab4f..f48b74226 100644 --- a/test/show/show.js +++ b/test/show/show.js @@ -1,2 +1,2 @@ const show = (...el) => [...el].forEach(e => (e.style.display = '')); - module.exports = show \ No newline at end of file +module.exports = show \ No newline at end of file diff --git a/test/shuffle/shuffle.js b/test/shuffle/shuffle.js index d2d3980ee..6f17df997 100644 --- a/test/shuffle/shuffle.js +++ b/test/shuffle/shuffle.js @@ -6,4 +6,4 @@ const i = Math.floor(Math.random() * m--); } return arr; }; - module.exports = shuffle \ No newline at end of file +module.exports = shuffle \ No newline at end of file diff --git a/test/similarity/similarity.js b/test/similarity/similarity.js index 3a3cc41e5..e1c53bfa6 100644 --- a/test/similarity/similarity.js +++ b/test/similarity/similarity.js @@ -1,2 +1,2 @@ const similarity = (arr, values) => arr.filter(v => values.includes(v)); - module.exports = similarity \ No newline at end of file +module.exports = similarity \ No newline at end of file diff --git a/test/size/size.js b/test/size/size.js index 639c8351f..55bb37d0d 100644 --- a/test/size/size.js +++ b/test/size/size.js @@ -4,4 +4,4 @@ Array.isArray(val) : val && typeof val === 'object' ? val.size || val.length || Object.keys(val).length : typeof val === 'string' ? new Blob([val]).size : 0; - module.exports = size \ No newline at end of file +module.exports = size \ No newline at end of file diff --git a/test/sleep/sleep.js b/test/sleep/sleep.js index 4cfc9e189..ac53ad307 100644 --- a/test/sleep/sleep.js +++ b/test/sleep/sleep.js @@ -1,2 +1,2 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); - module.exports = sleep \ No newline at end of file +module.exports = sleep \ No newline at end of file diff --git a/test/solveRPN/solveRPN.js b/test/solveRPN/solveRPN.js index 43e3d509a..57e7ecc41 100644 --- a/test/solveRPN/solveRPN.js +++ b/test/solveRPN/solveRPN.js @@ -26,4 +26,4 @@ throw `${symbol} is not a recognized symbol`; if (stack.length === 1) return stack.pop(); else throw `${rpn} is not a proper RPN. Please check it and try again`; }; - module.exports = solveRPN \ No newline at end of file +module.exports = solveRPN \ No newline at end of file diff --git a/test/sortCharactersInString/sortCharactersInString.js b/test/sortCharactersInString/sortCharactersInString.js index 74e6f2811..b8bcbef82 100644 --- a/test/sortCharactersInString/sortCharactersInString.js +++ b/test/sortCharactersInString/sortCharactersInString.js @@ -1,2 +1,2 @@ const sortCharactersInString = str => [...str].sort((a, b) => a.localeCompare(b)).join(''); - module.exports = sortCharactersInString \ No newline at end of file +module.exports = sortCharactersInString \ No newline at end of file diff --git a/test/sortedIndex/sortedIndex.js b/test/sortedIndex/sortedIndex.js index b4eb24061..c181d53ca 100644 --- a/test/sortedIndex/sortedIndex.js +++ b/test/sortedIndex/sortedIndex.js @@ -3,4 +3,4 @@ const isDescending = arr[0] > arr[arr.length - 1]; const index = arr.findIndex(el => (isDescending ? n >= el : n <= el)); return index === -1 ? arr.length : index; }; - module.exports = sortedIndex \ No newline at end of file +module.exports = sortedIndex \ No newline at end of file diff --git a/test/sortedLastIndex/sortedLastIndex.js b/test/sortedLastIndex/sortedLastIndex.js new file mode 100644 index 000000000..eaee796a5 --- /dev/null +++ b/test/sortedLastIndex/sortedLastIndex.js @@ -0,0 +1,9 @@ +const sortedLastIndex = (arr, n) => { +const isDescending = arr[0] > arr[arr.length - 1]; +const index = arr +.map((val, i) => [i, val]) +.filter(el => (isDescending ? n >= el[1] : n >= el[1])) +.slice(-1)[0][0]; +return index === -1 ? arr.length : index; +}; +module.exports = sortedLastIndex \ No newline at end of file diff --git a/test/sortedLastIndex/sortedLastIndex.test.js b/test/sortedLastIndex/sortedLastIndex.test.js new file mode 100644 index 000000000..daad01738 --- /dev/null +++ b/test/sortedLastIndex/sortedLastIndex.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sortedLastIndex = require('./sortedLastIndex.js'); + +test('Testing sortedLastIndex', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sortedLastIndex === 'function', 'sortedLastIndex is a Function'); + //t.deepEqual(sortedLastIndex(args..), 'Expected'); + //t.equal(sortedLastIndex(args..), 'Expected'); + //t.false(sortedLastIndex(args..), 'Expected'); + //t.throws(sortedLastIndex(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/speechSynthesis/speechSynthesis.js b/test/speechSynthesis/speechSynthesis.js index eff6d4ce7..633cb5e41 100644 --- a/test/speechSynthesis/speechSynthesis.js +++ b/test/speechSynthesis/speechSynthesis.js @@ -3,4 +3,4 @@ const msg = new SpeechSynthesisUtterance(message); msg.voice = window.speechSynthesis.getVoices()[0]; window.speechSynthesis.speak(msg); }; - module.exports = speechSynthesis \ No newline at end of file +module.exports = speechSynthesis \ No newline at end of file diff --git a/test/splitLines/splitLines.js b/test/splitLines/splitLines.js index b112b6e0f..2d675dbc6 100644 --- a/test/splitLines/splitLines.js +++ b/test/splitLines/splitLines.js @@ -1,2 +1,2 @@ const splitLines = str => str.split(/\r?\n/); - module.exports = splitLines \ No newline at end of file +module.exports = splitLines \ No newline at end of file diff --git a/test/spreadOver/spreadOver.js b/test/spreadOver/spreadOver.js index 0048bff7f..5f2274140 100644 --- a/test/spreadOver/spreadOver.js +++ b/test/spreadOver/spreadOver.js @@ -1,2 +1,2 @@ const spreadOver = fn => argsArr => fn(...argsArr); - module.exports = spreadOver \ No newline at end of file +module.exports = spreadOver \ No newline at end of file diff --git a/test/standardDeviation/standardDeviation.js b/test/standardDeviation/standardDeviation.js index e9a033e68..249125b88 100644 --- a/test/standardDeviation/standardDeviation.js +++ b/test/standardDeviation/standardDeviation.js @@ -5,4 +5,4 @@ arr.reduce((acc, val) => acc.concat((val - mean) ** 2), []).reduce((acc, val) => (arr.length - (usePopulation ? 0 : 1)) ); }; - module.exports = standardDeviation \ No newline at end of file +module.exports = standardDeviation \ No newline at end of file diff --git a/test/sum/sum.js b/test/sum/sum.js index 22db1d186..27ba3fe25 100644 --- a/test/sum/sum.js +++ b/test/sum/sum.js @@ -1,2 +1,2 @@ const sum = (...arr) => [...arr].reduce((acc, val) => acc + val, 0); - module.exports = sum \ No newline at end of file +module.exports = sum \ No newline at end of file diff --git a/test/sumBy/sumBy.js b/test/sumBy/sumBy.js index 4c499baf5..c78200a47 100644 --- a/test/sumBy/sumBy.js +++ b/test/sumBy/sumBy.js @@ -1,3 +1,3 @@ const sumBy = (arr, fn) => arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0); - module.exports = sumBy \ No newline at end of file +module.exports = sumBy \ No newline at end of file diff --git a/test/sumPower/sumPower.js b/test/sumPower/sumPower.js index 51b80ab57..a739bad0c 100644 --- a/test/sumPower/sumPower.js +++ b/test/sumPower/sumPower.js @@ -3,4 +3,4 @@ Array(end + 1 - start) .fill(0) .map((x, i) => (i + start) ** power) .reduce((a, b) => a + b, 0); - module.exports = sumPower \ No newline at end of file +module.exports = sumPower \ No newline at end of file diff --git a/test/symmetricDifference/symmetricDifference.js b/test/symmetricDifference/symmetricDifference.js index 862698500..5f2f4fe9a 100644 --- a/test/symmetricDifference/symmetricDifference.js +++ b/test/symmetricDifference/symmetricDifference.js @@ -3,4 +3,4 @@ const sA = new Set(a), sB = new Set(b); return [...a.filter(x => !sB.has(x)), ...b.filter(x => !sA.has(x))]; }; - module.exports = symmetricDifference \ No newline at end of file +module.exports = symmetricDifference \ No newline at end of file diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.js new file mode 100644 index 000000000..5ffe62578 --- /dev/null +++ b/test/symmetricDifferenceBy/symmetricDifferenceBy.js @@ -0,0 +1,6 @@ +const symmetricDifferenceBy = (a, b, fn) => { +const sA = new Set(a.map(v => fn(v))), +sB = new Set(b.map(v => fn(v))); +return [...a.filter(x => !sB.has(fn(x))), ...b.filter(x => !sA.has(fn(x)))]; +}; +module.exports = symmetricDifferenceBy \ No newline at end of file diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js new file mode 100644 index 000000000..ef7eb6a0e --- /dev/null +++ b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const symmetricDifferenceBy = require('./symmetricDifferenceBy.js'); + +test('Testing symmetricDifferenceBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof symmetricDifferenceBy === 'function', 'symmetricDifferenceBy is a Function'); + //t.deepEqual(symmetricDifferenceBy(args..), 'Expected'); + //t.equal(symmetricDifferenceBy(args..), 'Expected'); + //t.false(symmetricDifferenceBy(args..), 'Expected'); + //t.throws(symmetricDifferenceBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/symmetricDifferenceWith/symmetricDifferenceWith.js b/test/symmetricDifferenceWith/symmetricDifferenceWith.js new file mode 100644 index 000000000..0f58ea86a --- /dev/null +++ b/test/symmetricDifferenceWith/symmetricDifferenceWith.js @@ -0,0 +1,5 @@ +const symmetricDifferenceWith = (arr, val, comp) => [ +...arr.filter(a => val.findIndex(b => comp(a, b)) === -1), +...val.filter(a => arr.findIndex(b => comp(a, b)) === -1) +]; +module.exports = symmetricDifferenceWith \ No newline at end of file diff --git a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js b/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js new file mode 100644 index 000000000..bad9c3621 --- /dev/null +++ b/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const symmetricDifferenceWith = require('./symmetricDifferenceWith.js'); + +test('Testing symmetricDifferenceWith', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof symmetricDifferenceWith === 'function', 'symmetricDifferenceWith is a Function'); + //t.deepEqual(symmetricDifferenceWith(args..), 'Expected'); + //t.equal(symmetricDifferenceWith(args..), 'Expected'); + //t.false(symmetricDifferenceWith(args..), 'Expected'); + //t.throws(symmetricDifferenceWith(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/tail/tail.js b/test/tail/tail.js index 4a32f24a3..a13eb8836 100644 --- a/test/tail/tail.js +++ b/test/tail/tail.js @@ -1,2 +1,2 @@ const tail = arr => (arr.length > 1 ? arr.slice(1) : arr); - module.exports = tail \ No newline at end of file +module.exports = tail \ No newline at end of file diff --git a/test/take/take.js b/test/take/take.js index a5b82b446..4bb5d6a19 100644 --- a/test/take/take.js +++ b/test/take/take.js @@ -1,2 +1,2 @@ const take = (arr, n = 1) => arr.slice(0, n); - module.exports = take \ No newline at end of file +module.exports = take \ No newline at end of file diff --git a/test/takeRight/takeRight.js b/test/takeRight/takeRight.js index b5bcef3d6..14bf346c8 100644 --- a/test/takeRight/takeRight.js +++ b/test/takeRight/takeRight.js @@ -1,2 +1,2 @@ const takeRight = (arr, n = 1) => arr.slice(arr.length - n, arr.length); - module.exports = takeRight \ No newline at end of file +module.exports = takeRight \ No newline at end of file diff --git a/test/testlog b/test/testlog index a393f7a85..3ea9fa418 100644 --- a/test/testlog +++ b/test/testlog @@ -1,1354 +1,1401 @@ -Test log for: Tue Jan 23 2018 20:11:47 GMT+0000 (UTC) +Test log for: Wed Jan 24 2018 06:26:20 GMT-0500 (Eastern Standard Time) -> 30-seconds-of-code@0.0.1 test /home/travis/build/Chalarangelo/30-seconds-of-code +> 30-seconds-of-code@0.0.1 test C:\Users\King David\Desktop\github-repo\30-seconds-of-code > tape test/**/*.test.js | tap-spec - Testing JSONToDate - - ✔ JSONToDate is a Function - - Testing JSONToFile - - ✔ JSONToFile is a Function - - Testing README - - ✔ README is a Function - - Testing RGBToHex - - ✔ RGBToHex is a Function - ✔ Converts the values of RGB components to a color code. - - Testing URLJoin - - ✔ URLJoin is a Function - ✔ Returns proper URL - ✔ Returns proper URL - - Testing UUIDGeneratorBrowser - - ✔ UUIDGeneratorBrowser is a Function - - Testing UUIDGeneratorNode - - ✔ UUIDGeneratorNode is a Function - Testing anagrams - ✔ anagrams is a Function - ✔ Generates all anagrams of a string + √ anagrams is a Function + √ Generates all anagrams of a string Testing arrayToHtmlList - ✔ arrayToHtmlList is a Function + √ arrayToHtmlList is a Function Testing atob - ✔ atob is a Function + √ atob is a Function Testing average - ✔ average is a Function - ✔ average(true) returns 0 - ✔ average(false) returns 1 - ✔ average(9, 1) returns 5 - ✔ average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 - ✔ average(1, 2, 3) returns 2 - ✔ average(null) returns 0 - ✔ average(1, 2, 3) returns NaN - ✔ average(String) returns NaN - ✔ average({ a: 123}) returns NaN - ✔ average([undefined, 0, string]) returns NaN - ✔ head([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run + √ average is a Function + √ average(true) returns 0 + √ average(false) returns 1 + √ average(9, 1) returns 5 + √ average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 + √ average(1, 2, 3) returns 2 + √ average(null) returns 0 + √ average(1, 2, 3) returns NaN + √ average(String) returns NaN + √ average({ a: 123}) returns NaN + √ average([undefined, 0, string]) returns NaN + √ head([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run Testing averageBy - ✔ averageBy is a Function + √ averageBy is a Function Testing binarySearch - ✔ binarySearch is a Function + √ binarySearch is a Function Testing bottomVisible - ✔ bottomVisible is a Function + √ bottomVisible is a Function Testing btoa - ✔ btoa is a Function + √ btoa is a Function Testing byteSize - ✔ byteSize is a Function + √ byteSize is a Function Testing call - ✔ call is a Function + √ call is a Function Testing capitalize - ✔ capitalize is a Function - ✔ Capitalizes the first letter of a string - ✔ Capitalizes the first letter of a string + √ capitalize is a Function + √ Capitalizes the first letter of a string + √ Capitalizes the first letter of a string Testing capitalizeEveryWord - ✔ capitalizeEveryWord is a Function - ✔ Capitalizes the first letter of every word in a string + √ capitalizeEveryWord is a Function + √ Capitalizes the first letter of every word in a string Testing castArray - ✔ castArray is a Function + √ castArray is a Function Testing chainAsync - ✔ chainAsync is a Function + √ chainAsync is a Function Testing chunk - ✔ chunk is a Function - ✔ chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] - ✔ chunk([]) returns [] - ✔ chunk(123) returns [] - ✔ chunk({ a: 123}) returns [] - ✔ chunk(string, 2) returns [ st, ri, ng ] - ✔ chunk() throws an error - ✔ chunk(undefined) throws an error - ✔ chunk(null) throws an error - ✔ chunk(This is a string, 2) takes less than 2s to run + √ chunk is a Function + √ chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] + √ chunk([]) returns [] + √ chunk(123) returns [] + √ chunk({ a: 123}) returns [] + √ chunk(string, 2) returns [ st, ri, ng ] + √ chunk() throws an error + √ chunk(undefined) throws an error + √ chunk(null) throws an error + √ chunk(This is a string, 2) takes less than 2s to run Testing clampNumber - ✔ clampNumber is a Function - ✔ Clamps num within the inclusive range specified by the boundary values a and b + √ clampNumber is a Function + √ Clamps num within the inclusive range specified by the boundary values a and b Testing cleanObj - ✔ cleanObj is a Function - ✔ Removes any properties except the ones specified from a JSON object + √ cleanObj is a Function + √ Removes any properties except the ones specified from a JSON object Testing cloneRegExp - ✔ cloneRegExp is a Function + √ cloneRegExp is a Function Testing coalesce - ✔ coalesce is a Function - ✔ Returns the first non-null/undefined argument + √ coalesce is a Function + √ Returns the first non-null/undefined argument Testing coalesceFactory - ✔ coalesceFactory is a Function - ✔ Returns a customized coalesce function + √ coalesceFactory is a Function + √ Returns a customized coalesce function Testing collatz - ✔ collatz is a Function + √ collatz is a Function Testing collectInto - ✔ collectInto is a Function + √ collectInto is a Function Testing colorize - ✔ colorize is a Function + √ colorize is a Function Testing compact - ✔ compact is a Function - ✔ Removes falsey values from an array + √ compact is a Function + √ Removes falsey values from an array Testing compose - ✔ compose is a Function - ✔ Performs right-to-left function composition + √ compose is a Function + √ Performs right-to-left function composition + + Testing composeRight + + √ composeRight is a Function Testing copyToClipboard - ✔ copyToClipboard is a Function + √ copyToClipboard is a Function Testing countBy - ✔ countBy is a Function + √ countBy is a Function Testing countOccurrences - ✔ countOccurrences is a Function - ✔ Counts the occurrences of a value in an array + √ countOccurrences is a Function + √ Counts the occurrences of a value in an array Testing countVowels - ✔ countVowels is a Function + √ countVowels is a Function Testing createElement - ✔ createElement is a Function + √ createElement is a Function Testing createEventHub - ✔ createEventHub is a Function + √ createEventHub is a Function Testing currentURL - ✔ currentURL is a Function + √ currentURL is a Function Testing curry - ✔ curry is a Function - ✔ curries a Math.pow - ✔ curries a Math.min + √ curry is a Function + √ curries a Math.pow + √ curries a Math.min Testing decapitalize - ✔ decapitalize is a Function + √ decapitalize is a Function Testing deepClone - ✔ deepClone is a Function + √ deepClone is a Function Testing deepFlatten - ✔ deepFlatten is a Function - ✔ Deep flattens an array + √ deepFlatten is a Function + √ Deep flattens an array Testing defaults - ✔ defaults is a Function + √ defaults is a Function Testing defer - ✔ defer is a Function + √ defer is a Function Testing detectDeviceType - ✔ detectDeviceType is a Function + √ detectDeviceType is a Function Testing difference - ✔ difference is a Function - ✔ Returns the difference between two arrays + √ difference is a Function + √ Returns the difference between two arrays + + Testing differenceBy + + √ differenceBy is a Function Testing differenceWith - ✔ differenceWith is a Function - ✔ Filters out all values from an array + √ differenceWith is a Function + √ Filters out all values from an array Testing digitize - ✔ digitize is a Function - ✔ Converts a number to an array of digits + √ digitize is a Function + √ Converts a number to an array of digits Testing distance - ✔ distance is a Function + √ distance is a Function Testing dropElements - ✔ dropElements is a Function - ✔ Removes elements in an array until the passed function returns true + √ dropElements is a Function + √ Removes elements in an array until the passed function returns true Testing dropRight - ✔ dropRight is a Function - ✔ Returns a new array with n elements removed from the right - ✔ Returns a new array with n elements removed from the right - ✔ Returns a new array with n elements removed from the right + √ dropRight is a Function + √ Returns a new array with n elements removed from the right + √ Returns a new array with n elements removed from the right + √ Returns a new array with n elements removed from the right Testing elementIsVisibleInViewport - ✔ elementIsVisibleInViewport is a Function + √ elementIsVisibleInViewport is a Function Testing elo - ✔ elo is a Function - ✔ Standard 1v1s - ✔ should be equivalent - ✔ 4 player FFA, all same rank + √ elo is a Function + √ Standard 1v1s + √ should be equivalent + √ 4 player FFA, all same rank Testing equals - ✔ equals is a Function - ✔ { a: [2, {e: 3}], b: [4], c: 'foo' } is equal to { a: [2, {e: 3}], b: [4], c: 'foo' } - ✔ [1,2,3] is equal to [1,2,3] - ✔ { a: [2, 3], b: [4] } is not equal to { a: [2, 3], b: [6] } - ✔ [1,2,3] is not equal to [1,2,4] - ✔ [1, 2, 3] should be equal to { 0: 1, 1: 2, 2: 3 }) - type is different, but their enumerable properties match. + √ equals is a Function + √ { a: [2, {e: 3}], b: [4], c: 'foo' } is equal to { a: [2, {e: 3}], b: [4], c: 'foo' } + √ [1,2,3] is equal to [1,2,3] + √ { a: [2, 3], b: [4] } is not equal to { a: [2, 3], b: [6] } + √ [1,2,3] is not equal to [1,2,4] + √ [1, 2, 3] should be equal to { 0: 1, 1: 2, 2: 3 }) - type is different, but their enumerable properties match. Testing escapeHTML - ✔ escapeHTML is a Function - ✔ Escapes a string for use in HTML + √ escapeHTML is a Function + √ Escapes a string for use in HTML Testing escapeRegExp - ✔ escapeRegExp is a Function - ✔ Escapes a string to use in a regular expression + √ escapeRegExp is a Function + √ Escapes a string to use in a regular expression Testing everyNth - ✔ everyNth is a Function - ✔ Returns every nth element in an array + √ everyNth is a Function + √ Returns every nth element in an array Testing extendHex - ✔ extendHex is a Function - ✔ Extends a 3-digit color code to a 6-digit color code - ✔ Extends a 3-digit color code to a 6-digit color code + √ extendHex is a Function + √ Extends a 3-digit color code to a 6-digit color code + √ Extends a 3-digit color code to a 6-digit color code Testing factorial - ✔ factorial is a Function - ✔ Calculates the factorial of 720 - ✔ Calculates the factorial of 0 - ✔ Calculates the factorial of 1 - ✔ Calculates the factorial of 4 - ✔ Calculates the factorial of 10 + √ factorial is a Function + √ Calculates the factorial of 720 + √ Calculates the factorial of 0 + √ Calculates the factorial of 1 + √ Calculates the factorial of 4 + √ Calculates the factorial of 10 Testing factors - ✔ factors is a Function + √ factors is a Function Testing fibonacci - ✔ fibonacci is a Function - ✔ Generates an array, containing the Fibonacci sequence + √ fibonacci is a Function + √ Generates an array, containing the Fibonacci sequence Testing fibonacciCountUntilNum - ✔ fibonacciCountUntilNum is a Function + √ fibonacciCountUntilNum is a Function Testing fibonacciUntilNum - ✔ fibonacciUntilNum is a Function + √ fibonacciUntilNum is a Function Testing filterNonUnique - ✔ filterNonUnique is a Function - ✔ Filters out the non-unique values in an array + √ filterNonUnique is a Function + √ Filters out the non-unique values in an array Testing findKey - ✔ findKey is a Function + √ findKey is a Function Testing findLast - ✔ findLast is a Function + √ findLast is a Function + + Testing findLastIndex + + √ findLastIndex is a Function Testing findLastKey - ✔ findLastKey is a Function + √ findLastKey is a Function Testing flatten - ✔ flatten is a Function - ✔ Flattens an array - ✔ Flattens an array + √ flatten is a Function + √ Flattens an array + √ Flattens an array Testing flip - ✔ flip is a Function + √ flip is a Function Testing forEachRight - ✔ forEachRight is a Function - - Testing forOwn - - ✔ forOwn is a Function - - Testing forOwnRight - - ✔ forOwnRight is a Function + √ forEachRight is a Function Testing formatDuration - ✔ formatDuration is a Function - ✔ Returns the human readable format of the given number of milliseconds - ✔ Returns the human readable format of the given number of milliseconds + √ formatDuration is a Function + √ Returns the human readable format of the given number of milliseconds + √ Returns the human readable format of the given number of milliseconds + + Testing forOwn + + √ forOwn is a Function + + Testing forOwnRight + + √ forOwnRight is a Function Testing fromCamelCase - ✔ fromCamelCase is a Function - ✔ Converts a string from camelcase - ✔ Converts a string from camelcase - ✔ Converts a string from camelcase + √ fromCamelCase is a Function + √ Converts a string from camelcase + √ Converts a string from camelcase + √ Converts a string from camelcase Testing functionName - ✔ functionName is a Function + √ functionName is a Function Testing functions - ✔ functions is a Function + √ functions is a Function Testing gcd - ✔ gcd is a Function - ✔ Calculates the greatest common divisor between two or more numbers/arrays - ✔ Calculates the greatest common divisor between two or more numbers/arrays + √ gcd is a Function + √ Calculates the greatest common divisor between two or more numbers/arrays + √ Calculates the greatest common divisor between two or more numbers/arrays Testing geometricProgression - ✔ geometricProgression is a Function - ✔ Initializes an array containing the numbers in the specified range - ✔ Initializes an array containing the numbers in the specified range - ✔ Initializes an array containing the numbers in the specified range + √ geometricProgression is a Function + √ Initializes an array containing the numbers in the specified range + √ Initializes an array containing the numbers in the specified range + √ Initializes an array containing the numbers in the specified range Testing get - ✔ get is a Function - ✔ Retrieve a property indicated by the selector from an object. + √ get is a Function + √ Retrieve a property indicated by the selector from an object. Testing getDaysDiffBetweenDates - ✔ getDaysDiffBetweenDates is a Function - ✔ Returns the difference in days between two dates + √ getDaysDiffBetweenDates is a Function + √ Returns the difference in days between two dates Testing getScrollPosition - ✔ getScrollPosition is a Function + √ getScrollPosition is a Function Testing getStyle - ✔ getStyle is a Function + √ getStyle is a Function Testing getType - ✔ getType is a Function - ✔ Returns the native type of a value + √ getType is a Function + √ Returns the native type of a value Testing getURLParameters - ✔ getURLParameters is a Function - ✔ Returns an object containing the parameters of the current URL + √ getURLParameters is a Function + √ Returns an object containing the parameters of the current URL Testing groupBy - ✔ groupBy is a Function - ✔ Groups the elements of an array based on the given function - ✔ Groups the elements of an array based on the given function + √ groupBy is a Function + √ Groups the elements of an array based on the given function + √ Groups the elements of an array based on the given function Testing hammingDistance - ✔ hammingDistance is a Function - ✔ retuns hamming disance between 2 values + √ hammingDistance is a Function + √ retuns hamming disance between 2 values Testing hasClass - ✔ hasClass is a Function + √ hasClass is a Function Testing hasFlags - ✔ hasFlags is a Function + √ hasFlags is a Function Testing hashBrowser - ✔ hashBrowser is a Function + √ hashBrowser is a Function Testing hashNode - ✔ hashNode is a Function + √ hashNode is a Function Testing head - ✔ head is a Function - ✔ head({ a: 1234}) returns undefined - ✔ head([1, 2, 3]) returns 1 - ✔ head({ 0: false}) returns false - ✔ head(String) returns S - ✔ head(null) throws an Error - ✔ head(undefined) throws an Error - ✔ head() throws an Error - ✔ head([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run + √ head is a Function + √ head({ a: 1234}) returns undefined + √ head([1, 2, 3]) returns 1 + √ head({ 0: false}) returns false + √ head(String) returns S + √ head(null) throws an Error + √ head(undefined) throws an Error + √ head() throws an Error + √ head([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run Testing hexToRGB - ✔ hexToRGB is a Function - ✔ Converts a color code to a rgb() or rgba() string - ✔ Converts a color code to a rgb() or rgba() string - ✔ Converts a color code to a rgb() or rgba() string + √ hexToRGB is a Function + √ Converts a color code to a rgb() or rgba() string + √ Converts a color code to a rgb() or rgba() string + √ Converts a color code to a rgb() or rgba() string Testing hide - ✔ hide is a Function + √ hide is a Function Testing howManyTimes - ✔ howManyTimes is a Function + √ howManyTimes is a Function Testing httpDelete - ✔ httpDelete is a Function + √ httpDelete is a Function Testing httpGet - ✔ httpGet is a Function + √ httpGet is a Function Testing httpPost - ✔ httpPost is a Function + √ httpPost is a Function Testing httpPut - ✔ httpPut is a Function + √ httpPut is a Function Testing httpsRedirect - ✔ httpsRedirect is a Function - - Testing inRange - - ✔ inRange is a Function - ✔ The given number falls within the given range - ✔ The given number falls within the given range - ✔ The given number does not falls within the given range - ✔ The given number does not falls within the given range + √ httpsRedirect is a Function Testing indexOfAll - ✔ indexOfAll is a Function - ✔ Returns all indices of val in an array - ✔ Returns all indices of val in an array + √ indexOfAll is a Function + √ Returns all indices of val in an array + √ Returns all indices of val in an array Testing initial - ✔ initial is a Function - ✔ Returns all the elements of an array except the last one + √ initial is a Function + √ Returns all the elements of an array except the last one Testing initialize2DArray - ✔ initialize2DArray is a Function - ✔ Initializes a 2D array of given width and height and value + √ initialize2DArray is a Function + √ Initializes a 2D array of given width and height and value Testing initializeArrayWithRange - ✔ initializeArrayWithRange is a Function - ✔ Initializes an array containing the numbers in the specified range + √ initializeArrayWithRange is a Function + √ Initializes an array containing the numbers in the specified range Testing initializeArrayWithRangeRight - ✔ initializeArrayWithRangeRight is a Function + √ initializeArrayWithRangeRight is a Function Testing initializeArrayWithValues - ✔ initializeArrayWithValues is a Function - ✔ Initializes and fills an array with the specified values + √ initializeArrayWithValues is a Function + √ Initializes and fills an array with the specified values + + Testing inRange + + √ inRange is a Function + √ The given number falls within the given range + √ The given number falls within the given range + √ The given number does not falls within the given range + √ The given number does not falls within the given range Testing intersection - ✔ intersection is a Function - ✔ Returns a list of elements that exist in both arrays + √ intersection is a Function + √ Returns a list of elements that exist in both arrays + + Testing intersectionBy + + √ intersectionBy is a Function + + Testing intersectionWith + + √ intersectionWith is a Function Testing invertKeyValues - ✔ invertKeyValues is a Function + √ invertKeyValues is a Function - ✖ Inverts the key-value pairs of an object + × Inverts the key-value pairs of an object ------------------------------------------- operator: deepEqual expected: |- { 20: 'age', John: 'name' } actual: |- { 20: [ 'age' ], John: [ 'name' ] } - at: Test.test (/home/travis/build/Chalarangelo/30-seconds-of-code/test/invertKeyValues/invertKeyValues.test.js:8:4) stack: |- Testing is - ✔ is is a Function + √ is is a Function Testing isAbsoluteURL - ✔ isAbsoluteURL is a Function - ✔ Given string is an absolute URL - ✔ Given string is an absolute URL - ✔ Given string is not an absolute URL + √ isAbsoluteURL is a Function + √ Given string is an absolute URL + √ Given string is an absolute URL + √ Given string is not an absolute URL Testing isArmstrongNumber - ✔ isArmstrongNumber is a Function + √ isArmstrongNumber is a Function Testing isArray - ✔ isArray is a Function - ✔ passed value is an array - ✔ passed value is not an array + √ isArray is a Function + √ passed value is an array + √ passed value is not an array Testing isArrayBuffer - ✔ isArrayBuffer is a Function + √ isArrayBuffer is a Function Testing isArrayLike - ✔ isArrayLike is a Function + √ isArrayLike is a Function Testing isBoolean - ✔ isBoolean is a Function - ✔ passed value is not a boolean - ✔ passed value is not a boolean + √ isBoolean is a Function + √ passed value is not a boolean + √ passed value is not a boolean Testing isDivisible - ✔ isDivisible is a Function - ✔ The number 6 is divisible by 3 + √ isDivisible is a Function + √ The number 6 is divisible by 3 Testing isEmpty - ✔ isEmpty is a Function + √ isEmpty is a Function Testing isEven - ✔ isEven is a Function - ✔ 4 is even number - ✔ undefined + √ isEven is a Function + √ 4 is even number + √ undefined Testing isFunction - ✔ isFunction is a Function - ✔ passed value is a function - ✔ passed value is not a function + √ isFunction is a Function + √ passed value is a function + √ passed value is not a function Testing isLowerCase - ✔ isLowerCase is a Function - ✔ passed string is a lowercase - ✔ passed string is a lowercase - ✔ passed value is not a lowercase + √ isLowerCase is a Function + √ passed string is a lowercase + √ passed string is a lowercase + √ passed value is not a lowercase Testing isMap - ✔ isMap is a Function + √ isMap is a Function Testing isNil - ✔ isNil is a Function + √ isNil is a Function Testing isNull - ✔ isNull is a Function - ✔ passed argument is a null - ✔ passed argument is a null + √ isNull is a Function + √ passed argument is a null + √ passed argument is a null Testing isNumber - ✔ isNumber is a Function - ✔ passed argument is a number - ✔ passed argument is not a number + √ isNumber is a Function + √ passed argument is a number + √ passed argument is not a number Testing isObject - ✔ isObject is a Function - ✔ isObject([1, 2, 3, 4]) is a object - ✔ isObject([]) is a object - ✔ isObject({ a:1 }) is a object - ✔ isObject(true) is not a object + √ isObject is a Function + √ isObject([1, 2, 3, 4]) is a object + √ isObject([]) is a object + √ isObject({ a:1 }) is a object + √ isObject(true) is not a object Testing isObjectLike - ✔ isObjectLike is a Function + √ isObjectLike is a Function Testing isPlainObject - ✔ isPlainObject is a Function + √ isPlainObject is a Function Testing isPrime - ✔ isPrime is a Function - ✔ passed number is a prime + √ isPrime is a Function + √ passed number is a prime Testing isPrimitive - ✔ isPrimitive is a Function - ✔ isPrimitive(null) is primitive - ✔ isPrimitive(undefined) is primitive - ✔ isPrimitive(string) is primitive - ✔ isPrimitive(true) is primitive - ✔ isPrimitive(50) is primitive - ✔ isPrimitive('Hello') is primitive - ✔ isPrimitive(false) is primitive - ✔ isPrimitive(Symbol()) is primitive - ✔ isPrimitive([1, 2, 3]) is not primitive - ✔ isPrimitive({ a: 123 }) is not primitive - ✔ isPrimitive({ a: 123 }) takes less than 2s to run + √ isPrimitive is a Function + √ isPrimitive(null) is primitive + √ isPrimitive(undefined) is primitive + √ isPrimitive(string) is primitive + √ isPrimitive(true) is primitive + √ isPrimitive(50) is primitive + √ isPrimitive('Hello') is primitive + √ isPrimitive(false) is primitive + √ isPrimitive(Symbol()) is primitive + √ isPrimitive([1, 2, 3]) is not primitive + √ isPrimitive({ a: 123 }) is not primitive + √ isPrimitive({ a: 123 }) takes less than 2s to run Testing isPromiseLike - ✔ isPromiseLike is a Function + √ isPromiseLike is a Function Testing isRegExp - ✔ isRegExp is a Function + √ isRegExp is a Function Testing isSet - ✔ isSet is a Function + √ isSet is a Function Testing isSorted - ✔ isSorted is a Function - ✔ Array is sorted in ascending order - ✔ Array is sorted in descending order - ✔ Array is not sorted, direction changed in array + √ isSorted is a Function + √ Array is sorted in ascending order + √ Array is sorted in descending order + √ Array is not sorted, direction changed in array Testing isString - ✔ isString is a Function - ✔ foo is a string - ✔ "10" is a string - ✔ Empty string is a string - ✔ 10 is not a string - ✔ true is not string + √ isString is a Function + √ foo is a string + √ "10" is a string + √ Empty string is a string + √ 10 is not a string + √ true is not string Testing isSymbol - ✔ isSymbol is a Function - ✔ Checks if the given argument is a symbol + √ isSymbol is a Function + √ Checks if the given argument is a symbol Testing isTravisCI - ✔ isTravisCI is a Function + √ isTravisCI is a Function Testing isTypedArray - ✔ isTypedArray is a Function + √ isTypedArray is a Function Testing isUndefined - ✔ isUndefined is a Function + √ isUndefined is a Function Testing isUpperCase - ✔ isUpperCase is a Function - ✔ ABC is all upper case - ✔ abc is not all upper case - ✔ A3@$ is all uppercase + √ isUpperCase is a Function + √ ABC is all upper case + √ abc is not all upper case + √ A3@$ is all uppercase Testing isValidJSON - ✔ isValidJSON is a Function - ✔ {"name":"Adam","age":20} is a valid JSON - ✔ {"name":"Adam",age:"20"} is not a valid JSON - ✔ null is a valid JSON + √ isValidJSON is a Function + √ {"name":"Adam","age":20} is a valid JSON + √ {"name":"Adam",age:"20"} is not a valid JSON + √ null is a valid JSON Testing isWeakMap - ✔ isWeakMap is a Function + √ isWeakMap is a Function Testing isWeakSet - ✔ isWeakSet is a Function + √ isWeakSet is a Function Testing join - ✔ join is a Function - ✔ Joins all elements of an array into a string and returns this string - ✔ Joins all elements of an array into a string and returns this string - ✔ Joins all elements of an array into a string and returns this string + √ join is a Function + √ Joins all elements of an array into a string and returns this string + √ Joins all elements of an array into a string and returns this string + √ Joins all elements of an array into a string and returns this string + + Testing JSONToDate + + √ JSONToDate is a Function + + Testing JSONToFile + + √ JSONToFile is a Function Testing last - ✔ last is a Function - ✔ last({ a: 1234}) returns undefined - ✔ last([1, 2, 3]) returns 3 - ✔ last({ 0: false}) returns undefined - ✔ last(String) returns g - ✔ last(null) throws an Error - ✔ last(undefined) throws an Error - ✔ last() throws an Error - ✔ last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run + √ last is a Function + √ last({ a: 1234}) returns undefined + √ last([1, 2, 3]) returns 3 + √ last({ 0: false}) returns undefined + √ last(String) returns g + √ last(null) throws an Error + √ last(undefined) throws an Error + √ last() throws an Error + √ last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run Testing lcm - ✔ lcm is a Function - ✔ Returns the least common multiple of two or more numbers. - ✔ Returns the least common multiple of two or more numbers. + √ lcm is a Function + √ Returns the least common multiple of two or more numbers. + √ Returns the least common multiple of two or more numbers. Testing longestItem - ✔ longestItem is a Function - ✔ Returns the longest object + √ longestItem is a Function + √ Returns the longest object Testing lowercaseKeys - ✔ lowercaseKeys is a Function + √ lowercaseKeys is a Function Testing luhnCheck - ✔ luhnCheck is a Function - ✔ validates identification number - ✔ validates identification number - ✔ validates identification number + √ luhnCheck is a Function + √ validates identification number + √ validates identification number + √ validates identification number Testing mapKeys - ✔ mapKeys is a Function + √ mapKeys is a Function Testing mapObject - ✔ mapObject is a Function - ✔ Maps the values of an array to an object using a function + √ mapObject is a Function + √ Maps the values of an array to an object using a function Testing mapValues - ✔ mapValues is a Function + √ mapValues is a Function Testing mask - ✔ mask is a Function - ✔ Replaces all but the last num of characters with the specified mask character - ✔ Replaces all but the last num of characters with the specified mask character - ✔ Replaces all but the last num of characters with the specified mask character + √ mask is a Function + √ Replaces all but the last num of characters with the specified mask character + √ Replaces all but the last num of characters with the specified mask character + √ Replaces all but the last num of characters with the specified mask character Testing matches - ✔ matches is a Function + √ matches is a Function Testing matchesWith - ✔ matchesWith is a Function + √ matchesWith is a Function Testing maxBy - ✔ maxBy is a Function + √ maxBy is a Function Testing maxN - ✔ maxN is a Function - ✔ Returns the n maximum elements from the provided array - ✔ Returns the n maximum elements from the provided array + √ maxN is a Function + √ Returns the n maximum elements from the provided array + √ Returns the n maximum elements from the provided array Testing median - ✔ median is a Function - ✔ Returns the median of an array of numbers - ✔ Returns the median of an array of numbers + √ median is a Function + √ Returns the median of an array of numbers + √ Returns the median of an array of numbers Testing memoize - ✔ memoize is a Function + √ memoize is a Function Testing merge - ✔ merge is a Function + √ merge is a Function Testing minBy - ✔ minBy is a Function + √ minBy is a Function Testing minN - ✔ minN is a Function - ✔ Returns the n minimum elements from the provided array - ✔ Returns the n minimum elements from the provided array + √ minN is a Function + √ Returns the n minimum elements from the provided array + √ Returns the n minimum elements from the provided array Testing negate - ✔ negate is a Function - ✔ Negates a predicate function + √ negate is a Function + √ Negates a predicate function Testing nthArg - ✔ nthArg is a Function + √ nthArg is a Function Testing nthElement - ✔ nthElement is a Function - ✔ Returns the nth element of an array. - ✔ Returns the nth element of an array. + √ nthElement is a Function + √ Returns the nth element of an array. + √ Returns the nth element of an array. Testing objectFromPairs - ✔ objectFromPairs is a Function - ✔ Creates an object from the given key-value pairs. + √ objectFromPairs is a Function + √ Creates an object from the given key-value pairs. Testing objectToPairs - ✔ objectToPairs is a Function - ✔ Creates an array of key-value pair arrays from an object. + √ objectToPairs is a Function + √ Creates an array of key-value pair arrays from an object. Testing observeMutations - ✔ observeMutations is a Function + √ observeMutations is a Function Testing off - ✔ off is a Function + √ off is a Function Testing omit - ✔ omit is a Function + √ omit is a Function Testing omitBy - ✔ omitBy is a Function + √ omitBy is a Function Testing on - ✔ on is a Function - - Testing onUserInputChange - - ✔ onUserInputChange is a Function + √ on is a Function Testing once - ✔ once is a Function + √ once is a Function + + Testing onUserInputChange + + √ onUserInputChange is a Function Testing orderBy - ✔ orderBy is a Function - ✔ Returns a sorted array of objects ordered by properties and orders. - ✔ Returns a sorted array of objects ordered by properties and orders. + √ orderBy is a Function + √ Returns a sorted array of objects ordered by properties and orders. + √ Returns a sorted array of objects ordered by properties and orders. Testing over - ✔ over is a Function + √ over is a Function Testing palindrome - ✔ palindrome is a Function - ✔ Given string is a palindrome - ✔ Given string is not a palindrome + √ palindrome is a Function + √ Given string is a palindrome + √ Given string is not a palindrome Testing parseCookie - ✔ parseCookie is a Function + √ parseCookie is a Function Testing partition - ✔ partition is a Function - ✔ Groups the elements into two arrays, depending on the provided function's truthiness for each element. + √ partition is a Function + √ Groups the elements into two arrays, depending on the provided function's truthiness for each element. Testing percentile - ✔ percentile is a Function - ✔ Uses the percentile formula to calculate how many numbers in the given array are less or equal to the given value. + √ percentile is a Function + √ Uses the percentile formula to calculate how many numbers in the given array are less or equal to the given value. Testing pick - ✔ pick is a Function - ✔ Picks the key-value pairs corresponding to the given keys from an object. + √ pick is a Function + √ Picks the key-value pairs corresponding to the given keys from an object. Testing pickBy - ✔ pickBy is a Function + √ pickBy is a Function Testing pipeFunctions - ✔ pipeFunctions is a Function + √ pipeFunctions is a Function Testing pluralize - ✔ pluralize is a Function + √ pluralize is a Function Testing powerset - ✔ powerset is a Function - ✔ Returns the powerset of a given array of numbers. + √ powerset is a Function + √ Returns the powerset of a given array of numbers. Testing prettyBytes - ✔ prettyBytes is a Function - ✔ Converts a number in bytes to a human-readable string. - ✔ Converts a number in bytes to a human-readable string. - ✔ Converts a number in bytes to a human-readable string. + √ prettyBytes is a Function + √ Converts a number in bytes to a human-readable string. + √ Converts a number in bytes to a human-readable string. + √ Converts a number in bytes to a human-readable string. Testing primes - ✔ primes is a Function - ✔ Generates primes up to a given number, using the Sieve of Eratosthenes. + √ primes is a Function + √ Generates primes up to a given number, using the Sieve of Eratosthenes. Testing promisify - ✔ promisify is a Function + √ promisify is a Function Testing pull - ✔ pull is a Function + √ pull is a Function Testing pullAtIndex - ✔ pullAtIndex is a Function + √ pullAtIndex is a Function Testing pullAtValue - ✔ pullAtValue is a Function + √ pullAtValue is a Function Testing quickSort - ✔ quickSort is a Function - ✔ quickSort([5, 6, 4, 3, 1, 2]) returns [1, 2, 3, 4, 5, 6] - ✔ quickSort([-1, 0, -2]) returns [-2, -1, 0] - ✔ quickSort() throws an error - ✔ quickSort(123) throws an error - ✔ quickSort({ 234: string}) throws an error - ✔ quickSort(null) throws an error - ✔ quickSort(undefined) throws an error - ✔ quickSort([11, 1, 324, 23232, -1, 53, 2, 524, 32, 13, 156, 133, 62, 12, 4]) takes less than 2s to run + √ quickSort is a Function + √ quickSort([5, 6, 4, 3, 1, 2]) returns [1, 2, 3, 4, 5, 6] + √ quickSort([-1, 0, -2]) returns [-2, -1, 0] + √ quickSort() throws an error + √ quickSort(123) throws an error + √ quickSort({ 234: string}) throws an error + √ quickSort(null) throws an error + √ quickSort(undefined) throws an error + √ quickSort([11, 1, 324, 23232, -1, 53, 2, 524, 32, 13, 156, 133, 62, 12, 4]) takes less than 2s to run Testing randomHexColorCode - ✔ randomHexColorCode is a Function + √ randomHexColorCode is a Function Testing randomIntArrayInRange - ✔ randomIntArrayInRange is a Function + √ randomIntArrayInRange is a Function Testing randomIntegerInRange - ✔ randomIntegerInRange is a Function + √ randomIntegerInRange is a Function Testing randomNumberInRange - ✔ randomNumberInRange is a Function + √ randomNumberInRange is a Function Testing readFileLines - ✔ readFileLines is a Function + √ readFileLines is a Function + + Testing README + + √ README is a Function Testing redirect - ✔ redirect is a Function + √ redirect is a Function Testing reducedFilter - ✔ reducedFilter is a Function - ✔ Filter an array of objects based on a condition while also filtering out unspecified keys. + √ reducedFilter is a Function + √ Filter an array of objects based on a condition while also filtering out unspecified keys. Testing remove - ✔ remove is a Function - ✔ Removes elements from an array for which the given function returns false + √ remove is a Function + √ Removes elements from an array for which the given function returns false Testing removeVowels - ✔ removeVowels is a Function + √ removeVowels is a Function Testing reverseString - ✔ reverseString is a Function - ✔ Reverses a string. + √ reverseString is a Function + √ Reverses a string. + + Testing RGBToHex + + √ RGBToHex is a Function + √ Converts the values of RGB components to a color code. Testing round - ✔ round is a Function - ✔ Rounds a number to a specified amount of digits. + √ round is a Function + √ Rounds a number to a specified amount of digits. Testing runAsync - ✔ runAsync is a Function + √ runAsync is a Function Testing runPromisesInSeries - ✔ runPromisesInSeries is a Function + √ runPromisesInSeries is a Function Testing sample - ✔ sample is a Function + √ sample is a Function Testing sampleSize - ✔ sampleSize is a Function + √ sampleSize is a Function Testing scrollToTop - ✔ scrollToTop is a Function + √ scrollToTop is a Function Testing sdbm - ✔ sdbm is a Function - ✔ Hashes the input string into a whole number. + √ sdbm is a Function + √ Hashes the input string into a whole number. Testing serializeCookie - ✔ serializeCookie is a Function + √ serializeCookie is a Function Testing setStyle - ✔ setStyle is a Function + √ setStyle is a Function Testing shallowClone - ✔ shallowClone is a Function + √ shallowClone is a Function Testing show - ✔ show is a Function + √ show is a Function Testing shuffle - ✔ shuffle is a Function + √ shuffle is a Function Testing similarity - ✔ similarity is a Function - ✔ Returns an array of elements that appear in both arrays. + √ similarity is a Function + √ Returns an array of elements that appear in both arrays. Testing size - ✔ size is a Function - ✔ Get size of arrays, objects or strings. - ✔ Get size of arrays, objects or strings. + √ size is a Function + √ Get size of arrays, objects or strings. + √ Get size of arrays, objects or strings. Testing sleep - ✔ sleep is a Function + √ sleep is a Function Testing solveRPN - ✔ solveRPN is a Function + √ solveRPN is a Function Testing sortCharactersInString - ✔ sortCharactersInString is a Function - ✔ Alphabetically sorts the characters in a string. + √ sortCharactersInString is a Function + √ Alphabetically sorts the characters in a string. Testing sortedIndex - ✔ sortedIndex is a Function - ✔ Returns the lowest index at which value should be inserted into array in order to maintain its sort order. - ✔ Returns the lowest index at which value should be inserted into array in order to maintain its sort order. + √ sortedIndex is a Function + √ Returns the lowest index at which value should be inserted into array in order to maintain its sort order. + √ Returns the lowest index at which value should be inserted into array in order to maintain its sort order. + + Testing sortedLastIndex + + √ sortedLastIndex is a Function Testing speechSynthesis - ✔ speechSynthesis is a Function + √ speechSynthesis is a Function Testing splitLines - ✔ splitLines is a Function - ✔ Splits a multiline string into an array of lines. + √ splitLines is a Function + √ Splits a multiline string into an array of lines. Testing spreadOver - ✔ spreadOver is a Function - ✔ Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function. + √ spreadOver is a Function + √ Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function. Testing standardDeviation - ✔ standardDeviation is a Function - ✔ Returns the standard deviation of an array of numbers - ✔ Returns the standard deviation of an array of numbers + √ standardDeviation is a Function + √ Returns the standard deviation of an array of numbers + √ Returns the standard deviation of an array of numbers Testing sum - ✔ sum is a Function - ✔ Returns the sum of two or more numbers/arrays. + √ sum is a Function + √ Returns the sum of two or more numbers/arrays. Testing sumBy - ✔ sumBy is a Function + √ sumBy is a Function Testing sumPower - ✔ sumPower is a Function - ✔ Returns the sum of the powers of all the numbers from start to end - ✔ Returns the sum of the powers of all the numbers from start to end - ✔ Returns the sum of the powers of all the numbers from start to end + √ sumPower is a Function + √ Returns the sum of the powers of all the numbers from start to end + √ Returns the sum of the powers of all the numbers from start to end + √ Returns the sum of the powers of all the numbers from start to end Testing symmetricDifference - ✔ symmetricDifference is a Function - ✔ Returns the symmetric difference between two arrays. + √ symmetricDifference is a Function + √ Returns the symmetric difference between two arrays. + + Testing symmetricDifferenceBy + + √ symmetricDifferenceBy is a Function + + Testing symmetricDifferenceWith + + √ symmetricDifferenceWith is a Function Testing tail - ✔ tail is a Function - ✔ Returns tail - ✔ Returns tail + √ tail is a Function + √ Returns tail + √ Returns tail Testing take - ✔ take is a Function - ✔ Returns an array with n elements removed from the beginning. - ✔ Returns an array with n elements removed from the beginning. + √ take is a Function + √ Returns an array with n elements removed from the beginning. + √ Returns an array with n elements removed from the beginning. Testing takeRight - ✔ takeRight is a Function - ✔ Returns an array with n elements removed from the end - ✔ Returns an array with n elements removed from the end + √ takeRight is a Function + √ Returns an array with n elements removed from the end + √ Returns an array with n elements removed from the end Testing timeTaken - ✔ timeTaken is a Function + √ timeTaken is a Function Testing toCamelCase - ✔ toCamelCase is a Function - ✔ Converts a string to camelCase - ✔ Converts a string to camelCase - ✔ Converts a string to camelCase - ✔ Converts a string to camelCase + √ toCamelCase is a Function + √ Converts a string to camelCase + √ Converts a string to camelCase + √ Converts a string to camelCase + √ Converts a string to camelCase Testing toDecimalMark - ✔ toDecimalMark is a Function - ✔ convert a float-point arithmetic to the Decimal mark form - - Testing toKebabCase - - ✔ toKebabCase is a Function - ✔ string converts to snake case - ✔ string converts to snake case - ✔ string converts to snake case - ✔ string converts to snake case - - Testing toOrdinalSuffix - - ✔ toOrdinalSuffix is a Function - ✔ Adds an ordinal suffix to a number - ✔ Adds an ordinal suffix to a number - ✔ Adds an ordinal suffix to a number - ✔ Adds an ordinal suffix to a number - - Testing toSafeInteger - - ✔ toSafeInteger is a Function - ✔ Converts a value to a safe integer - ✔ Converts a value to a safe integer - ✔ Converts a value to a safe integer - ✔ Converts a value to a safe integer - ✔ Converts a value to a safe integer - - Testing toSnakeCase - - ✔ toSnakeCase is a Function - ✔ string converts to snake case - ✔ string converts to snake case - ✔ string converts to snake case - ✔ string converts to snake case + √ toDecimalMark is a Function + √ convert a float-point arithmetic to the Decimal mark form Testing toggleClass - ✔ toggleClass is a Function + √ toggleClass is a Function + + Testing toKebabCase + + √ toKebabCase is a Function + √ string converts to snake case + √ string converts to snake case + √ string converts to snake case + √ string converts to snake case Testing tomorrow - ✔ tomorrow is a Function + √ tomorrow is a Function + + Testing toOrdinalSuffix + + √ toOrdinalSuffix is a Function + √ Adds an ordinal suffix to a number + √ Adds an ordinal suffix to a number + √ Adds an ordinal suffix to a number + √ Adds an ordinal suffix to a number + + Testing toSafeInteger + + √ toSafeInteger is a Function + √ Converts a value to a safe integer + √ Converts a value to a safe integer + √ Converts a value to a safe integer + √ Converts a value to a safe integer + √ Converts a value to a safe integer + + Testing toSnakeCase + + √ toSnakeCase is a Function + √ string converts to snake case + √ string converts to snake case + √ string converts to snake case + √ string converts to snake case Testing transform - ✔ transform is a Function + √ transform is a Function Testing truncateString - ✔ truncateString is a Function - ✔ Truncates a "boomerang" up to a specified length. + √ truncateString is a Function + √ Truncates a "boomerang" up to a specified length. Testing truthCheckCollection - ✔ truthCheckCollection is a Function - ✔ second argument is truthy on all elements of a collection + √ truthCheckCollection is a Function + √ second argument is truthy on all elements of a collection Testing unescapeHTML - ✔ unescapeHTML is a Function - ✔ Unescapes escaped HTML characters. + √ unescapeHTML is a Function + √ Unescapes escaped HTML characters. Testing union - ✔ union is a Function - ✔ Returns every element that exists in any of the two arrays once + √ union is a Function + √ Returns every element that exists in any of the two arrays once + + Testing unionBy + + √ unionBy is a Function + + Testing unionWith + + √ unionWith is a Function Testing uniqueElements - ✔ uniqueElements is a Function - ✔ Returns all unique values of an array + √ uniqueElements is a Function + √ Returns all unique values of an array Testing untildify - ✔ untildify is a Function + √ untildify is a Function + + Testing unzip + + √ unzip is a Function + + Testing unzipWith + + √ unzipWith is a Function + + Testing URLJoin + + √ URLJoin is a Function + √ Returns proper URL + √ Returns proper URL + + Testing UUIDGeneratorBrowser + + √ UUIDGeneratorBrowser is a Function + + Testing UUIDGeneratorNode + + √ UUIDGeneratorNode is a Function Testing validateNumber - ✔ validateNumber is a Function - ✔ validateNumber(9) returns true - ✔ validateNumber(234asd.slice(0, 2)) returns true - ✔ validateNumber(1232) returns true - ✔ validateNumber(1232 + 13423) returns true - ✔ validateNumber(1232 * 2342 * 123) returns true - ✔ validateNumber(1232.23423536) returns true - ✔ validateNumber(234asd) returns false - ✔ validateNumber(e234d) returns false - ✔ validateNumber(false) returns false - ✔ validateNumber(true) returns false - ✔ validateNumber(null) returns false - ✔ validateNumber(123 * asd) returns false + √ validateNumber is a Function + √ validateNumber(9) returns true + √ validateNumber(234asd.slice(0, 2)) returns true + √ validateNumber(1232) returns true + √ validateNumber(1232 + 13423) returns true + √ validateNumber(1232 * 2342 * 123) returns true + √ validateNumber(1232.23423536) returns true + √ validateNumber(234asd) returns false + √ validateNumber(e234d) returns false + √ validateNumber(false) returns false + √ validateNumber(true) returns false + √ validateNumber(null) returns false + √ validateNumber(123 * asd) returns false Testing without - ✔ without is a Function - ✔ without([2, 1, 2, 3], 1, 2) returns [3] - ✔ without([]) returns [] - ✔ without([3, 1, true, '3', true], '3', true) returns [3, 1] - ✔ without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n'] - ✔ without() throws an error - ✔ without(null) throws an error - ✔ without(undefined) throws an error - ✔ without() throws an error - ✔ without({}) throws an error + √ without is a Function + √ without([2, 1, 2, 3], 1, 2) returns [3] + √ without([]) returns [] + √ without([3, 1, true, '3', true], '3', true) returns [3, 1] + √ without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n'] + √ without() throws an error + √ without(null) throws an error + √ without(undefined) throws an error + √ without() throws an error + √ without({}) throws an error Testing words - ✔ words is a Function - ✔ words('I love javaScript!!') returns [I, love, javaScript] - ✔ words('python, javaScript & coffee') returns [python, javaScript, coffee] - ✔ words(I love javaScript!!) returns an array - ✔ words() throws a error - ✔ words(null) throws a error - ✔ words(undefined) throws a error - ✔ words({}) throws a error - ✔ words([]) throws a error - ✔ words(1234) throws a error + √ words is a Function + √ words('I love javaScript!!') returns [I, love, javaScript] + √ words('python, javaScript & coffee') returns [python, javaScript, coffee] + √ words(I love javaScript!!) returns an array + √ words() throws a error + √ words(null) throws a error + √ words(undefined) throws a error + √ words({}) throws a error + √ words([]) throws a error + √ words(1234) throws a error Testing yesNo - ✔ yesNo is a Function - ✔ yesNo(Y) returns true - ✔ yesNo(yes) returns true - ✔ yesNo(foo, true) returns true - ✔ yesNo(No) returns false - ✔ yesNo() returns false - ✔ yesNo(null) returns false - ✔ yesNo(undefined) returns false - ✔ yesNo([123, null]) returns false - ✔ yesNo([Yes, No]) returns false - ✔ yesNo({ 2: Yes }) returns false - ✔ yesNo([Yes, No], true) returns true - ✔ yesNo({ 2: Yes }, true) returns true + √ yesNo is a Function + √ yesNo(Y) returns true + √ yesNo(yes) returns true + √ yesNo(foo, true) returns true + √ yesNo(No) returns false + √ yesNo() returns false + √ yesNo(null) returns false + √ yesNo(undefined) returns false + √ yesNo([123, null]) returns false + √ yesNo([Yes, No]) returns false + √ yesNo({ 2: Yes }) returns false + √ yesNo([Yes, No], true) returns true + √ yesNo({ 2: Yes }, true) returns true Testing zip - ✔ zip is a Function - ✔ zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]] - ✔ zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]] - ✔ zip([]) returns [] - ✔ zip(123) returns [] - ✔ zip([a, b], [1, 2], [true, false]) returns an Array - ✔ zip([a], [1, 2], [true, false]) returns an Array - ✔ zip(null) throws an error - ✔ zip(undefined) throws an error + √ zip is a Function + √ zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]] + √ zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]] + √ zip([]) returns [] + √ zip(123) returns [] + √ zip([a, b], [1, 2], [true, false]) returns an Array + √ zip([a], [1, 2], [true, false]) returns an Array + √ zip(null) throws an error + √ zip(undefined) throws an error Testing zipObject - ✔ zipObject is a Function - ✔ zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined} - ✔ zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2} - ✔ zipObject([a, b, c], string) returns { a: s, b: t, c: r } - ✔ zipObject([a], string) returns { a: s } - ✔ zipObject() throws an error - ✔ zipObject([string], null) throws an error - ✔ zipObject(null, [1]) throws an error - ✔ zipObject(string) throws an error - ✔ zipObject(test, string) throws an error + √ zipObject is a Function + √ zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined} + √ zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2} + √ zipObject([a, b, c], string) returns { a: s, b: t, c: r } + √ zipObject([a], string) returns { a: s } + √ zipObject() throws an error + √ zipObject([string], null) throws an error + √ zipObject(null, [1]) throws an error + √ zipObject(string) throws an error + √ zipObject(test, string) throws an error Testing zipWith - ✔ zipWith is a Function + √ zipWith is a Function @@ -1356,13 +1403,13 @@ Test log for: Tue Jan 23 2018 20:11:47 GMT+0000 (UTC) Testing invertKeyValues - ✖ Inverts the key-value pairs of an object + × Inverts the key-value pairs of an object - total: 574 - passing: 573 + total: 586 + passing: 585 failing: 1 - duration: 440ms + duration: 521ms undefined \ No newline at end of file diff --git a/test/timeTaken/timeTaken.js b/test/timeTaken/timeTaken.js index ae31b01a2..59d0def76 100644 --- a/test/timeTaken/timeTaken.js +++ b/test/timeTaken/timeTaken.js @@ -4,4 +4,4 @@ const r = callback(); console.timeEnd('timeTaken'); return r; }; - module.exports = timeTaken \ No newline at end of file +module.exports = timeTaken \ No newline at end of file diff --git a/test/toCamelCase/toCamelCase.js b/test/toCamelCase/toCamelCase.js index 44ee52a34..93d2098c1 100644 --- a/test/toCamelCase/toCamelCase.js +++ b/test/toCamelCase/toCamelCase.js @@ -7,4 +7,4 @@ str .join(''); return s.slice(0, 1).toLowerCase() + s.slice(1); }; - module.exports = toCamelCase \ No newline at end of file +module.exports = toCamelCase \ No newline at end of file diff --git a/test/toDecimalMark/toDecimalMark.js b/test/toDecimalMark/toDecimalMark.js index e7de2e7d9..68b31c094 100644 --- a/test/toDecimalMark/toDecimalMark.js +++ b/test/toDecimalMark/toDecimalMark.js @@ -1,2 +1,2 @@ const toDecimalMark = num => num.toLocaleString('en-US'); - module.exports = toDecimalMark \ No newline at end of file +module.exports = toDecimalMark \ No newline at end of file diff --git a/test/toKebabCase/toKebabCase.js b/test/toKebabCase/toKebabCase.js index 2b313a66d..7a8fef0f6 100644 --- a/test/toKebabCase/toKebabCase.js +++ b/test/toKebabCase/toKebabCase.js @@ -4,4 +4,4 @@ str .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) .map(x => x.toLowerCase()) .join('-'); - module.exports = toKebabCase \ No newline at end of file +module.exports = toKebabCase \ No newline at end of file diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.js b/test/toOrdinalSuffix/toOrdinalSuffix.js index 6afa22b31..0f3d9b25d 100644 --- a/test/toOrdinalSuffix/toOrdinalSuffix.js +++ b/test/toOrdinalSuffix/toOrdinalSuffix.js @@ -8,4 +8,4 @@ return oPattern.includes(digits[0]) && !tPattern.includes(digits[1]) ? int + ordinals[digits[0] - 1] : int + ordinals[3]; }; - module.exports = toOrdinalSuffix \ No newline at end of file +module.exports = toOrdinalSuffix \ No newline at end of file diff --git a/test/toSafeInteger/toSafeInteger.js b/test/toSafeInteger/toSafeInteger.js index 166e465a4..b34b0b0b7 100644 --- a/test/toSafeInteger/toSafeInteger.js +++ b/test/toSafeInteger/toSafeInteger.js @@ -1,3 +1,3 @@ const toSafeInteger = num => Math.round(Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER)); - module.exports = toSafeInteger \ No newline at end of file +module.exports = toSafeInteger \ No newline at end of file diff --git a/test/toSnakeCase/toSnakeCase.js b/test/toSnakeCase/toSnakeCase.js index 9fffb9201..4e18c9123 100644 --- a/test/toSnakeCase/toSnakeCase.js +++ b/test/toSnakeCase/toSnakeCase.js @@ -4,4 +4,4 @@ str .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) .map(x => x.toLowerCase()) .join('_'); - module.exports = toSnakeCase \ No newline at end of file +module.exports = toSnakeCase \ No newline at end of file diff --git a/test/toggleClass/toggleClass.js b/test/toggleClass/toggleClass.js index 2ad186b51..90de4b417 100644 --- a/test/toggleClass/toggleClass.js +++ b/test/toggleClass/toggleClass.js @@ -1,2 +1,2 @@ const toggleClass = (el, className) => el.classList.toggle(className); - module.exports = toggleClass \ No newline at end of file +module.exports = toggleClass \ No newline at end of file diff --git a/test/tomorrow/tomorrow.js b/test/tomorrow/tomorrow.js index 4e3ee9776..cb644dc4e 100644 --- a/test/tomorrow/tomorrow.js +++ b/test/tomorrow/tomorrow.js @@ -5,4 +5,4 @@ return `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String t.getDate() ).padStart(2, '0')}`; }; - module.exports = tomorrow \ No newline at end of file +module.exports = tomorrow \ No newline at end of file diff --git a/test/transform/transform.js b/test/transform/transform.js index e6f4c6ef8..1232a4a9b 100644 --- a/test/transform/transform.js +++ b/test/transform/transform.js @@ -1,2 +1,2 @@ const transform = (obj, fn, acc) => Object.keys(obj).reduce((a, k) => fn(a, obj[k], k, obj), acc); - module.exports = transform \ No newline at end of file +module.exports = transform \ No newline at end of file diff --git a/test/truncateString/truncateString.js b/test/truncateString/truncateString.js index 307d0c12b..ef9546701 100644 --- a/test/truncateString/truncateString.js +++ b/test/truncateString/truncateString.js @@ -1,3 +1,3 @@ const truncateString = (str, num) => str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; - module.exports = truncateString \ No newline at end of file +module.exports = truncateString \ No newline at end of file diff --git a/test/truthCheckCollection/truthCheckCollection.js b/test/truthCheckCollection/truthCheckCollection.js index 3841a8dce..8a7ada0b0 100644 --- a/test/truthCheckCollection/truthCheckCollection.js +++ b/test/truthCheckCollection/truthCheckCollection.js @@ -1,2 +1,2 @@ const truthCheckCollection = (collection, pre) => collection.every(obj => obj[pre]); - module.exports = truthCheckCollection \ No newline at end of file +module.exports = truthCheckCollection \ No newline at end of file diff --git a/test/unescapeHTML/unescapeHTML.js b/test/unescapeHTML/unescapeHTML.js index c4b6c379e..a82099aa1 100644 --- a/test/unescapeHTML/unescapeHTML.js +++ b/test/unescapeHTML/unescapeHTML.js @@ -10,4 +10,4 @@ tag => '"': '"' }[tag] || tag) ); - module.exports = unescapeHTML \ No newline at end of file +module.exports = unescapeHTML \ No newline at end of file diff --git a/test/union/union.js b/test/union/union.js index 1f86c4442..d0b4b52ea 100644 --- a/test/union/union.js +++ b/test/union/union.js @@ -1,2 +1,2 @@ const union = (a, b) => Array.from(new Set([...a, ...b])); - module.exports = union \ No newline at end of file +module.exports = union \ No newline at end of file diff --git a/test/unionBy/unionBy.js b/test/unionBy/unionBy.js new file mode 100644 index 000000000..d4afc4763 --- /dev/null +++ b/test/unionBy/unionBy.js @@ -0,0 +1,5 @@ +const unionBy = (a, b, fn) => { +const s = new Set(a.map(v => fn(v))); +return Array.from(new Set([...a, ...b.filter(x => !s.has(fn(x)))])); +}; +module.exports = unionBy \ No newline at end of file diff --git a/test/unionBy/unionBy.test.js b/test/unionBy/unionBy.test.js new file mode 100644 index 000000000..8377bbbce --- /dev/null +++ b/test/unionBy/unionBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const unionBy = require('./unionBy.js'); + +test('Testing unionBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof unionBy === 'function', 'unionBy is a Function'); + //t.deepEqual(unionBy(args..), 'Expected'); + //t.equal(unionBy(args..), 'Expected'); + //t.false(unionBy(args..), 'Expected'); + //t.throws(unionBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/unionWith/unionWith.js b/test/unionWith/unionWith.js new file mode 100644 index 000000000..cb1ca174d --- /dev/null +++ b/test/unionWith/unionWith.js @@ -0,0 +1,3 @@ +const unionWith = (a, b, comp) => +Array.from(new Set([...a, ...b.filter(x => a.findIndex(y => comp(x, y)) === -1)])); +module.exports = unionWith \ No newline at end of file diff --git a/test/unionWith/unionWith.test.js b/test/unionWith/unionWith.test.js new file mode 100644 index 000000000..e9df2f1c8 --- /dev/null +++ b/test/unionWith/unionWith.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const unionWith = require('./unionWith.js'); + +test('Testing unionWith', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof unionWith === 'function', 'unionWith is a Function'); + //t.deepEqual(unionWith(args..), 'Expected'); + //t.equal(unionWith(args..), 'Expected'); + //t.false(unionWith(args..), 'Expected'); + //t.throws(unionWith(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/uniqueElements/uniqueElements.js b/test/uniqueElements/uniqueElements.js index 5e5b4315d..feb8e9b74 100644 --- a/test/uniqueElements/uniqueElements.js +++ b/test/uniqueElements/uniqueElements.js @@ -1,2 +1,2 @@ const uniqueElements = arr => [...new Set(arr)]; - module.exports = uniqueElements \ No newline at end of file +module.exports = uniqueElements \ No newline at end of file diff --git a/test/untildify/untildify.js b/test/untildify/untildify.js index a95120fb9..4962b7567 100644 --- a/test/untildify/untildify.js +++ b/test/untildify/untildify.js @@ -1,2 +1,2 @@ const untildify = str => str.replace(/^~($|\/|\\)/, `${require('os').homedir()}$1`); - module.exports = untildify \ No newline at end of file +module.exports = untildify \ No newline at end of file diff --git a/test/unzip/unzip.js b/test/unzip/unzip.js new file mode 100644 index 000000000..4cfe50a93 --- /dev/null +++ b/test/unzip/unzip.js @@ -0,0 +1,8 @@ +const unzip = arr => +arr.reduce( +(acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc), +Array.from({ +length: Math.max(...arr.map(x => x.length)) +}).map(x => []) +); +module.exports = unzip \ No newline at end of file diff --git a/test/unzip/unzip.test.js b/test/unzip/unzip.test.js new file mode 100644 index 000000000..17efbc0a4 --- /dev/null +++ b/test/unzip/unzip.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const unzip = require('./unzip.js'); + +test('Testing unzip', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof unzip === 'function', 'unzip is a Function'); + //t.deepEqual(unzip(args..), 'Expected'); + //t.equal(unzip(args..), 'Expected'); + //t.false(unzip(args..), 'Expected'); + //t.throws(unzip(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/unzipWith/unzipWith.js b/test/unzipWith/unzipWith.js new file mode 100644 index 000000000..6f1ba0869 --- /dev/null +++ b/test/unzipWith/unzipWith.js @@ -0,0 +1,10 @@ +const unzipWith = (arr, fn) => +arr +.reduce( +(acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc), +Array.from({ +length: Math.max(...arr.map(x => x.length)) +}).map(x => []) +) +.map(val => fn(...val)); +module.exports = unzipWith \ No newline at end of file diff --git a/test/unzipWith/unzipWith.test.js b/test/unzipWith/unzipWith.test.js new file mode 100644 index 000000000..09f3d2429 --- /dev/null +++ b/test/unzipWith/unzipWith.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const unzipWith = require('./unzipWith.js'); + +test('Testing unzipWith', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof unzipWith === 'function', 'unzipWith is a Function'); + //t.deepEqual(unzipWith(args..), 'Expected'); + //t.equal(unzipWith(args..), 'Expected'); + //t.false(unzipWith(args..), 'Expected'); + //t.throws(unzipWith(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/validateNumber/validateNumber.js b/test/validateNumber/validateNumber.js index 05e4a8a06..1b03adf29 100644 --- a/test/validateNumber/validateNumber.js +++ b/test/validateNumber/validateNumber.js @@ -1,2 +1,2 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n; - module.exports = validateNumber \ No newline at end of file +module.exports = validateNumber \ No newline at end of file diff --git a/test/without/without.js b/test/without/without.js index ffd99a9d3..598b31253 100644 --- a/test/without/without.js +++ b/test/without/without.js @@ -1,2 +1,2 @@ const without = (arr, ...args) => arr.filter(v => !args.includes(v)); - module.exports = without \ No newline at end of file +module.exports = without \ No newline at end of file diff --git a/test/words/words.js b/test/words/words.js index 936b7d6ca..d26c714fa 100644 --- a/test/words/words.js +++ b/test/words/words.js @@ -1,2 +1,2 @@ const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean); - module.exports = words \ No newline at end of file +module.exports = words \ No newline at end of file diff --git a/test/yesNo/yesNo.js b/test/yesNo/yesNo.js index 437338d17..11a2a248a 100644 --- a/test/yesNo/yesNo.js +++ b/test/yesNo/yesNo.js @@ -1,3 +1,3 @@ const yesNo = (val, def = false) => /^(y|yes)$/i.test(val) ? true : /^(n|no)$/i.test(val) ? false : def; - module.exports = yesNo \ No newline at end of file +module.exports = yesNo \ No newline at end of file diff --git a/test/zip/zip.js b/test/zip/zip.js index e248b5de5..60ad9d244 100644 --- a/test/zip/zip.js +++ b/test/zip/zip.js @@ -4,4 +4,4 @@ return Array.from({ length: maxLength }).map((_, i) => { return Array.from({ length: arrays.length }, (_, k) => arrays[k][i]); }); }; - module.exports = zip \ No newline at end of file +module.exports = zip \ No newline at end of file diff --git a/test/zipObject/zipObject.js b/test/zipObject/zipObject.js index 7e1f6f633..e077594b4 100644 --- a/test/zipObject/zipObject.js +++ b/test/zipObject/zipObject.js @@ -1,3 +1,3 @@ const zipObject = (props, values) => props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); - module.exports = zipObject \ No newline at end of file +module.exports = zipObject \ No newline at end of file diff --git a/test/zipWith/zipWith.js b/test/zipWith/zipWith.js index 7c0336738..39d5d18bb 100644 --- a/test/zipWith/zipWith.js +++ b/test/zipWith/zipWith.js @@ -8,4 +8,4 @@ return Array.from({ length: arrays.length }, (_, k) => arrays[k][i]); }); return fn ? result.map(arr => fn(...arr)) : result; }; - module.exports = zipWith \ No newline at end of file +module.exports = zipWith \ No newline at end of file From 03af5b878378241cf372dcc96972e5b9948b1ee2 Mon Sep 17 00:00:00 2001 From: King Date: Wed, 24 Jan 2018 06:30:59 -0500 Subject: [PATCH 3/4] update invertKeyValues with basic proper passing test --- test/invertKeyValues/invertKeyValues.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/invertKeyValues/invertKeyValues.test.js b/test/invertKeyValues/invertKeyValues.test.js index 41c0a4bc0..d51d06314 100644 --- a/test/invertKeyValues/invertKeyValues.test.js +++ b/test/invertKeyValues/invertKeyValues.test.js @@ -5,7 +5,8 @@ test('Testing invertKeyValues', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof invertKeyValues === 'function', 'invertKeyValues is a Function'); - t.deepEqual(invertKeyValues({ name: 'John', age: 20 }), { 20: 'age', John: 'name' }, "Inverts the key-value pairs of an object"); + t.deepEqual(invertKeyValues({ a: 1, b: 2, c: 1 }), { 1: [ 'a', 'c' ], 2: [ 'b' ] }, "invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] }"); + t.deepEqual(invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value), { group1: [ 'a', 'c' ], group2: [ 'b' ] }, "invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] }"); //t.deepEqual(invertKeyValues(args..), 'Expected'); //t.equal(invertKeyValues(args..), 'Expected'); //t.false(invertKeyValues(args..), 'Expected'); From cb18d85f94470ef5ea5a517faa0703b28f693dd2 Mon Sep 17 00:00:00 2001 From: King Date: Wed, 24 Jan 2018 06:32:11 -0500 Subject: [PATCH 4/4] ran npm run tester problem fixed and add updated test log --- test/testlog | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/test/testlog b/test/testlog index 3ea9fa418..b864db66f 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Wed Jan 24 2018 06:26:20 GMT-0500 (Eastern Standard Time) +Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) > 30-seconds-of-code@0.0.1 test C:\Users\King David\Desktop\github-repo\30-seconds-of-code > tape test/**/*.test.js | tap-spec @@ -533,16 +533,8 @@ Test log for: Wed Jan 24 2018 06:26:20 GMT-0500 (Eastern Standard Time) Testing invertKeyValues √ invertKeyValues is a Function - - × Inverts the key-value pairs of an object - ------------------------------------------- - operator: deepEqual - expected: |- - { 20: 'age', John: 'name' } - actual: |- - { 20: [ 'age' ], John: [ 'name' ] } - stack: |- - + √ invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] } + √ invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] } Testing is @@ -1398,18 +1390,8 @@ Test log for: Wed Jan 24 2018 06:26:20 GMT-0500 (Eastern Standard Time) √ zipWith is a Function - - Failed Tests: There was 1 failure - - Testing invertKeyValues - - × Inverts the key-value pairs of an object + total: 587 + passing: 587 + duration: 520ms - total: 586 - passing: 585 - failing: 1 - duration: 521ms - - -undefined \ No newline at end of file