diff --git a/scripts/tdd.js b/scripts/tdd.js index 1026aaecb..f58551118 100644 --- a/scripts/tdd.js +++ b/scripts/tdd.js @@ -22,8 +22,8 @@ const snippetFiles = []; const snippetFilesActive = fs.readdirSync(SNIPPETS_ACTIVE, 'utf8').map(fileName => fileName.slice(0, -3)); const snippetFilesArchive = fs.readdirSync(SNIPPETS_ARCHIVE, 'utf8') - .filter(fileName => !fileName.includes('README')) // -> Filters out main README.md file in Archieve which isn't a snippet - .map(fileName => fileName.slice(0, -3)); + .filter(fileName => !fileName.includes('README')) // -> Filters out main README.md file in Archieve which isn't a snippet + .map(fileName => fileName.slice(0, -3)); snippetFiles.push(...snippetFilesActive); snippetFiles.push(...snippetFilesArchive); @@ -45,19 +45,19 @@ snippetFiles const fileCode = fileData.slice(fileData.search(/```\s*js/i), fileData.lastIndexOf('```') + 3); // Split code based on code markers const blockMarkers = fileCode - .split('\n') - .map((line, lineIndex) => (line.slice(0, 3) === '```' ? lineIndex : '//CLEAR//')) - .filter(x => !(x === '//CLEAR//')); + .split('\n') + .map((line, lineIndex) => (line.slice(0, 3) === '```' ? lineIndex : '//CLEAR//')) + .filter(x => !(x === '//CLEAR//')); // Grab snippet function based on code markers const fileFunction = fileCode - .split('\n') - .map(line => line.trim()) - .filter((_, i) => blockMarkers[0] < i && i < blockMarkers[1]); + .split('\n') + .map(line => line) + .filter((_, i) => blockMarkers[0] < i && i < blockMarkers[1]).concat(''); // Grab snippet example based on code markers const fileExample = fileCode - .split('\n') - .map(line => line.trim()) - .filter((_, i) => blockMarkers[2] < i && i < blockMarkers[3]); + .split('\n') + .map(line => line) + .filter((_, i) => blockMarkers[2] < i && i < blockMarkers[3]).concat(''); // Export template for snippetName.js const exportFile = `${fileFunction.join('\n')}\nmodule.exports = ${fileName};`.trim(); diff --git a/test/CSVToArray/CSVToArray.js b/test/CSVToArray/CSVToArray.js index 4633b20ca..6be3fcbf9 100644 --- a/test/CSVToArray/CSVToArray.js +++ b/test/CSVToArray/CSVToArray.js @@ -1,6 +1,7 @@ const CSVToArray = (data, delimiter = ',', omitFirstRow = false) => -data -.slice(omitFirstRow ? data.indexOf('\n') + 1 : 0) -.split('\n') -.map(v => v.split(delimiter)); + data + .slice(omitFirstRow ? data.indexOf('\n') + 1 : 0) + .split('\n') + .map(v => v.split(delimiter)); + module.exports = CSVToArray; \ No newline at end of file diff --git a/test/CSVToJSON/CSVToJSON.js b/test/CSVToJSON/CSVToJSON.js index 2af55ff2f..4a0cc4c3f 100644 --- a/test/CSVToJSON/CSVToJSON.js +++ b/test/CSVToJSON/CSVToJSON.js @@ -1,11 +1,12 @@ const CSVToJSON = (data, delimiter = ',') => { -const titles = data.slice(0, data.indexOf('\n')).split(delimiter); -return data -.slice(data.indexOf('\n') + 1) -.split('\n') -.map(v => { -const values = v.split(delimiter); -return titles.reduce((obj, title, index) => ((obj[title] = values[index]), obj), {}); -}); + const titles = data.slice(0, data.indexOf('\n')).split(delimiter); + return data + .slice(data.indexOf('\n') + 1) + .split('\n') + .map(v => { + const values = v.split(delimiter); + return titles.reduce((obj, title, index) => ((obj[title] = values[index]), obj), {}); + }); }; + module.exports = CSVToJSON; \ No newline at end of file diff --git a/test/JSONToDate/JSONToDate.js b/test/JSONToDate/JSONToDate.js index 943251c96..5e105552c 100644 --- a/test/JSONToDate/JSONToDate.js +++ b/test/JSONToDate/JSONToDate.js @@ -1,5 +1,6 @@ const JSONToDate = arr => { -const dt = new Date(parseInt(arr.toString().substr(6))); -return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`; + 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 diff --git a/test/JSONToFile/JSONToFile.js b/test/JSONToFile/JSONToFile.js index 8ae6fedcd..845f6a68e 100644 --- a/test/JSONToFile/JSONToFile.js +++ b/test/JSONToFile/JSONToFile.js @@ -1,4 +1,5 @@ const fs = require('fs'); const JSONToFile = (obj, filename) => -fs.writeFile(`${filename}.json`, JSON.stringify(obj, null, 2)); + fs.writeFile(`${filename}.json`, JSON.stringify(obj, null, 2)); + module.exports = JSONToFile; \ No newline at end of file diff --git a/test/JSONtoCSV/JSONtoCSV.js b/test/JSONtoCSV/JSONtoCSV.js index 912f55338..b21309541 100644 --- a/test/JSONtoCSV/JSONtoCSV.js +++ b/test/JSONtoCSV/JSONtoCSV.js @@ -1,11 +1,12 @@ const JSONtoCSV = (arr, columns, delimiter = ',') => -[ -columns.join(delimiter), -...arr.map(obj => -columns.reduce( -(acc, key) => `${acc}${!acc.length ? '' : delimiter}"${!obj[key] ? '' : obj[key]}"`, -'' -) -) -].join('\n'); + [ + columns.join(delimiter), + ...arr.map(obj => + columns.reduce( + (acc, key) => `${acc}${!acc.length ? '' : delimiter}"${!obj[key] ? '' : obj[key]}"`, + '' + ) + ) + ].join('\n'); + module.exports = JSONtoCSV; \ No newline at end of file diff --git a/test/RGBToHex/RGBToHex.js b/test/RGBToHex/RGBToHex.js index fdb1c63d0..ef8c66397 100644 --- a/test/RGBToHex/RGBToHex.js +++ b/test/RGBToHex/RGBToHex.js @@ -1,2 +1,3 @@ const RGBToHex = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0'); + module.exports = RGBToHex; \ No newline at end of file diff --git a/test/URLJoin/URLJoin.js b/test/URLJoin/URLJoin.js index 0125c4ffa..09acf40aa 100644 --- a/test/URLJoin/URLJoin.js +++ b/test/URLJoin/URLJoin.js @@ -1,10 +1,11 @@ const URLJoin = (...args) => -args -.join('/') -.replace(/[\/]+/g, '/') -.replace(/^(.+):\//, '$1://') -.replace(/^file:/, 'file:/') -.replace(/\/(\?|&|#[^!])/g, '$1') -.replace(/\?/g, '&') -.replace('&', '?'); + args + .join('/') + .replace(/[\/]+/g, '/') + .replace(/^(.+):\//, '$1://') + .replace(/^file:/, 'file:/') + .replace(/\/(\?|&|#[^!])/g, '$1') + .replace(/\?/g, '&') + .replace('&', '?'); + module.exports = URLJoin; \ No newline at end of file diff --git a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js index 30b17a372..36c17350c 100644 --- a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js +++ b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js @@ -1,5 +1,6 @@ const UUIDGeneratorBrowser = () => -([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => -(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16) -); + ([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 diff --git a/test/UUIDGeneratorNode/UUIDGeneratorNode.js b/test/UUIDGeneratorNode/UUIDGeneratorNode.js index 862fa79e1..7ae5509e2 100644 --- a/test/UUIDGeneratorNode/UUIDGeneratorNode.js +++ b/test/UUIDGeneratorNode/UUIDGeneratorNode.js @@ -1,6 +1,7 @@ const crypto = require('crypto'); const UUIDGeneratorNode = () => -([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => -(c ^ (crypto.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16) -); + ([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 diff --git a/test/all/all.js b/test/all/all.js index 6be892a3c..1853a403d 100644 --- a/test/all/all.js +++ b/test/all/all.js @@ -1,2 +1,3 @@ const all = (arr, fn = Boolean) => arr.every(fn); + module.exports = all; \ No newline at end of file diff --git a/test/any/any.js b/test/any/any.js index 5004b3309..199487eb0 100644 --- a/test/any/any.js +++ b/test/any/any.js @@ -1,2 +1,3 @@ const any = (arr, fn = Boolean) => arr.some(fn); + module.exports = any; \ No newline at end of file diff --git a/test/approximatelyEqual/approximatelyEqual.js b/test/approximatelyEqual/approximatelyEqual.js index 85fecb15b..e52f6fb13 100644 --- a/test/approximatelyEqual/approximatelyEqual.js +++ b/test/approximatelyEqual/approximatelyEqual.js @@ -1,2 +1,3 @@ const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon; + module.exports = approximatelyEqual; \ No newline at end of file diff --git a/test/arrayToCSV/arrayToCSV.js b/test/arrayToCSV/arrayToCSV.js index 3ea9107e6..60404acad 100644 --- a/test/arrayToCSV/arrayToCSV.js +++ b/test/arrayToCSV/arrayToCSV.js @@ -1,3 +1,4 @@ const arrayToCSV = (arr, delimiter = ',') => -arr.map(v => v.map(x => `"${x}"`).join(delimiter)).join('\n'); + arr.map(v => v.map(x => `"${x}"`).join(delimiter)).join('\n'); + module.exports = arrayToCSV; \ No newline at end of file diff --git a/test/arrayToHtmlList/arrayToHtmlList.js b/test/arrayToHtmlList/arrayToHtmlList.js index adf036170..a9c054d9f 100644 --- a/test/arrayToHtmlList/arrayToHtmlList.js +++ b/test/arrayToHtmlList/arrayToHtmlList.js @@ -1,6 +1,7 @@ const arrayToHtmlList = (arr, listID) => -(el => ( -(el = document.querySelector('#' + listID)), -(el.innerHTML += arr.map(item => `
  • ${item}
  • `).join('')) -))(); + (el => ( + (el = document.querySelector('#' + listID)), + (el.innerHTML += arr.map(item => `
  • ${item}
  • `).join('')) + ))(); + module.exports = arrayToHtmlList; \ No newline at end of file diff --git a/test/ary/ary.js b/test/ary/ary.js index 1244bba0c..8a0c2feb7 100644 --- a/test/ary/ary.js +++ b/test/ary/ary.js @@ -1,2 +1,3 @@ const ary = (fn, n) => (...args) => fn(...args.slice(0, n)); + module.exports = ary; \ No newline at end of file diff --git a/test/atob/atob.js b/test/atob/atob.js index 6ec0acff6..dad9e8dd7 100644 --- a/test/atob/atob.js +++ b/test/atob/atob.js @@ -1,2 +1,3 @@ const atob = str => new Buffer(str, 'base64').toString('binary'); + module.exports = atob; \ No newline at end of file diff --git a/test/attempt/attempt.js b/test/attempt/attempt.js index 1958d9800..ab9a0571c 100644 --- a/test/attempt/attempt.js +++ b/test/attempt/attempt.js @@ -1,8 +1,9 @@ const attempt = (fn, ...args) => { -try { -return fn(...args); -} catch (e) { -return e instanceof Error ? e : new Error(e); -} + try { + return fn(...args); + } catch (e) { + return e instanceof Error ? e : new Error(e); + } }; + module.exports = attempt; \ No newline at end of file diff --git a/test/average/average.js b/test/average/average.js index 53c4f96e0..6e59a3905 100644 --- a/test/average/average.js +++ b/test/average/average.js @@ -1,2 +1,3 @@ const average = (...nums) => [...nums].reduce((acc, val) => acc + val, 0) / nums.length; + module.exports = average; \ No newline at end of file diff --git a/test/averageBy/averageBy.js b/test/averageBy/averageBy.js index 97dfedb32..467eb315f 100644 --- a/test/averageBy/averageBy.js +++ b/test/averageBy/averageBy.js @@ -1,4 +1,5 @@ const averageBy = (arr, fn) => -arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0) / -arr.length; + 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 diff --git a/test/bifurcate/bifurcate.js b/test/bifurcate/bifurcate.js index 95d7f8f50..d60896409 100644 --- a/test/bifurcate/bifurcate.js +++ b/test/bifurcate/bifurcate.js @@ -1,3 +1,4 @@ const bifurcate = (arr, filter) => -arr.reduce((acc, val, i) => (acc[filter[i] ? 0 : 1].push(val), acc), [[], []]); + arr.reduce((acc, val, i) => (acc[filter[i] ? 0 : 1].push(val), acc), [[], []]); + module.exports = bifurcate; \ No newline at end of file diff --git a/test/bifurcateBy/bifurcateBy.js b/test/bifurcateBy/bifurcateBy.js index bdf04a7ce..f2f1a2298 100644 --- a/test/bifurcateBy/bifurcateBy.js +++ b/test/bifurcateBy/bifurcateBy.js @@ -1,3 +1,4 @@ const bifurcateBy = (arr, fn) => -arr.reduce((acc, val, i) => (acc[fn(val, i) ? 0 : 1].push(val), acc), [[], []]); + arr.reduce((acc, val, i) => (acc[fn(val, i) ? 0 : 1].push(val), acc), [[], []]); + module.exports = bifurcateBy; \ No newline at end of file diff --git a/test/binarySearch/binarySearch.js b/test/binarySearch/binarySearch.js index b352de700..6c7551010 100644 --- a/test/binarySearch/binarySearch.js +++ b/test/binarySearch/binarySearch.js @@ -1,8 +1,9 @@ const binarySearch = (arr, val, start = 0, end = arr.length - 1) => { -if (start > end) return -1; -const mid = Math.floor((start + end) / 2); -if (arr[mid] > val) return binarySearch(arr, val, start, mid - 1); -if (arr[mid] < val) return binarySearch(arr, val, mid + 1, end); -return mid; + if (start > end) return -1; + const mid = Math.floor((start + end) / 2); + 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 diff --git a/test/bind/bind.js b/test/bind/bind.js index 31e295e77..8e53e7051 100644 --- a/test/bind/bind.js +++ b/test/bind/bind.js @@ -1,5 +1,6 @@ const bind = (fn, context, ...args) => -function() { -return fn.apply(context, args.concat(...arguments)); -}; + function() { + return fn.apply(context, args.concat(...arguments)); + }; + module.exports = bind; \ No newline at end of file diff --git a/test/bindAll/bindAll.js b/test/bindAll/bindAll.js index afbd74026..2bc623aa0 100644 --- a/test/bindAll/bindAll.js +++ b/test/bindAll/bindAll.js @@ -1,10 +1,11 @@ const bindAll = (obj, ...fns) => -fns.forEach( -fn => ( -(f = obj[fn]), -(obj[fn] = function() { -return f.apply(obj); -}) -) -); + fns.forEach( + fn => ( + (f = obj[fn]), + (obj[fn] = function() { + return f.apply(obj); + }) + ) + ); + module.exports = bindAll; \ No newline at end of file diff --git a/test/bindKey/bindKey.js b/test/bindKey/bindKey.js index 04645b19e..5a573fb54 100644 --- a/test/bindKey/bindKey.js +++ b/test/bindKey/bindKey.js @@ -1,5 +1,6 @@ const bindKey = (context, fn, ...args) => -function() { -return context[fn].apply(context, args.concat(...arguments)); -}; + function() { + return context[fn].apply(context, args.concat(...arguments)); + }; + module.exports = bindKey; \ No newline at end of file diff --git a/test/binomialCoefficient/binomialCoefficient.js b/test/binomialCoefficient/binomialCoefficient.js index a9808585d..95f1fdbd8 100644 --- a/test/binomialCoefficient/binomialCoefficient.js +++ b/test/binomialCoefficient/binomialCoefficient.js @@ -1,11 +1,12 @@ const binomialCoefficient = (n, k) => { -if (Number.isNaN(n) || Number.isNaN(k)) return NaN; -if (k < 0 || k > n) return 0; -if (k === 0 || k === n) return 1; -if (k === 1 || k === n - 1) return n; -if (n - k < k) k = n - k; -let res = n; -for (let j = 2; j <= k; j++) res *= (n - j + 1) / j; -return Math.round(res); + if (Number.isNaN(n) || Number.isNaN(k)) return NaN; + if (k < 0 || k > n) return 0; + if (k === 0 || k === n) return 1; + if (k === 1 || k === n - 1) return n; + if (n - k < k) k = n - k; + let res = n; + for (let j = 2; j <= k; j++) res *= (n - j + 1) / j; + return Math.round(res); }; + module.exports = binomialCoefficient; \ No newline at end of file diff --git a/test/bottomVisible/bottomVisible.js b/test/bottomVisible/bottomVisible.js index 298fa122f..576eddd4e 100644 --- a/test/bottomVisible/bottomVisible.js +++ b/test/bottomVisible/bottomVisible.js @@ -1,4 +1,5 @@ const bottomVisible = () => -document.documentElement.clientHeight + window.scrollY >= -(document.documentElement.scrollHeight || document.documentElement.clientHeight); + document.documentElement.clientHeight + window.scrollY >= + (document.documentElement.scrollHeight || document.documentElement.clientHeight); + module.exports = bottomVisible; \ No newline at end of file diff --git a/test/btoa/btoa.js b/test/btoa/btoa.js index 56098b744..eb2a97a95 100644 --- a/test/btoa/btoa.js +++ b/test/btoa/btoa.js @@ -1,2 +1,3 @@ const btoa = str => new Buffer(str, 'binary').toString('base64'); + module.exports = btoa; \ No newline at end of file diff --git a/test/byteSize/byteSize.js b/test/byteSize/byteSize.js index 591328a31..26ae2758a 100644 --- a/test/byteSize/byteSize.js +++ b/test/byteSize/byteSize.js @@ -1,2 +1,3 @@ const byteSize = str => new Blob([str]).size; + module.exports = byteSize; \ No newline at end of file diff --git a/test/call/call.js b/test/call/call.js index 57ceb4de3..d633114e5 100644 --- a/test/call/call.js +++ b/test/call/call.js @@ -1,2 +1,3 @@ const call = (key, ...args) => context => context[key](...args); + module.exports = call; \ No newline at end of file diff --git a/test/capitalize/capitalize.js b/test/capitalize/capitalize.js index 3288a50d3..2626ccf09 100644 --- a/test/capitalize/capitalize.js +++ b/test/capitalize/capitalize.js @@ -1,3 +1,4 @@ const capitalize = ([first, ...rest], lowerRest = false) => -first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join('')); + first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join('')); + module.exports = capitalize; \ No newline at end of file diff --git a/test/capitalizeEveryWord/capitalizeEveryWord.js b/test/capitalizeEveryWord/capitalizeEveryWord.js index ba4f0bfd9..4136337fa 100644 --- a/test/capitalizeEveryWord/capitalizeEveryWord.js +++ b/test/capitalizeEveryWord/capitalizeEveryWord.js @@ -1,2 +1,3 @@ const capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCase()); + module.exports = capitalizeEveryWord; \ No newline at end of file diff --git a/test/castArray/castArray.js b/test/castArray/castArray.js index 74beb1184..1e99084c7 100644 --- a/test/castArray/castArray.js +++ b/test/castArray/castArray.js @@ -1,2 +1,3 @@ const castArray = val => (Array.isArray(val) ? val : [val]); + module.exports = castArray; \ No newline at end of file diff --git a/test/chainAsync/chainAsync.js b/test/chainAsync/chainAsync.js index a1456675c..c0f95b08d 100644 --- a/test/chainAsync/chainAsync.js +++ b/test/chainAsync/chainAsync.js @@ -1,6 +1,7 @@ const chainAsync = fns => { -let curr = 0; -const next = () => fns[curr++](next); -next(); + let curr = 0; + const next = () => fns[curr++](next); + next(); }; + module.exports = chainAsync; \ No newline at end of file diff --git a/test/chunk/chunk.js b/test/chunk/chunk.js index f260eb566..d110d6306 100644 --- a/test/chunk/chunk.js +++ b/test/chunk/chunk.js @@ -1,5 +1,6 @@ const chunk = (arr, size) => -Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => -arr.slice(i * size, i * size + 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 diff --git a/test/clampNumber/clampNumber.js b/test/clampNumber/clampNumber.js index 17265b603..c1e5220cc 100644 --- a/test/clampNumber/clampNumber.js +++ b/test/clampNumber/clampNumber.js @@ -1,2 +1,3 @@ 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 diff --git a/test/cleanObj/cleanObj.js b/test/cleanObj/cleanObj.js index 0d38b03f8..e41c5dad0 100644 --- a/test/cleanObj/cleanObj.js +++ b/test/cleanObj/cleanObj.js @@ -1,11 +1,12 @@ const cleanObj = (obj, keysToKeep = [], childIndicator) => { -Object.keys(obj).forEach(key => { -if (key === childIndicator) { -cleanObj(obj[key], keysToKeep, childIndicator); -} else if (!keysToKeep.includes(key)) { -delete obj[key]; -} -}); -return obj; + Object.keys(obj).forEach(key => { + if (key === childIndicator) { + cleanObj(obj[key], keysToKeep, childIndicator); + } else if (!keysToKeep.includes(key)) { + delete obj[key]; + } + }); + return obj; }; + module.exports = cleanObj; \ No newline at end of file diff --git a/test/cloneRegExp/cloneRegExp.js b/test/cloneRegExp/cloneRegExp.js index 762a4e623..9caac6a2f 100644 --- a/test/cloneRegExp/cloneRegExp.js +++ b/test/cloneRegExp/cloneRegExp.js @@ -1,2 +1,3 @@ const cloneRegExp = regExp => new RegExp(regExp.source, regExp.flags); + module.exports = cloneRegExp; \ No newline at end of file diff --git a/test/coalesce/coalesce.js b/test/coalesce/coalesce.js index e2333a321..f735939d9 100644 --- a/test/coalesce/coalesce.js +++ b/test/coalesce/coalesce.js @@ -1,2 +1,3 @@ const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_)); + module.exports = coalesce; \ No newline at end of file diff --git a/test/coalesceFactory/coalesceFactory.js b/test/coalesceFactory/coalesceFactory.js index d21c07200..aa1eecac2 100644 --- a/test/coalesceFactory/coalesceFactory.js +++ b/test/coalesceFactory/coalesceFactory.js @@ -1,2 +1,3 @@ const coalesceFactory = valid => (...args) => args.find(valid); + module.exports = coalesceFactory; \ No newline at end of file diff --git a/test/collatz/collatz.js b/test/collatz/collatz.js index f29036272..f996a91e3 100644 --- a/test/collatz/collatz.js +++ b/test/collatz/collatz.js @@ -1,2 +1,3 @@ const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1); + module.exports = collatz; \ No newline at end of file diff --git a/test/collectInto/collectInto.js b/test/collectInto/collectInto.js index 61da731c5..745ed9671 100644 --- a/test/collectInto/collectInto.js +++ b/test/collectInto/collectInto.js @@ -1,2 +1,3 @@ const collectInto = fn => (...args) => fn(args); + module.exports = collectInto; \ No newline at end of file diff --git a/test/colorize/colorize.js b/test/colorize/colorize.js index 7c8fe1846..3e83f7069 100644 --- a/test/colorize/colorize.js +++ b/test/colorize/colorize.js @@ -1,19 +1,20 @@ const colorize = (...args) => ({ -black: `\x1b[30m${args.join(' ')}`, -red: `\x1b[31m${args.join(' ')}`, -green: `\x1b[32m${args.join(' ')}`, -yellow: `\x1b[33m${args.join(' ')}`, -blue: `\x1b[34m${args.join(' ')}`, -magenta: `\x1b[35m${args.join(' ')}`, -cyan: `\x1b[36m${args.join(' ')}`, -white: `\x1b[37m${args.join(' ')}`, -bgBlack: `\x1b[40m${args.join(' ')}\x1b[0m`, -bgRed: `\x1b[41m${args.join(' ')}\x1b[0m`, -bgGreen: `\x1b[42m${args.join(' ')}\x1b[0m`, -bgYellow: `\x1b[43m${args.join(' ')}\x1b[0m`, -bgBlue: `\x1b[44m${args.join(' ')}\x1b[0m`, -bgMagenta: `\x1b[45m${args.join(' ')}\x1b[0m`, -bgCyan: `\x1b[46m${args.join(' ')}\x1b[0m`, -bgWhite: `\x1b[47m${args.join(' ')}\x1b[0m` + black: `\x1b[30m${args.join(' ')}`, + red: `\x1b[31m${args.join(' ')}`, + green: `\x1b[32m${args.join(' ')}`, + yellow: `\x1b[33m${args.join(' ')}`, + blue: `\x1b[34m${args.join(' ')}`, + magenta: `\x1b[35m${args.join(' ')}`, + cyan: `\x1b[36m${args.join(' ')}`, + white: `\x1b[37m${args.join(' ')}`, + bgBlack: `\x1b[40m${args.join(' ')}\x1b[0m`, + bgRed: `\x1b[41m${args.join(' ')}\x1b[0m`, + bgGreen: `\x1b[42m${args.join(' ')}\x1b[0m`, + bgYellow: `\x1b[43m${args.join(' ')}\x1b[0m`, + bgBlue: `\x1b[44m${args.join(' ')}\x1b[0m`, + 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 diff --git a/test/compact/compact.js b/test/compact/compact.js index 52927b836..d21ec2f35 100644 --- a/test/compact/compact.js +++ b/test/compact/compact.js @@ -1,2 +1,3 @@ const compact = arr => arr.filter(Boolean); + module.exports = compact; \ No newline at end of file diff --git a/test/compose/compose.js b/test/compose/compose.js index eaacf7fc2..c9d6ccdf6 100644 --- a/test/compose/compose.js +++ b/test/compose/compose.js @@ -1,2 +1,3 @@ const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); + module.exports = compose; \ No newline at end of file diff --git a/test/composeRight/composeRight.js b/test/composeRight/composeRight.js index 4474298bb..4f6a42124 100644 --- a/test/composeRight/composeRight.js +++ b/test/composeRight/composeRight.js @@ -1,2 +1,3 @@ const composeRight = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); + module.exports = composeRight; \ No newline at end of file diff --git a/test/converge/converge.js b/test/converge/converge.js index 292fee1e1..bd43cbac1 100644 --- a/test/converge/converge.js +++ b/test/converge/converge.js @@ -1,2 +1,3 @@ const converge = (converger, fns) => (...args) => converger(...fns.map(fn => fn.apply(null, args))); + module.exports = converge; \ No newline at end of file diff --git a/test/copyToClipboard/copyToClipboard.js b/test/copyToClipboard/copyToClipboard.js index 9c35cee65..5b9c710be 100644 --- a/test/copyToClipboard/copyToClipboard.js +++ b/test/copyToClipboard/copyToClipboard.js @@ -1,18 +1,19 @@ const copyToClipboard = str => { -const el = document.createElement('textarea'); -el.value = str; -el.setAttribute('readonly', ''); -el.style.position = 'absolute'; -el.style.left = '-9999px'; -document.body.appendChild(el); -const selected = -document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false; -el.select(); -document.execCommand('copy'); -document.body.removeChild(el); -if (selected) { -document.getSelection().removeAllRanges(); -document.getSelection().addRange(selected); -} + const el = document.createElement('textarea'); + el.value = str; + el.setAttribute('readonly', ''); + el.style.position = 'absolute'; + el.style.left = '-9999px'; + document.body.appendChild(el); + const selected = + document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false; + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + if (selected) { + document.getSelection().removeAllRanges(); + document.getSelection().addRange(selected); + } }; + module.exports = copyToClipboard; \ No newline at end of file diff --git a/test/countBy/countBy.js b/test/countBy/countBy.js index 256070afb..7a8b3c9cc 100644 --- a/test/countBy/countBy.js +++ b/test/countBy/countBy.js @@ -1,6 +1,7 @@ const countBy = (arr, fn) => -arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => { -acc[val] = (acc[val] || 0) + 1; -return acc; -}, {}); + 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 diff --git a/test/countOccurrences/countOccurrences.js b/test/countOccurrences/countOccurrences.js index 2a2fa8852..63e7feaf7 100644 --- a/test/countOccurrences/countOccurrences.js +++ b/test/countOccurrences/countOccurrences.js @@ -1,2 +1,3 @@ const countOccurrences = (arr, val) => arr.reduce((a, v) => (v === val ? a + 1 : a), 0); + module.exports = countOccurrences; \ No newline at end of file diff --git a/test/countVowels/countVowels.js b/test/countVowels/countVowels.js index 1f9fe96a5..d8f6ee57e 100644 --- a/test/countVowels/countVowels.js +++ b/test/countVowels/countVowels.js @@ -1,2 +1,3 @@ const countVowels = str => (str.match(/[aeiou]/gi) || []).length; + module.exports = countVowels; \ No newline at end of file diff --git a/test/counter/counter.js b/test/counter/counter.js index dd11117a1..fef9b1ce4 100644 --- a/test/counter/counter.js +++ b/test/counter/counter.js @@ -1,12 +1,13 @@ const counter = (selector, start, end, step = 1, duration = 2000) => { -let current = start, -_step = (end - start) * step < 0 ? -step : step, -timer = setInterval(() => { -current += _step; -document.querySelector(selector).innerHTML = current; -if (current >= end) document.querySelector(selector).innerHTML = end; -if (current >= end) clearInterval(timer); -}, Math.abs(Math.floor(duration / (end - start)))); -return timer; + let current = start, + _step = (end - start) * step < 0 ? -step : step, + timer = setInterval(() => { + current += _step; + document.querySelector(selector).innerHTML = current; + if (current >= end) document.querySelector(selector).innerHTML = end; + if (current >= end) clearInterval(timer); + }, Math.abs(Math.floor(duration / (end - start)))); + return timer; }; + module.exports = counter; \ No newline at end of file diff --git a/test/createElement/createElement.js b/test/createElement/createElement.js index becd41371..22d92d428 100644 --- a/test/createElement/createElement.js +++ b/test/createElement/createElement.js @@ -1,6 +1,7 @@ const createElement = str => { -const el = document.createElement('div'); -el.innerHTML = str; -return el.firstElementChild; + const el = document.createElement('div'); + el.innerHTML = str; + return el.firstElementChild; }; + module.exports = createElement; \ No newline at end of file diff --git a/test/createEventHub/createEventHub.js b/test/createEventHub/createEventHub.js index 949f8fbc0..390d28e53 100644 --- a/test/createEventHub/createEventHub.js +++ b/test/createEventHub/createEventHub.js @@ -1,15 +1,16 @@ const createEventHub = () => ({ -hub: Object.create(null), -emit(event, data) { -(this.hub[event] || []).forEach(handler => handler(data)); -}, -on(event, handler) { -if (!this.hub[event]) this.hub[event] = []; -this.hub[event].push(handler); -}, -off(event, handler) { -const i = (this.hub[event] || []).findIndex(h => h === handler); -if (i > -1) this.hub[event].splice(i, 1); -} + hub: Object.create(null), + emit(event, data) { + (this.hub[event] || []).forEach(handler => handler(data)); + }, + on(event, handler) { + if (!this.hub[event]) this.hub[event] = []; + this.hub[event].push(handler); + }, + off(event, handler) { + 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 diff --git a/test/currentURL/currentURL.js b/test/currentURL/currentURL.js index 0d849248e..ae92dbf67 100644 --- a/test/currentURL/currentURL.js +++ b/test/currentURL/currentURL.js @@ -1,2 +1,3 @@ const currentURL = () => window.location.href; + module.exports = currentURL; \ No newline at end of file diff --git a/test/curry/curry.js b/test/curry/curry.js index 152faf1e0..a2211d9a7 100644 --- a/test/curry/curry.js +++ b/test/curry/curry.js @@ -1,3 +1,4 @@ const curry = (fn, arity = fn.length, ...args) => -arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args); + arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args); + module.exports = curry; \ No newline at end of file diff --git a/test/debounce/debounce.js b/test/debounce/debounce.js index 6ea306ac1..e71edd9cc 100644 --- a/test/debounce/debounce.js +++ b/test/debounce/debounce.js @@ -1,8 +1,9 @@ const debounce = (fn, ms = 0) => { -let timeoutId; -return function(...args) { -clearTimeout(timeoutId); -timeoutId = setTimeout(() => fn.apply(this, args), ms); -}; + let timeoutId; + return function(...args) { + clearTimeout(timeoutId); + timeoutId = setTimeout(() => fn.apply(this, args), ms); + }; }; + module.exports = debounce; \ No newline at end of file diff --git a/test/decapitalize/decapitalize.js b/test/decapitalize/decapitalize.js index b124df72c..965d9bc16 100644 --- a/test/decapitalize/decapitalize.js +++ b/test/decapitalize/decapitalize.js @@ -1,3 +1,4 @@ const decapitalize = ([first, ...rest], upperRest = false) => -first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); + first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); + module.exports = decapitalize; \ No newline at end of file diff --git a/test/deepClone/deepClone.js b/test/deepClone/deepClone.js index b82e566b7..ba574b7e7 100644 --- a/test/deepClone/deepClone.js +++ b/test/deepClone/deepClone.js @@ -1,8 +1,9 @@ const deepClone = obj => { -let clone = Object.assign({}, obj); -Object.keys(clone).forEach( -key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key]) -); -return Array.isArray(obj) ? (clone.length = obj.length) && Array.from(clone) : clone; + let clone = Object.assign({}, obj); + Object.keys(clone).forEach( + key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key]) + ); + return Array.isArray(obj) ? (clone.length = obj.length) && Array.from(clone) : clone; }; + module.exports = deepClone; \ No newline at end of file diff --git a/test/deepFlatten/deepFlatten.js b/test/deepFlatten/deepFlatten.js index c63f62add..d550011a0 100644 --- a/test/deepFlatten/deepFlatten.js +++ b/test/deepFlatten/deepFlatten.js @@ -1,2 +1,3 @@ const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); + module.exports = deepFlatten; \ No newline at end of file diff --git a/test/defaults/defaults.js b/test/defaults/defaults.js index 93b4860b5..776affaa5 100644 --- a/test/defaults/defaults.js +++ b/test/defaults/defaults.js @@ -1,2 +1,3 @@ const defaults = (obj, ...defs) => Object.assign({}, obj, ...defs.reverse(), obj); + module.exports = defaults; \ No newline at end of file diff --git a/test/defer/defer.js b/test/defer/defer.js index 21b71c903..011551c98 100644 --- a/test/defer/defer.js +++ b/test/defer/defer.js @@ -1,2 +1,3 @@ const defer = (fn, ...args) => setTimeout(fn, 1, ...args); + module.exports = defer; \ No newline at end of file diff --git a/test/degreesToRads/degreesToRads.js b/test/degreesToRads/degreesToRads.js index 20ee811f7..68783ebff 100644 --- a/test/degreesToRads/degreesToRads.js +++ b/test/degreesToRads/degreesToRads.js @@ -1,2 +1,3 @@ const degreesToRads = deg => (deg * Math.PI) / 180.0; + module.exports = degreesToRads; \ No newline at end of file diff --git a/test/delay/delay.js b/test/delay/delay.js index 1ea1dce3c..7059c0142 100644 --- a/test/delay/delay.js +++ b/test/delay/delay.js @@ -1,2 +1,3 @@ const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args); + module.exports = delay; \ No newline at end of file diff --git a/test/detectDeviceType/detectDeviceType.js b/test/detectDeviceType/detectDeviceType.js index 846a330e7..7efe9f1a0 100644 --- a/test/detectDeviceType/detectDeviceType.js +++ b/test/detectDeviceType/detectDeviceType.js @@ -1,5 +1,6 @@ const detectDeviceType = () => -/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) -? 'Mobile' -: 'Desktop'; + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) + ? 'Mobile' + : 'Desktop'; + module.exports = detectDeviceType; \ No newline at end of file diff --git a/test/difference/difference.js b/test/difference/difference.js index 95ecb7c51..de0175a5e 100644 --- a/test/difference/difference.js +++ b/test/difference/difference.js @@ -1,5 +1,6 @@ const difference = (a, b) => { -const s = new Set(b); -return a.filter(x => !s.has(x)); + const s = new Set(b); + return a.filter(x => !s.has(x)); }; + module.exports = difference; \ No newline at end of file diff --git a/test/differenceBy/differenceBy.js b/test/differenceBy/differenceBy.js index 3e61a2ae2..1d9f14b4b 100644 --- a/test/differenceBy/differenceBy.js +++ b/test/differenceBy/differenceBy.js @@ -1,5 +1,6 @@ const differenceBy = (a, b, fn) => { -const s = new Set(b.map(v => fn(v))); -return a.filter(x => !s.has(fn(x))); + 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/differenceWith/differenceWith.js b/test/differenceWith/differenceWith.js index 59d99a9ba..116c4abe0 100644 --- a/test/differenceWith/differenceWith.js +++ b/test/differenceWith/differenceWith.js @@ -1,2 +1,3 @@ const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1); + module.exports = differenceWith; \ No newline at end of file diff --git a/test/dig/dig.js b/test/dig/dig.js index deebf2be1..c6ac9caf0 100644 --- a/test/dig/dig.js +++ b/test/dig/dig.js @@ -1,8 +1,9 @@ const dig = (obj, target) => -target in obj -? obj[target] -: Object.values(obj).reduce((acc, val) => { -if (acc !== undefined) return acc; -if (typeof val === 'object') return dig(val, target); -}, undefined); + target in obj + ? obj[target] + : Object.values(obj).reduce((acc, val) => { + if (acc !== undefined) return acc; + if (typeof val === 'object') return dig(val, target); + }, undefined); + module.exports = dig; \ No newline at end of file diff --git a/test/digitize/digitize.js b/test/digitize/digitize.js index 074c62069..f1692d10d 100644 --- a/test/digitize/digitize.js +++ b/test/digitize/digitize.js @@ -1,2 +1,3 @@ const digitize = n => [...`${n}`].map(i => parseInt(i)); + module.exports = digitize; \ No newline at end of file diff --git a/test/distance/distance.js b/test/distance/distance.js index 0be1a9b8d..15be81296 100644 --- a/test/distance/distance.js +++ b/test/distance/distance.js @@ -1,2 +1,3 @@ const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); + module.exports = distance; \ No newline at end of file diff --git a/test/drop/drop.js b/test/drop/drop.js index 6f5fe45e4..a102c19dc 100644 --- a/test/drop/drop.js +++ b/test/drop/drop.js @@ -1,2 +1,3 @@ const drop = (arr, n = 1) => arr.slice(n); + module.exports = drop; \ No newline at end of file diff --git a/test/dropRight/dropRight.js b/test/dropRight/dropRight.js index 578c378a8..ec9690c54 100644 --- a/test/dropRight/dropRight.js +++ b/test/dropRight/dropRight.js @@ -1,2 +1,3 @@ const dropRight = (arr, n = 1) => arr.slice(0, -n); + module.exports = dropRight; \ No newline at end of file diff --git a/test/dropRightWhile/dropRightWhile.js b/test/dropRightWhile/dropRightWhile.js index d77f45a6d..a1a479346 100644 --- a/test/dropRightWhile/dropRightWhile.js +++ b/test/dropRightWhile/dropRightWhile.js @@ -1,5 +1,6 @@ const dropRightWhile = (arr, func) => { -while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1); -return arr; + while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1); + return arr; }; + module.exports = dropRightWhile; \ No newline at end of file diff --git a/test/dropWhile/dropWhile.js b/test/dropWhile/dropWhile.js index 4fdeab662..d22d90bee 100644 --- a/test/dropWhile/dropWhile.js +++ b/test/dropWhile/dropWhile.js @@ -1,5 +1,6 @@ const dropWhile = (arr, func) => { -while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1); -return arr; + while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1); + return arr; }; + module.exports = dropWhile; \ No newline at end of file diff --git a/test/elementContains/elementContains.js b/test/elementContains/elementContains.js index 3eefcc829..414d0ab9f 100644 --- a/test/elementContains/elementContains.js +++ b/test/elementContains/elementContains.js @@ -1,2 +1,3 @@ const elementContains = (parent, child) => parent !== child && parent.contains(child); + module.exports = elementContains; \ No newline at end of file diff --git a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js index a63276c07..8aab78db0 100644 --- a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js +++ b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js @@ -1,9 +1,10 @@ const elementIsVisibleInViewport = (el, partiallyVisible = false) => { -const { top, left, bottom, right } = el.getBoundingClientRect(); -const { innerHeight, innerWidth } = window; -return partiallyVisible -? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) && -((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth)) -: top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth; + const { top, left, bottom, right } = el.getBoundingClientRect(); + const { innerHeight, innerWidth } = window; + return partiallyVisible + ? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) && + ((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 diff --git a/test/elo/elo.js b/test/elo/elo.js index 0db453a9a..17c765a99 100644 --- a/test/elo/elo.js +++ b/test/elo/elo.js @@ -1,18 +1,19 @@ const elo = ([...ratings], kFactor = 32, selfRating) => { -const [a, b] = ratings; -const expectedScore = (self, opponent) => 1 / (1 + 10 ** ((opponent - self) / 400)); -const newRating = (rating, i) => -(selfRating || rating) + kFactor * (i - expectedScore(i ? a : b, i ? b : a)); -if (ratings.length === 2) { -return [newRating(a, 1), newRating(b, 0)]; -} -for (let i = 0, len = ratings.length; i < len; i++) { -let j = i; -while (j < len - 1) { -j++; -[ratings[i], ratings[j]] = elo([ratings[i], ratings[j]], kFactor); -} -} -return ratings; + const [a, b] = ratings; + const expectedScore = (self, opponent) => 1 / (1 + 10 ** ((opponent - self) / 400)); + const newRating = (rating, i) => + (selfRating || rating) + kFactor * (i - expectedScore(i ? a : b, i ? b : a)); + if (ratings.length === 2) { + return [newRating(a, 1), newRating(b, 0)]; + } + for (let i = 0, len = ratings.length; i < len; i++) { + let j = i; + while (j < len - 1) { + j++; + [ratings[i], ratings[j]] = elo([ratings[i], ratings[j]], kFactor); + } + } + return ratings; }; + module.exports = elo; \ No newline at end of file diff --git a/test/equals/equals.js b/test/equals/equals.js index 677baf129..6ab03913f 100644 --- a/test/equals/equals.js +++ b/test/equals/equals.js @@ -1,11 +1,12 @@ const equals = (a, b) => { -if (a === b) return true; -if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime(); -if (!a || !b || (typeof a !== 'object' && typeof b !== 'object')) return a === b; -if (a === null || a === undefined || b === null || b === undefined) return false; -if (a.prototype !== b.prototype) return false; -let keys = Object.keys(a); -if (keys.length !== Object.keys(b).length) return false; -return keys.every(k => equals(a[k], b[k])); + if (a === b) return true; + if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime(); + if (!a || !b || (typeof a !== 'object' && typeof b !== 'object')) return a === b; + if (a === null || a === undefined || b === null || b === undefined) return false; + if (a.prototype !== b.prototype) return false; + 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 diff --git a/test/escapeHTML/escapeHTML.js b/test/escapeHTML/escapeHTML.js index aef6febb8..0bb40ad36 100644 --- a/test/escapeHTML/escapeHTML.js +++ b/test/escapeHTML/escapeHTML.js @@ -1,13 +1,14 @@ const escapeHTML = str => -str.replace( -/[&<>'"]/g, -tag => -({ -'&': '&', -'<': '<', -'>': '>', -"'": ''', -'"': '"' -}[tag] || tag) -); + str.replace( + /[&<>'"]/g, + tag => + ({ + '&': '&', + '<': '<', + '>': '>', + "'": ''', + '"': '"' + }[tag] || tag) + ); + module.exports = escapeHTML; \ No newline at end of file diff --git a/test/escapeRegExp/escapeRegExp.js b/test/escapeRegExp/escapeRegExp.js index d7087a53a..8f85d2981 100644 --- a/test/escapeRegExp/escapeRegExp.js +++ b/test/escapeRegExp/escapeRegExp.js @@ -1,2 +1,3 @@ const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + module.exports = escapeRegExp; \ No newline at end of file diff --git a/test/everyNth/everyNth.js b/test/everyNth/everyNth.js index bd3d6017a..368bfa39c 100644 --- a/test/everyNth/everyNth.js +++ b/test/everyNth/everyNth.js @@ -1,2 +1,3 @@ const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1); + module.exports = everyNth; \ No newline at end of file diff --git a/test/extendHex/extendHex.js b/test/extendHex/extendHex.js index 60c36dd12..00c18db9c 100644 --- a/test/extendHex/extendHex.js +++ b/test/extendHex/extendHex.js @@ -1,8 +1,9 @@ const extendHex = shortHex => -'#' + -shortHex -.slice(shortHex.startsWith('#') ? 1 : 0) -.split('') -.map(x => x + x) -.join(''); + '#' + + shortHex + .slice(shortHex.startsWith('#') ? 1 : 0) + .split('') + .map(x => x + x) + .join(''); + module.exports = extendHex; \ No newline at end of file diff --git a/test/factorial/factorial.js b/test/factorial/factorial.js index 13bcbfd60..7a39ba257 100644 --- a/test/factorial/factorial.js +++ b/test/factorial/factorial.js @@ -1,9 +1,10 @@ const factorial = n => -n < 0 -? (() => { -throw new TypeError('Negative numbers are not allowed!'); -})() -: n <= 1 -? 1 -: n * factorial(n - 1); + 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 diff --git a/test/factors/factors.js b/test/factors/factors.js index d75a1d7ea..843364b89 100644 --- a/test/factors/factors.js +++ b/test/factors/factors.js @@ -1,20 +1,21 @@ const factors = (num, primes = false) => { -const isPrime = num => { -const boundary = Math.floor(Math.sqrt(num)); -for (var i = 2; i <= boundary; i++) if (num % i === 0) return false; -return num >= 2; -}; -const isNeg = num < 0; -num = isNeg ? -num : num; -let array = Array.from({ length: num - 1 }) -.map((val, i) => (num % (i + 2) === 0 ? i + 2 : false)) -.filter(val => val); -if (isNeg) -array = array.reduce((acc, val) => { -acc.push(val); -acc.push(-val); -return acc; -}, []); -return primes ? array.filter(isPrime) : array; + const isPrime = num => { + const boundary = Math.floor(Math.sqrt(num)); + for (var i = 2; i <= boundary; i++) if (num % i === 0) return false; + return num >= 2; + }; + const isNeg = num < 0; + num = isNeg ? -num : num; + let array = Array.from({ length: num - 1 }) + .map((val, i) => (num % (i + 2) === 0 ? i + 2 : false)) + .filter(val => val); + if (isNeg) + array = array.reduce((acc, val) => { + acc.push(val); + acc.push(-val); + return acc; + }, []); + return primes ? array.filter(isPrime) : array; }; + module.exports = factors; \ No newline at end of file diff --git a/test/fibonacci/fibonacci.js b/test/fibonacci/fibonacci.js index b9700838a..ea9066a56 100644 --- a/test/fibonacci/fibonacci.js +++ b/test/fibonacci/fibonacci.js @@ -1,6 +1,7 @@ const fibonacci = n => -Array.from({ length: n }).reduce( -(acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), -[] -); + 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 diff --git a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js index a2765e50c..aa6c48cfe 100644 --- a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js +++ b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js @@ -1,3 +1,4 @@ const fibonacciCountUntilNum = num => -Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2)); + 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 diff --git a/test/fibonacciUntilNum/fibonacciUntilNum.js b/test/fibonacciUntilNum/fibonacciUntilNum.js index dd1040fea..953b6bd85 100644 --- a/test/fibonacciUntilNum/fibonacciUntilNum.js +++ b/test/fibonacciUntilNum/fibonacciUntilNum.js @@ -1,8 +1,9 @@ const fibonacciUntilNum = num => { -let n = Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2)); -return Array.from({ length: n }).reduce( -(acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), -[] -); + let n = Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2)); + return Array.from({ length: n }).reduce( + (acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), + [] + ); }; + module.exports = fibonacciUntilNum; \ No newline at end of file diff --git a/test/filterNonUnique/filterNonUnique.js b/test/filterNonUnique/filterNonUnique.js index 7d7a2688d..d49346c96 100644 --- a/test/filterNonUnique/filterNonUnique.js +++ b/test/filterNonUnique/filterNonUnique.js @@ -1,2 +1,3 @@ const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i)); + module.exports = filterNonUnique; \ No newline at end of file diff --git a/test/filterNonUniqueBy/filterNonUniqueBy.js b/test/filterNonUniqueBy/filterNonUniqueBy.js index cd70011e7..2787ec47f 100644 --- a/test/filterNonUniqueBy/filterNonUniqueBy.js +++ b/test/filterNonUniqueBy/filterNonUniqueBy.js @@ -1,3 +1,4 @@ const filterNonUniqueBy = (arr, fn) => -arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j))); + arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j))); + module.exports = filterNonUniqueBy; \ No newline at end of file diff --git a/test/findKey/findKey.js b/test/findKey/findKey.js index 0743cce13..8c095e3a4 100644 --- a/test/findKey/findKey.js +++ b/test/findKey/findKey.js @@ -1,2 +1,3 @@ const findKey = (obj, fn) => Object.keys(obj).find(key => fn(obj[key], key, obj)); + module.exports = findKey; \ No newline at end of file diff --git a/test/findLast/findLast.js b/test/findLast/findLast.js index 38f769e78..91f8d9abb 100644 --- a/test/findLast/findLast.js +++ b/test/findLast/findLast.js @@ -1,2 +1,3 @@ const findLast = (arr, fn) => arr.filter(fn).pop(); + module.exports = findLast; \ No newline at end of file diff --git a/test/findLastIndex/findLastIndex.js b/test/findLastIndex/findLastIndex.js index d098c7ed1..e1bf7273e 100644 --- a/test/findLastIndex/findLastIndex.js +++ b/test/findLastIndex/findLastIndex.js @@ -1,6 +1,7 @@ const findLastIndex = (arr, fn) => -arr -.map((val, i) => [i, val]) -.filter(([i, val]) => fn(val, i, arr)) -.pop()[0]; + arr + .map((val, i) => [i, val]) + .filter(([i, val]) => fn(val, i, arr)) + .pop()[0]; + module.exports = findLastIndex; \ No newline at end of file diff --git a/test/findLastKey/findLastKey.js b/test/findLastKey/findLastKey.js index d28c7cda8..9a3bc81f8 100644 --- a/test/findLastKey/findLastKey.js +++ b/test/findLastKey/findLastKey.js @@ -1,5 +1,6 @@ const findLastKey = (obj, fn) => -Object.keys(obj) -.reverse() -.find(key => fn(obj[key], key, obj)); + Object.keys(obj) + .reverse() + .find(key => fn(obj[key], key, obj)); + module.exports = findLastKey; \ No newline at end of file diff --git a/test/flatten/flatten.js b/test/flatten/flatten.js index 27799b22f..47150897b 100644 --- a/test/flatten/flatten.js +++ b/test/flatten/flatten.js @@ -1,3 +1,4 @@ const flatten = (arr, depth = 1) => -arr.reduce((a, v) => a.concat(depth > 1 && Array.isArray(v) ? flatten(v, depth - 1) : v), []); + arr.reduce((a, v) => a.concat(depth > 1 && Array.isArray(v) ? flatten(v, depth - 1) : v), []); + module.exports = flatten; \ No newline at end of file diff --git a/test/flattenObject/flattenObject.js b/test/flattenObject/flattenObject.js index 1a01f7f0a..27907d958 100644 --- a/test/flattenObject/flattenObject.js +++ b/test/flattenObject/flattenObject.js @@ -1,8 +1,9 @@ const flattenObject = (obj, prefix = '') => -Object.keys(obj).reduce((acc, k) => { -const pre = prefix.length ? prefix + '.' : ''; -if (typeof obj[k] === 'object') Object.assign(acc, flattenObject(obj[k], pre + k)); -else acc[pre + k] = obj[k]; -return acc; -}, {}); + Object.keys(obj).reduce((acc, k) => { + const pre = prefix.length ? prefix + '.' : ''; + if (typeof obj[k] === 'object') Object.assign(acc, flattenObject(obj[k], pre + k)); + else acc[pre + k] = obj[k]; + return acc; + }, {}); + module.exports = flattenObject; \ No newline at end of file diff --git a/test/flip/flip.js b/test/flip/flip.js index 9287d1faf..e117cbeca 100644 --- a/test/flip/flip.js +++ b/test/flip/flip.js @@ -1,2 +1,3 @@ const flip = fn => (first, ...rest) => fn(...rest, first); + module.exports = flip; \ No newline at end of file diff --git a/test/forEachRight/forEachRight.js b/test/forEachRight/forEachRight.js index 48b911a5b..9ce2082d4 100644 --- a/test/forEachRight/forEachRight.js +++ b/test/forEachRight/forEachRight.js @@ -1,6 +1,7 @@ const forEachRight = (arr, callback) => -arr -.slice(0) -.reverse() -.forEach(callback); + arr + .slice(0) + .reverse() + .forEach(callback); + module.exports = forEachRight; \ No newline at end of file diff --git a/test/forOwn/forOwn.js b/test/forOwn/forOwn.js index cdc29acc6..d0c5454b7 100644 --- a/test/forOwn/forOwn.js +++ b/test/forOwn/forOwn.js @@ -1,2 +1,3 @@ const forOwn = (obj, fn) => Object.keys(obj).forEach(key => fn(obj[key], key, obj)); + module.exports = forOwn; \ No newline at end of file diff --git a/test/forOwnRight/forOwnRight.js b/test/forOwnRight/forOwnRight.js index f392aecc8..bf4aa3177 100644 --- a/test/forOwnRight/forOwnRight.js +++ b/test/forOwnRight/forOwnRight.js @@ -1,5 +1,6 @@ const forOwnRight = (obj, fn) => -Object.keys(obj) -.reverse() -.forEach(key => fn(obj[key], key, obj)); + Object.keys(obj) + .reverse() + .forEach(key => fn(obj[key], key, obj)); + module.exports = forOwnRight; \ No newline at end of file diff --git a/test/formatDuration/formatDuration.js b/test/formatDuration/formatDuration.js index 82955dc28..df83de8b5 100644 --- a/test/formatDuration/formatDuration.js +++ b/test/formatDuration/formatDuration.js @@ -1,15 +1,16 @@ const formatDuration = ms => { -if (ms < 0) ms = -ms; -const time = { -day: Math.floor(ms / 86400000), -hour: Math.floor(ms / 3600000) % 24, -minute: Math.floor(ms / 60000) % 60, -second: Math.floor(ms / 1000) % 60, -millisecond: Math.floor(ms) % 1000 -}; -return Object.entries(time) -.filter(val => val[1] !== 0) -.map(val => val[1] + ' ' + (val[1] !== 1 ? val[0] + 's' : val[0])) -.join(', '); + if (ms < 0) ms = -ms; + const time = { + day: Math.floor(ms / 86400000), + hour: Math.floor(ms / 3600000) % 24, + minute: Math.floor(ms / 60000) % 60, + second: Math.floor(ms / 1000) % 60, + millisecond: Math.floor(ms) % 1000 + }; + return Object.entries(time) + .filter(val => val[1] !== 0) + .map(val => val[1] + ' ' + (val[1] !== 1 ? val[0] + 's' : val[0])) + .join(', '); }; + module.exports = formatDuration; \ No newline at end of file diff --git a/test/fromCamelCase/fromCamelCase.js b/test/fromCamelCase/fromCamelCase.js index 85f39e652..d149f154f 100644 --- a/test/fromCamelCase/fromCamelCase.js +++ b/test/fromCamelCase/fromCamelCase.js @@ -1,6 +1,7 @@ const fromCamelCase = (str, separator = '_') => -str -.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') -.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2') -.toLowerCase(); + 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 diff --git a/test/functionName/functionName.js b/test/functionName/functionName.js index b8f8329e0..ffcd77822 100644 --- a/test/functionName/functionName.js +++ b/test/functionName/functionName.js @@ -1,2 +1,3 @@ const functionName = fn => (console.debug(fn.name), fn); + module.exports = functionName; \ No newline at end of file diff --git a/test/functions/functions.js b/test/functions/functions.js index c97e10359..3b8e223d9 100644 --- a/test/functions/functions.js +++ b/test/functions/functions.js @@ -1,6 +1,7 @@ const functions = (obj, inherited = false) => -(inherited -? [...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))] -: Object.keys(obj) -).filter(key => typeof obj[key] === 'function'); + (inherited + ? [...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 diff --git a/test/gcd/gcd.js b/test/gcd/gcd.js index 81fd33f08..11846784f 100644 --- a/test/gcd/gcd.js +++ b/test/gcd/gcd.js @@ -1,5 +1,6 @@ const gcd = (...arr) => { -const _gcd = (x, y) => (!y ? x : gcd(y, x % y)); -return [...arr].reduce((a, b) => _gcd(a, b)); + 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 diff --git a/test/geometricProgression/geometricProgression.js b/test/geometricProgression/geometricProgression.js index 205ff6004..8471af861 100644 --- a/test/geometricProgression/geometricProgression.js +++ b/test/geometricProgression/geometricProgression.js @@ -1,5 +1,6 @@ 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 -); + 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 diff --git a/test/get/get.js b/test/get/get.js index 0f57d5ab5..143fd1b20 100644 --- a/test/get/get.js +++ b/test/get/get.js @@ -1,9 +1,10 @@ const get = (from, ...selectors) => -[...selectors].map(s => -s -.replace(/\[([^\[\]]*)\]/g, '.$1.') -.split('.') -.filter(t => t !== '') -.reduce((prev, cur) => prev && prev[cur], from) -); + [...selectors].map(s => + s + .replace(/\[([^\[\]]*)\]/g, '.$1.') + .split('.') + .filter(t => t !== '') + .reduce((prev, cur) => prev && prev[cur], from) + ); + module.exports = get; \ No newline at end of file diff --git a/test/getColonTimeFromDate/getColonTimeFromDate.js b/test/getColonTimeFromDate/getColonTimeFromDate.js index eba292834..5ad2a602c 100644 --- a/test/getColonTimeFromDate/getColonTimeFromDate.js +++ b/test/getColonTimeFromDate/getColonTimeFromDate.js @@ -1,2 +1,3 @@ const getColonTimeFromDate = date => date.toTimeString().slice(0, 8); + module.exports = getColonTimeFromDate; \ No newline at end of file diff --git a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js index 5b5bba94f..8525c703c 100644 --- a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js +++ b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js @@ -1,3 +1,4 @@ const getDaysDiffBetweenDates = (dateInitial, dateFinal) => -(dateFinal - dateInitial) / (1000 * 3600 * 24); + (dateFinal - dateInitial) / (1000 * 3600 * 24); + module.exports = getDaysDiffBetweenDates; \ No newline at end of file diff --git a/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js b/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js index f84af8631..4ad5d9eeb 100644 --- a/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js +++ b/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js @@ -1,9 +1,10 @@ const getMeridiemSuffixOfInteger = num => -num === 0 || num === 24 -? 12 + 'am' -: num === 12 -? 12 + 'pm' -: num < 12 -? (num % 12) + 'am' -: (num % 12) + 'pm'; + num === 0 || num === 24 + ? 12 + 'am' + : num === 12 + ? 12 + 'pm' + : num < 12 + ? (num % 12) + 'am' + : (num % 12) + 'pm'; + module.exports = getMeridiemSuffixOfInteger; \ No newline at end of file diff --git a/test/getScrollPosition/getScrollPosition.js b/test/getScrollPosition/getScrollPosition.js index 5bedcc1fe..c8f22a175 100644 --- a/test/getScrollPosition/getScrollPosition.js +++ b/test/getScrollPosition/getScrollPosition.js @@ -1,5 +1,6 @@ const getScrollPosition = (el = window) => ({ -x: el.pageXOffset !== undefined ? el.pageXOffset : el.scrollLeft, -y: el.pageYOffset !== undefined ? el.pageYOffset : el.scrollTop + 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 diff --git a/test/getStyle/getStyle.js b/test/getStyle/getStyle.js index 9dae09683..92953b2e8 100644 --- a/test/getStyle/getStyle.js +++ b/test/getStyle/getStyle.js @@ -1,2 +1,3 @@ const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; + module.exports = getStyle; \ No newline at end of file diff --git a/test/getType/getType.js b/test/getType/getType.js index 7827941c8..b2c8b44ba 100644 --- a/test/getType/getType.js +++ b/test/getType/getType.js @@ -1,3 +1,4 @@ const getType = v => -v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); + v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); + module.exports = getType; \ No newline at end of file diff --git a/test/getURLParameters/getURLParameters.js b/test/getURLParameters/getURLParameters.js index 3fa194174..6f808fcfc 100644 --- a/test/getURLParameters/getURLParameters.js +++ b/test/getURLParameters/getURLParameters.js @@ -1,6 +1,7 @@ const getURLParameters = url => -(url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce( -(a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), -{} -); + (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 diff --git a/test/groupBy/groupBy.js b/test/groupBy/groupBy.js index b423945a4..c92262912 100644 --- a/test/groupBy/groupBy.js +++ b/test/groupBy/groupBy.js @@ -1,6 +1,7 @@ const groupBy = (arr, fn) => -arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => { -acc[val] = (acc[val] || []).concat(arr[i]); -return acc; -}, {}); + 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 diff --git a/test/hammingDistance/hammingDistance.js b/test/hammingDistance/hammingDistance.js index 161bd0b4f..049b2114b 100644 --- a/test/hammingDistance/hammingDistance.js +++ b/test/hammingDistance/hammingDistance.js @@ -1,2 +1,3 @@ const hammingDistance = (num1, num2) => ((num1 ^ num2).toString(2).match(/1/g) || '').length; + module.exports = hammingDistance; \ No newline at end of file diff --git a/test/hasClass/hasClass.js b/test/hasClass/hasClass.js index 5e717540c..9acc2ca3c 100644 --- a/test/hasClass/hasClass.js +++ b/test/hasClass/hasClass.js @@ -1,2 +1,3 @@ const hasClass = (el, className) => el.classList.contains(className); + module.exports = hasClass; \ No newline at end of file diff --git a/test/hasFlags/hasFlags.js b/test/hasFlags/hasFlags.js index aba5fbb3c..799fddafe 100644 --- a/test/hasFlags/hasFlags.js +++ b/test/hasFlags/hasFlags.js @@ -1,3 +1,4 @@ const hasFlags = (...flags) => -flags.every(flag => process.argv.includes(/^-{1,2}/.test(flag) ? flag : '--' + flag)); + flags.every(flag => process.argv.includes(/^-{1,2}/.test(flag) ? flag : '--' + flag)); + module.exports = hasFlags; \ No newline at end of file diff --git a/test/hashBrowser/hashBrowser.js b/test/hashBrowser/hashBrowser.js index d7d70d6a7..88f4c06b0 100644 --- a/test/hashBrowser/hashBrowser.js +++ b/test/hashBrowser/hashBrowser.js @@ -1,9 +1,10 @@ const hashBrowser = val => -crypto.subtle.digest('SHA-256', new TextEncoder('utf-8').encode(val)).then(h => { -let hexes = [], -view = new DataView(h); -for (let i = 0; i < view.byteLength; i += 4) -hexes.push(('00000000' + view.getUint32(i).toString(16)).slice(-8)); -return hexes.join(''); -}); + crypto.subtle.digest('SHA-256', new TextEncoder('utf-8').encode(val)).then(h => { + let hexes = [], + view = new DataView(h); + 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 diff --git a/test/hashNode/hashNode.js b/test/hashNode/hashNode.js index cdc9af50e..376cc231d 100644 --- a/test/hashNode/hashNode.js +++ b/test/hashNode/hashNode.js @@ -1,15 +1,16 @@ const crypto = require('crypto'); const hashNode = val => -new Promise(resolve => -setTimeout( -() => -resolve( -crypto -.createHash('sha256') -.update(val) -.digest('hex') -), -0 -) -); + new Promise(resolve => + setTimeout( + () => + resolve( + crypto + .createHash('sha256') + .update(val) + .digest('hex') + ), + 0 + ) + ); + module.exports = hashNode; \ No newline at end of file diff --git a/test/head/head.js b/test/head/head.js index 709cd9a1d..9c4d84818 100644 --- a/test/head/head.js +++ b/test/head/head.js @@ -1,2 +1,3 @@ const head = arr => arr[0]; + module.exports = head; \ No newline at end of file diff --git a/test/hexToRGB/hexToRGB.js b/test/hexToRGB/hexToRGB.js index 3963228eb..de730196f 100644 --- a/test/hexToRGB/hexToRGB.js +++ b/test/hexToRGB/hexToRGB.js @@ -1,20 +1,21 @@ const hexToRGB = hex => { -let alpha = false, -h = hex.slice(hex.startsWith('#') ? 1 : 0); -if (h.length === 3) h = [...h].map(x => x + x).join(''); -else if (h.length === 8) alpha = true; -h = parseInt(h, 16); -return ( -'rgb' + -(alpha ? 'a' : '') + -'(' + -(h >>> (alpha ? 24 : 16)) + -', ' + -((h & (alpha ? 0x00ff0000 : 0x00ff00)) >>> (alpha ? 16 : 8)) + -', ' + -((h & (alpha ? 0x0000ff00 : 0x0000ff)) >>> (alpha ? 8 : 0)) + -(alpha ? `, ${h & 0x000000ff}` : '') + -')' -); + let alpha = false, + h = hex.slice(hex.startsWith('#') ? 1 : 0); + if (h.length === 3) h = [...h].map(x => x + x).join(''); + else if (h.length === 8) alpha = true; + h = parseInt(h, 16); + return ( + 'rgb' + + (alpha ? 'a' : '') + + '(' + + (h >>> (alpha ? 24 : 16)) + + ', ' + + ((h & (alpha ? 0x00ff0000 : 0x00ff00)) >>> (alpha ? 16 : 8)) + + ', ' + + ((h & (alpha ? 0x0000ff00 : 0x0000ff)) >>> (alpha ? 8 : 0)) + + (alpha ? `, ${h & 0x000000ff}` : '') + + ')' + ); }; + module.exports = hexToRGB; \ No newline at end of file diff --git a/test/hide/hide.js b/test/hide/hide.js index d862ff1ef..cdf41890d 100644 --- a/test/hide/hide.js +++ b/test/hide/hide.js @@ -1,2 +1,3 @@ const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); + module.exports = hide; \ No newline at end of file diff --git a/test/howManyTimes/howManyTimes.js b/test/howManyTimes/howManyTimes.js index 4beccb533..c6d142783 100644 --- a/test/howManyTimes/howManyTimes.js +++ b/test/howManyTimes/howManyTimes.js @@ -1,11 +1,12 @@ const howManyTimes = (num, divisor) => { -if (divisor === 1 || divisor === -1) return Infinity; -if (divisor === 0) return 0; -let i = 0; -while (Number.isInteger(num / divisor)) { -i++; -num = num / divisor; -} -return i; + if (divisor === 1 || divisor === -1) return Infinity; + if (divisor === 0) return 0; + let i = 0; + while (Number.isInteger(num / divisor)) { + i++; + num = num / divisor; + } + return i; }; + module.exports = howManyTimes; \ No newline at end of file diff --git a/test/httpDelete/httpDelete.js b/test/httpDelete/httpDelete.js index eaf7f0562..fc04b1c08 100644 --- a/test/httpDelete/httpDelete.js +++ b/test/httpDelete/httpDelete.js @@ -1,8 +1,9 @@ const httpDelete = (url, callback, err = console.error) => { -const request = new XMLHttpRequest(); -request.open("DELETE", url, true); -request.onload = () => callback(request); -request.onerror = () => err(request); -request.send(); + const request = new XMLHttpRequest(); + request.open("DELETE", url, true); + request.onload = () => callback(request); + request.onerror = () => err(request); + request.send(); }; + module.exports = httpDelete; \ No newline at end of file diff --git a/test/httpGet/httpGet.js b/test/httpGet/httpGet.js index 8aa83ad7f..1bc5dd5fd 100644 --- a/test/httpGet/httpGet.js +++ b/test/httpGet/httpGet.js @@ -1,8 +1,9 @@ const httpGet = (url, callback, err = console.error) => { -const request = new XMLHttpRequest(); -request.open('GET', url, true); -request.onload = () => callback(request.responseText); -request.onerror = () => err(request); -request.send(); + const request = new XMLHttpRequest(); + request.open('GET', url, true); + request.onload = () => callback(request.responseText); + request.onerror = () => err(request); + request.send(); }; + module.exports = httpGet; \ No newline at end of file diff --git a/test/httpPost/httpPost.js b/test/httpPost/httpPost.js index 4ed125b6f..60d487663 100644 --- a/test/httpPost/httpPost.js +++ b/test/httpPost/httpPost.js @@ -1,9 +1,10 @@ const httpPost = (url, data, callback, err = console.error) => { -const request = new XMLHttpRequest(); -request.open('POST', url, true); -request.setRequestHeader('Content-type', 'application/json; charset=utf-8'); -request.onload = () => callback(request.responseText); -request.onerror = () => err(request); -request.send(data); + const request = new XMLHttpRequest(); + request.open('POST', url, true); + request.setRequestHeader('Content-type', 'application/json; charset=utf-8'); + request.onload = () => callback(request.responseText); + request.onerror = () => err(request); + request.send(data); }; + module.exports = httpPost; \ No newline at end of file diff --git a/test/httpPut/httpPut.js b/test/httpPut/httpPut.js index daf0d9b62..1e387f111 100644 --- a/test/httpPut/httpPut.js +++ b/test/httpPut/httpPut.js @@ -1,9 +1,10 @@ const httpPut = (url, data, callback, err = console.error) => { -const request = new XMLHttpRequest(); -request.open("PUT", url, true); -request.setRequestHeader('Content-type','application/json; charset=utf-8'); -request.onload = () => callback(request); -request.onerror = () => err(request); -request.send(data); + const request = new XMLHttpRequest(); + request.open("PUT", url, true); + request.setRequestHeader('Content-type','application/json; charset=utf-8'); + request.onload = () => callback(request); + request.onerror = () => err(request); + request.send(data); }; + module.exports = httpPut; \ No newline at end of file diff --git a/test/httpsRedirect/httpsRedirect.js b/test/httpsRedirect/httpsRedirect.js index 42473e321..19cb14201 100644 --- a/test/httpsRedirect/httpsRedirect.js +++ b/test/httpsRedirect/httpsRedirect.js @@ -1,4 +1,5 @@ const httpsRedirect = () => { -if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]); + if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]); }; + module.exports = httpsRedirect; \ No newline at end of file diff --git a/test/hz/hz.js b/test/hz/hz.js index b41a3285b..a20281838 100644 --- a/test/hz/hz.js +++ b/test/hz/hz.js @@ -1,6 +1,7 @@ const hz = (fn, iterations = 100) => { -const before = performance.now(); -for (let i = 0; i < iterations; i++) fn(); -return (1000 * iterations) / (performance.now() - before); + const before = performance.now(); + for (let i = 0; i < iterations; i++) fn(); + return (1000 * iterations) / (performance.now() - before); }; + module.exports = hz; \ No newline at end of file diff --git a/test/inRange/inRange.js b/test/inRange/inRange.js index 342b48e67..110ecc506 100644 --- a/test/inRange/inRange.js +++ b/test/inRange/inRange.js @@ -1,5 +1,6 @@ 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; + 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 diff --git a/test/indexOfAll/indexOfAll.js b/test/indexOfAll/indexOfAll.js index 938cf47a6..066ee63ff 100644 --- a/test/indexOfAll/indexOfAll.js +++ b/test/indexOfAll/indexOfAll.js @@ -1,6 +1,7 @@ const indexOfAll = (arr, val) => { -const indices = []; -arr.forEach((el, i) => el === val && indices.push(i)); -return indices; + const indices = []; + arr.forEach((el, i) => el === val && indices.push(i)); + return indices; }; + module.exports = indexOfAll; \ No newline at end of file diff --git a/test/initial/initial.js b/test/initial/initial.js index 0afd603ba..496242956 100644 --- a/test/initial/initial.js +++ b/test/initial/initial.js @@ -1,2 +1,3 @@ const initial = arr => arr.slice(0, -1); + module.exports = initial; \ No newline at end of file diff --git a/test/initialize2DArray/initialize2DArray.js b/test/initialize2DArray/initialize2DArray.js index 6fd51be70..21984210f 100644 --- a/test/initialize2DArray/initialize2DArray.js +++ b/test/initialize2DArray/initialize2DArray.js @@ -1,3 +1,4 @@ const initialize2DArray = (w, h, val = null) => -Array.from({ length: h }).map(() => Array.from({ length: w }).fill(val)); + Array.from({ length: h }).map(() => Array.from({ length: w }).fill(val)); + module.exports = initialize2DArray; \ No newline at end of file diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.js b/test/initializeArrayWithRange/initializeArrayWithRange.js index f44302a2c..fd487fc61 100644 --- a/test/initializeArrayWithRange/initializeArrayWithRange.js +++ b/test/initializeArrayWithRange/initializeArrayWithRange.js @@ -1,3 +1,4 @@ const initializeArrayWithRange = (end, start = 0, step = 1) => -Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i) => i * step + start); + Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i) => i * step + start); + module.exports = initializeArrayWithRange; \ No newline at end of file diff --git a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js b/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js index 8d94244c6..172ca1589 100644 --- a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js +++ b/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js @@ -1,5 +1,6 @@ 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 -); + 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 diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.js b/test/initializeArrayWithValues/initializeArrayWithValues.js index b2705dfae..a2a3c93cf 100644 --- a/test/initializeArrayWithValues/initializeArrayWithValues.js +++ b/test/initializeArrayWithValues/initializeArrayWithValues.js @@ -1,2 +1,3 @@ const initializeArrayWithValues = (n, val = 0) => Array(n).fill(val); + module.exports = initializeArrayWithValues; \ No newline at end of file diff --git a/test/initializeNDArray/initializeNDArray.js b/test/initializeNDArray/initializeNDArray.js index 66694ce55..ee73ed5b1 100644 --- a/test/initializeNDArray/initializeNDArray.js +++ b/test/initializeNDArray/initializeNDArray.js @@ -1,5 +1,6 @@ const initializeNDArray = (val, ...args) => -args.length === 0 -? val -: Array.from({ length: args[0] }).map(() => initializeNDArray(val, ...args.slice(1))); + args.length === 0 + ? val + : Array.from({ length: args[0] }).map(() => initializeNDArray(val, ...args.slice(1))); + module.exports = initializeNDArray; \ No newline at end of file diff --git a/test/insertAfter/insertAfter.js b/test/insertAfter/insertAfter.js index 4e001688c..89a213d7d 100644 --- a/test/insertAfter/insertAfter.js +++ b/test/insertAfter/insertAfter.js @@ -1,2 +1,3 @@ const insertAfter = (el, htmlString) => el.insertAdjacentHTML('afterend', htmlString); + module.exports = insertAfter; \ No newline at end of file diff --git a/test/insertBefore/insertBefore.js b/test/insertBefore/insertBefore.js index d376170a8..7e19429f0 100644 --- a/test/insertBefore/insertBefore.js +++ b/test/insertBefore/insertBefore.js @@ -1,2 +1,3 @@ const insertBefore = (el, htmlString) => el.insertAdjacentHTML('beforebegin', htmlString); + module.exports = insertBefore; \ No newline at end of file diff --git a/test/intersection/intersection.js b/test/intersection/intersection.js index 96fe9ec04..435c9d9af 100644 --- a/test/intersection/intersection.js +++ b/test/intersection/intersection.js @@ -1,5 +1,6 @@ const intersection = (a, b) => { -const s = new Set(b); -return a.filter(x => s.has(x)); + const s = new Set(b); + return a.filter(x => s.has(x)); }; + module.exports = intersection; \ No newline at end of file diff --git a/test/intersectionBy/intersectionBy.js b/test/intersectionBy/intersectionBy.js index cb005e02d..ce3ef63cb 100644 --- a/test/intersectionBy/intersectionBy.js +++ b/test/intersectionBy/intersectionBy.js @@ -1,5 +1,6 @@ const intersectionBy = (a, b, fn) => { -const s = new Set(b.map(x => fn(x))); -return a.filter(x => s.has(fn(x))); + 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/intersectionWith/intersectionWith.js b/test/intersectionWith/intersectionWith.js index e341faac5..d4ffb23ea 100644 --- a/test/intersectionWith/intersectionWith.js +++ b/test/intersectionWith/intersectionWith.js @@ -1,2 +1,3 @@ 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/invertKeyValues/invertKeyValues.js b/test/invertKeyValues/invertKeyValues.js index 59c52315a..d9a01763e 100644 --- a/test/invertKeyValues/invertKeyValues.js +++ b/test/invertKeyValues/invertKeyValues.js @@ -1,8 +1,9 @@ const invertKeyValues = (obj, fn) => -Object.keys(obj).reduce((acc, key) => { -const val = fn ? fn(obj[key]) : obj[key]; -acc[val] = acc[val] || []; -acc[val].push(key); -return acc; -}, {}); + Object.keys(obj).reduce((acc, key) => { + const val = fn ? fn(obj[key]) : obj[key]; + acc[val] = acc[val] || []; + acc[val].push(key); + return acc; + }, {}); + module.exports = invertKeyValues; \ No newline at end of file diff --git a/test/is/is.js b/test/is/is.js index 95b13b7ca..e12ae4af2 100644 --- a/test/is/is.js +++ b/test/is/is.js @@ -1,2 +1,3 @@ const is = (type, val) => ![, null].includes(val) && val.constructor === type; + module.exports = is; \ No newline at end of file diff --git a/test/isAbsoluteURL/isAbsoluteURL.js b/test/isAbsoluteURL/isAbsoluteURL.js index d6bbe1850..f94177f73 100644 --- a/test/isAbsoluteURL/isAbsoluteURL.js +++ b/test/isAbsoluteURL/isAbsoluteURL.js @@ -1,2 +1,3 @@ const isAbsoluteURL = str => /^[a-z][a-z0-9+.-]*:/.test(str); + module.exports = isAbsoluteURL; \ No newline at end of file diff --git a/test/isAnagram/isAnagram.js b/test/isAnagram/isAnagram.js index 41b26aa83..2ce3db13f 100644 --- a/test/isAnagram/isAnagram.js +++ b/test/isAnagram/isAnagram.js @@ -1,11 +1,12 @@ const isAnagram = (str1, str2) => { -const normalize = str => -str -.toLowerCase() -.replace(/[^a-z0-9]/gi, '') -.split('') -.sort() -.join(''); -return normalize(str1) === normalize(str2); + const normalize = str => + str + .toLowerCase() + .replace(/[^a-z0-9]/gi, '') + .split('') + .sort() + .join(''); + return normalize(str1) === normalize(str2); }; + module.exports = isAnagram; \ No newline at end of file diff --git a/test/isArmstrongNumber/isArmstrongNumber.js b/test/isArmstrongNumber/isArmstrongNumber.js index f0ebb49c4..ed8e407b3 100644 --- a/test/isArmstrongNumber/isArmstrongNumber.js +++ b/test/isArmstrongNumber/isArmstrongNumber.js @@ -1,5 +1,6 @@ const isArmstrongNumber = digits => -(arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)( -(digits + '').split('') -); + (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)( + (digits + '').split('') + ); + module.exports = isArmstrongNumber; \ No newline at end of file diff --git a/test/isArrayLike/isArrayLike.js b/test/isArrayLike/isArrayLike.js index ad76eacf4..31fb84d67 100644 --- a/test/isArrayLike/isArrayLike.js +++ b/test/isArrayLike/isArrayLike.js @@ -1,8 +1,9 @@ const isArrayLike = val => { -try { -return [...val], true; -} catch (e) { -return false; -} + try { + return [...val], true; + } catch (e) { + return false; + } }; + module.exports = isArrayLike; \ No newline at end of file diff --git a/test/isBoolean/isBoolean.js b/test/isBoolean/isBoolean.js index 6b210a95f..6daf49c14 100644 --- a/test/isBoolean/isBoolean.js +++ b/test/isBoolean/isBoolean.js @@ -1,2 +1,3 @@ const isBoolean = val => typeof val === 'boolean'; + module.exports = isBoolean; \ No newline at end of file diff --git a/test/isBrowser/isBrowser.js b/test/isBrowser/isBrowser.js index 3399dc227..9391a408b 100644 --- a/test/isBrowser/isBrowser.js +++ b/test/isBrowser/isBrowser.js @@ -1,2 +1,3 @@ const isBrowser = () => ![typeof window, typeof document].includes('undefined'); + module.exports = isBrowser; \ No newline at end of file diff --git a/test/isBrowserTabFocused/isBrowserTabFocused.js b/test/isBrowserTabFocused/isBrowserTabFocused.js index e30124022..b53e496c2 100644 --- a/test/isBrowserTabFocused/isBrowserTabFocused.js +++ b/test/isBrowserTabFocused/isBrowserTabFocused.js @@ -1,2 +1,3 @@ const isBrowserTabFocused = () => !document.hidden; + module.exports = isBrowserTabFocused; \ No newline at end of file diff --git a/test/isDivisible/isDivisible.js b/test/isDivisible/isDivisible.js index 31d5f22f9..4331afdec 100644 --- a/test/isDivisible/isDivisible.js +++ b/test/isDivisible/isDivisible.js @@ -1,2 +1,3 @@ const isDivisible = (dividend, divisor) => dividend % divisor === 0; + module.exports = isDivisible; \ No newline at end of file diff --git a/test/isEmpty/isEmpty.js b/test/isEmpty/isEmpty.js index e8bf40b5d..13433e27c 100644 --- a/test/isEmpty/isEmpty.js +++ b/test/isEmpty/isEmpty.js @@ -1,2 +1,3 @@ const isEmpty = val => val == null || !(Object.keys(val) || val).length; + module.exports = isEmpty; \ No newline at end of file diff --git a/test/isEven/isEven.js b/test/isEven/isEven.js index 3eef5efcf..4fe78f75c 100644 --- a/test/isEven/isEven.js +++ b/test/isEven/isEven.js @@ -1,2 +1,3 @@ const isEven = num => num % 2 === 0; + module.exports = isEven; \ No newline at end of file diff --git a/test/isFunction/isFunction.js b/test/isFunction/isFunction.js index 00aefcee2..8c544c6cc 100644 --- a/test/isFunction/isFunction.js +++ b/test/isFunction/isFunction.js @@ -1,2 +1,3 @@ const isFunction = val => typeof val === 'function'; + module.exports = isFunction; \ No newline at end of file diff --git a/test/isLowerCase/isLowerCase.js b/test/isLowerCase/isLowerCase.js index 4b79d4557..fac611cee 100644 --- a/test/isLowerCase/isLowerCase.js +++ b/test/isLowerCase/isLowerCase.js @@ -1,2 +1,3 @@ const isLowerCase = str => str === str.toLowerCase(); + module.exports = isLowerCase; \ No newline at end of file diff --git a/test/isNil/isNil.js b/test/isNil/isNil.js index 9ed182745..14c17be1c 100644 --- a/test/isNil/isNil.js +++ b/test/isNil/isNil.js @@ -1,2 +1,3 @@ const isNil = val => val === undefined || val === null; + module.exports = isNil; \ No newline at end of file diff --git a/test/isNull/isNull.js b/test/isNull/isNull.js index a69ef841c..b70207e95 100644 --- a/test/isNull/isNull.js +++ b/test/isNull/isNull.js @@ -1,2 +1,3 @@ const isNull = val => val === null; + module.exports = isNull; \ No newline at end of file diff --git a/test/isNumber/isNumber.js b/test/isNumber/isNumber.js index 894017c4e..6b1baee38 100644 --- a/test/isNumber/isNumber.js +++ b/test/isNumber/isNumber.js @@ -1,2 +1,3 @@ const isNumber = val => typeof val === 'number'; + module.exports = isNumber; \ No newline at end of file diff --git a/test/isObject/isObject.js b/test/isObject/isObject.js index d4bd9c13a..82d25ed30 100644 --- a/test/isObject/isObject.js +++ b/test/isObject/isObject.js @@ -1,2 +1,3 @@ const isObject = obj => obj === Object(obj); + module.exports = isObject; \ No newline at end of file diff --git a/test/isObjectLike/isObjectLike.js b/test/isObjectLike/isObjectLike.js index 03857716a..a8283a13a 100644 --- a/test/isObjectLike/isObjectLike.js +++ b/test/isObjectLike/isObjectLike.js @@ -1,2 +1,3 @@ const isObjectLike = val => val !== null && typeof val === 'object'; + module.exports = isObjectLike; \ No newline at end of file diff --git a/test/isPlainObject/isPlainObject.js b/test/isPlainObject/isPlainObject.js index e773a5a33..155f153a2 100644 --- a/test/isPlainObject/isPlainObject.js +++ b/test/isPlainObject/isPlainObject.js @@ -1,2 +1,3 @@ const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object; + module.exports = isPlainObject; \ No newline at end of file diff --git a/test/isPrime/isPrime.js b/test/isPrime/isPrime.js index e1526b111..5168b854a 100644 --- a/test/isPrime/isPrime.js +++ b/test/isPrime/isPrime.js @@ -1,6 +1,7 @@ const isPrime = num => { -const boundary = Math.floor(Math.sqrt(num)); -for (var i = 2; i <= boundary; i++) if (num % i === 0) return false; -return num >= 2; + 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 diff --git a/test/isPrimitive/isPrimitive.js b/test/isPrimitive/isPrimitive.js index 6d09935ff..5bc6a3b5b 100644 --- a/test/isPrimitive/isPrimitive.js +++ b/test/isPrimitive/isPrimitive.js @@ -1,2 +1,3 @@ const isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null; + module.exports = isPrimitive; \ No newline at end of file diff --git a/test/isPromiseLike/isPromiseLike.js b/test/isPromiseLike/isPromiseLike.js index 1720e8be2..2cefdc2b9 100644 --- a/test/isPromiseLike/isPromiseLike.js +++ b/test/isPromiseLike/isPromiseLike.js @@ -1,5 +1,6 @@ const isPromiseLike = obj => -obj !== null && -(typeof obj === 'object' || typeof obj === 'function') && -typeof obj.then === 'function'; + obj !== null && + (typeof obj === 'object' || typeof obj === 'function') && + typeof obj.then === 'function'; + module.exports = isPromiseLike; \ No newline at end of file diff --git a/test/isSimilar/isSimilar.js b/test/isSimilar/isSimilar.js index 9c4fc3eec..970c007ea 100644 --- a/test/isSimilar/isSimilar.js +++ b/test/isSimilar/isSimilar.js @@ -1,5 +1,6 @@ const isSimilar = (pattern, str) => -[...str].reduce( -(matchIndex, char) => char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex, 0 -) === pattern.length ? true : false; + [...str].reduce( + (matchIndex, char) => char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex, 0 + ) === pattern.length ? true : false; + module.exports = isSimilar; \ No newline at end of file diff --git a/test/isSorted/isSorted.js b/test/isSorted/isSorted.js index aa5f54ef7..7a494c47f 100644 --- a/test/isSorted/isSorted.js +++ b/test/isSorted/isSorted.js @@ -1,9 +1,10 @@ const isSorted = arr => { -let direction = -(arr[0] - arr[1]); -for (let [i, val] of arr.entries()) { -direction = !direction ? -(arr[i - 1] - arr[i]) : direction; -if (i === arr.length - 1) return !direction ? 0 : direction; -else if ((val - arr[i + 1]) * direction > 0) return 0; -} + let direction = -(arr[0] - arr[1]); + for (let [i, val] of arr.entries()) { + direction = !direction ? -(arr[i - 1] - arr[i]) : direction; + if (i === arr.length - 1) return !direction ? 0 : direction; + else if ((val - arr[i + 1]) * direction > 0) return 0; + } }; + module.exports = isSorted; \ No newline at end of file diff --git a/test/isString/isString.js b/test/isString/isString.js index 2b64d1ba7..0a702f734 100644 --- a/test/isString/isString.js +++ b/test/isString/isString.js @@ -1,2 +1,3 @@ const isString = val => typeof val === 'string'; + module.exports = isString; \ No newline at end of file diff --git a/test/isSymbol/isSymbol.js b/test/isSymbol/isSymbol.js index 23c191bda..2a2e24bcc 100644 --- a/test/isSymbol/isSymbol.js +++ b/test/isSymbol/isSymbol.js @@ -1,2 +1,3 @@ const isSymbol = val => typeof val === 'symbol'; + module.exports = isSymbol; \ No newline at end of file diff --git a/test/isTravisCI/isTravisCI.js b/test/isTravisCI/isTravisCI.js index ca00910b6..d02ad95c2 100644 --- a/test/isTravisCI/isTravisCI.js +++ b/test/isTravisCI/isTravisCI.js @@ -1,2 +1,3 @@ const isTravisCI = () => 'TRAVIS' in process.env && 'CI' in process.env; + module.exports = isTravisCI; \ No newline at end of file diff --git a/test/isUndefined/isUndefined.js b/test/isUndefined/isUndefined.js index 6991389b3..d78f9a606 100644 --- a/test/isUndefined/isUndefined.js +++ b/test/isUndefined/isUndefined.js @@ -1,2 +1,3 @@ const isUndefined = val => val === undefined; + module.exports = isUndefined; \ No newline at end of file diff --git a/test/isUpperCase/isUpperCase.js b/test/isUpperCase/isUpperCase.js index 5005edc9d..a330aa9bc 100644 --- a/test/isUpperCase/isUpperCase.js +++ b/test/isUpperCase/isUpperCase.js @@ -1,2 +1,3 @@ const isUpperCase = str => str === str.toUpperCase(); + module.exports = isUpperCase; \ No newline at end of file diff --git a/test/isValidJSON/isValidJSON.js b/test/isValidJSON/isValidJSON.js index a06dd1ac6..d79b3e024 100644 --- a/test/isValidJSON/isValidJSON.js +++ b/test/isValidJSON/isValidJSON.js @@ -1,9 +1,10 @@ const isValidJSON = obj => { -try { -JSON.parse(obj); -return true; -} catch (e) { -return false; -} + try { + JSON.parse(obj); + return true; + } catch (e) { + return false; + } }; + module.exports = isValidJSON; \ No newline at end of file diff --git a/test/join/join.js b/test/join/join.js index a4f91eb6c..f8dd66a34 100644 --- a/test/join/join.js +++ b/test/join/join.js @@ -1,11 +1,12 @@ const join = (arr, separator = ',', end = separator) => -arr.reduce( -(acc, val, i) => -i === arr.length - 2 -? acc + val + end -: i === arr.length - 1 -? acc + val -: acc + val + separator, -'' -); + arr.reduce( + (acc, val, i) => + i === arr.length - 2 + ? acc + val + end + : i === arr.length - 1 + ? acc + val + : acc + val + separator, + '' + ); + module.exports = join; \ No newline at end of file diff --git a/test/last/last.js b/test/last/last.js index a97eb32c3..f4807c08d 100644 --- a/test/last/last.js +++ b/test/last/last.js @@ -1,2 +1,3 @@ const last = arr => arr[arr.length - 1]; + module.exports = last; \ No newline at end of file diff --git a/test/lcm/lcm.js b/test/lcm/lcm.js index a77127fbb..a8e10a0ad 100644 --- a/test/lcm/lcm.js +++ b/test/lcm/lcm.js @@ -1,6 +1,7 @@ const lcm = (...arr) => { -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)); + 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 diff --git a/test/levenshteinDistance/levenshteinDistance.js b/test/levenshteinDistance/levenshteinDistance.js index 8fc74746c..5c5d0820e 100644 --- a/test/levenshteinDistance/levenshteinDistance.js +++ b/test/levenshteinDistance/levenshteinDistance.js @@ -1,18 +1,19 @@ const levenshteinDistance = (string1, string2) => { -if(string1.length === 0) return string2.length; -if(string2.length === 0) return string1.length; -let matrix = Array(string2.length + 1).fill(0).map((x,i) => [i]); -matrix[0] = Array(string1.length + 1).fill(0).map((x,i) => i); -for(let i = 1; i <= string2.length; i++){ -for(let j = 1; j<=string1.length; j++){ -if(string2[i-1] === string1[j-1]){ -matrix[i][j] = matrix[i-1][j-1]; -} -else{ -matrix[i][j] = Math.min(matrix[i-1][j-1]+1, matrix[i][j-1]+1, matrix[i-1][j]+1); -} -} -} -return matrix[string2.length][string1.length]; + if(string1.length === 0) return string2.length; + if(string2.length === 0) return string1.length; + let matrix = Array(string2.length + 1).fill(0).map((x,i) => [i]); + matrix[0] = Array(string1.length + 1).fill(0).map((x,i) => i); + for(let i = 1; i <= string2.length; i++){ + for(let j = 1; j<=string1.length; j++){ + if(string2[i-1] === string1[j-1]){ + matrix[i][j] = matrix[i-1][j-1]; + } + else{ + matrix[i][j] = Math.min(matrix[i-1][j-1]+1, matrix[i][j-1]+1, matrix[i-1][j]+1); + } + } + } + return matrix[string2.length][string1.length]; }; + module.exports = levenshteinDistance; \ No newline at end of file diff --git a/test/longestItem/longestItem.js b/test/longestItem/longestItem.js index bb9ac4b92..e136702ad 100644 --- a/test/longestItem/longestItem.js +++ b/test/longestItem/longestItem.js @@ -1,2 +1,3 @@ const longestItem = (...vals) => [...vals].sort((a, b) => b.length - a.length)[0]; + module.exports = longestItem; \ No newline at end of file diff --git a/test/lowercaseKeys/lowercaseKeys.js b/test/lowercaseKeys/lowercaseKeys.js index 3c5901fe4..e8c2d05ff 100644 --- a/test/lowercaseKeys/lowercaseKeys.js +++ b/test/lowercaseKeys/lowercaseKeys.js @@ -1,6 +1,7 @@ const lowercaseKeys = obj => -Object.keys(obj).reduce((acc, key) => { -acc[key.toLowerCase()] = obj[key]; -return acc; -}, {}); + Object.keys(obj).reduce((acc, key) => { + acc[key.toLowerCase()] = obj[key]; + return acc; + }, {}); + module.exports = lowercaseKeys; \ No newline at end of file diff --git a/test/luhnCheck/luhnCheck.js b/test/luhnCheck/luhnCheck.js index 0244e2737..f5474aace 100644 --- a/test/luhnCheck/luhnCheck.js +++ b/test/luhnCheck/luhnCheck.js @@ -1,11 +1,12 @@ const luhnCheck = num => { -let arr = (num + '') -.split('') -.reverse() -.map(x => parseInt(x)); -let lastDigit = arr.splice(0, 1)[0]; -let sum = arr.reduce((acc, val, i) => (i % 2 !== 0 ? acc + val : acc + ((val * 2) % 9) || 9), 0); -sum += lastDigit; -return sum % 10 === 0; + let arr = (num + '') + .split('') + .reverse() + .map(x => parseInt(x)); + let lastDigit = arr.splice(0, 1)[0]; + let sum = arr.reduce((acc, val, i) => (i % 2 !== 0 ? acc + val : acc + ((val * 2) % 9) || 9), 0); + sum += lastDigit; + return sum % 10 === 0; }; + module.exports = luhnCheck; \ No newline at end of file diff --git a/test/mapKeys/mapKeys.js b/test/mapKeys/mapKeys.js index 524a636c3..ff13a2f9d 100644 --- a/test/mapKeys/mapKeys.js +++ b/test/mapKeys/mapKeys.js @@ -1,6 +1,7 @@ const mapKeys = (obj, fn) => -Object.keys(obj).reduce((acc, k) => { -acc[fn(obj[k], k, obj)] = obj[k]; -return acc; -}, {}); + 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 diff --git a/test/mapObject/mapObject.js b/test/mapObject/mapObject.js index 509f08b1c..20f118b52 100644 --- a/test/mapObject/mapObject.js +++ b/test/mapObject/mapObject.js @@ -1,5 +1,6 @@ const mapObject = (arr, fn) => -(a => ( -(a = [arr, arr.map(fn)]), a[0].reduce((acc, val, ind) => ((acc[val] = a[1][ind]), acc), {}) -))(); + (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 diff --git a/test/mapString/mapString.js b/test/mapString/mapString.js index 20a27f739..f58dea787 100644 --- a/test/mapString/mapString.js +++ b/test/mapString/mapString.js @@ -1,6 +1,7 @@ const mapString = (str, fn) => -str -.split('') -.map((c, i) => fn(c, i, str)) -.join(''); + str + .split('') + .map((c, i) => fn(c, i, str)) + .join(''); + module.exports = mapString; \ No newline at end of file diff --git a/test/mapValues/mapValues.js b/test/mapValues/mapValues.js index abec7632d..616422dfd 100644 --- a/test/mapValues/mapValues.js +++ b/test/mapValues/mapValues.js @@ -1,6 +1,7 @@ const mapValues = (obj, fn) => -Object.keys(obj).reduce((acc, k) => { -acc[k] = fn(obj[k], k, obj); -return acc; -}, {}); + Object.keys(obj).reduce((acc, k) => { + acc[k] = fn(obj[k], k, obj); + return acc; + }, {}); + module.exports = mapValues; \ No newline at end of file diff --git a/test/mask/mask.js b/test/mask/mask.js index 2c79c7d50..87c2522f1 100644 --- a/test/mask/mask.js +++ b/test/mask/mask.js @@ -1,3 +1,4 @@ const mask = (cc, num = 4, mask = '*') => -('' + cc).slice(0, -num).replace(/./g, mask) + ('' + cc).slice(-num); + ('' + cc).slice(0, -num).replace(/./g, mask) + ('' + cc).slice(-num); + module.exports = mask; \ No newline at end of file diff --git a/test/matches/matches.js b/test/matches/matches.js index 135df143d..c36b71e60 100644 --- a/test/matches/matches.js +++ b/test/matches/matches.js @@ -1,3 +1,4 @@ const matches = (obj, source) => -Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); + Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); + module.exports = matches; \ No newline at end of file diff --git a/test/matchesWith/matchesWith.js b/test/matchesWith/matchesWith.js index 0daa71da7..b81d0ef6f 100644 --- a/test/matchesWith/matchesWith.js +++ b/test/matchesWith/matchesWith.js @@ -1,8 +1,9 @@ const matchesWith = (obj, source, fn) => -Object.keys(source).every( -key => -obj.hasOwnProperty(key) && fn -? fn(obj[key], source[key], key, obj, source) -: obj[key] == source[key] -); + Object.keys(source).every( + key => + 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 diff --git a/test/maxBy/maxBy.js b/test/maxBy/maxBy.js index c4204d79f..1915c5dbf 100644 --- a/test/maxBy/maxBy.js +++ b/test/maxBy/maxBy.js @@ -1,2 +1,3 @@ const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); + module.exports = maxBy; \ No newline at end of file diff --git a/test/maxN/maxN.js b/test/maxN/maxN.js index 75046237a..de2ad853f 100644 --- a/test/maxN/maxN.js +++ b/test/maxN/maxN.js @@ -1,2 +1,3 @@ const maxN = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n); + module.exports = maxN; \ No newline at end of file diff --git a/test/median/median.js b/test/median/median.js index 643d20f4a..c0078ae4b 100644 --- a/test/median/median.js +++ b/test/median/median.js @@ -1,6 +1,7 @@ const median = arr => { -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; + 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 diff --git a/test/memoize/memoize.js b/test/memoize/memoize.js index ab6c99f1e..543cec041 100644 --- a/test/memoize/memoize.js +++ b/test/memoize/memoize.js @@ -1,9 +1,10 @@ const memoize = fn => { -const cache = new Map(); -const cached = function(val) { -return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val); -}; -cached.cache = cache; -return cached; + const cache = new Map(); + const cached = function(val) { + return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val); + }; + cached.cache = cache; + return cached; }; + module.exports = memoize; \ No newline at end of file diff --git a/test/merge/merge.js b/test/merge/merge.js index cb441008e..e6f927eee 100644 --- a/test/merge/merge.js +++ b/test/merge/merge.js @@ -1,10 +1,11 @@ const merge = (...objs) => -[...objs].reduce( -(acc, obj) => -Object.keys(obj).reduce((a, k) => { -acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k]; -return acc; -}, {}), -{} -); + [...objs].reduce( + (acc, obj) => + Object.keys(obj).reduce((a, k) => { + acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k]; + return acc; + }, {}), + {} + ); + module.exports = merge; \ No newline at end of file diff --git a/test/minBy/minBy.js b/test/minBy/minBy.js index 82f5005b0..64eaa38d8 100644 --- a/test/minBy/minBy.js +++ b/test/minBy/minBy.js @@ -1,2 +1,3 @@ const minBy = (arr, fn) => Math.min(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); + module.exports = minBy; \ No newline at end of file diff --git a/test/minN/minN.js b/test/minN/minN.js index 96a78fc3b..c3886e50d 100644 --- a/test/minN/minN.js +++ b/test/minN/minN.js @@ -1,2 +1,3 @@ const minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n); + module.exports = minN; \ No newline at end of file diff --git a/test/mostPerformant/mostPerformant.js b/test/mostPerformant/mostPerformant.js index ae084a5cf..28dc1e960 100644 --- a/test/mostPerformant/mostPerformant.js +++ b/test/mostPerformant/mostPerformant.js @@ -1,9 +1,10 @@ const mostPerformant = (fns, iterations = 10000) => { -const times = fns.map(fn => { -const before = performance.now(); -for (let i = 0; i < iterations; i++) fn(); -return performance.now() - before; -}); -return times.indexOf(Math.min(...times)); + const times = fns.map(fn => { + const before = performance.now(); + for (let i = 0; i < iterations; i++) fn(); + return performance.now() - before; + }); + return times.indexOf(Math.min(...times)); }; + module.exports = mostPerformant; \ No newline at end of file diff --git a/test/negate/negate.js b/test/negate/negate.js index b3dfb79e6..f9a1aee04 100644 --- a/test/negate/negate.js +++ b/test/negate/negate.js @@ -1,2 +1,3 @@ const negate = func => (...args) => !func(...args); + module.exports = negate; \ No newline at end of file diff --git a/test/nest/nest.js b/test/nest/nest.js index 4afb092bd..63f922f41 100644 --- a/test/nest/nest.js +++ b/test/nest/nest.js @@ -1,5 +1,6 @@ const nest = (items, id = null, link = 'parent_id') => -items -.filter(item => item[link] === id) -.map(item => ({ ...item, children: nest(items, item.id) })); + items + .filter(item => item[link] === id) + .map(item => ({ ...item, children: nest(items, item.id) })); + module.exports = nest; \ No newline at end of file diff --git a/test/nodeListToArray/nodeListToArray.js b/test/nodeListToArray/nodeListToArray.js index 916fc58e7..af21b53d1 100644 --- a/test/nodeListToArray/nodeListToArray.js +++ b/test/nodeListToArray/nodeListToArray.js @@ -1,2 +1,3 @@ const nodeListToArray = nodeList => Array.prototype.slice.call(nodeList); + module.exports = nodeListToArray; \ No newline at end of file diff --git a/test/none/none.js b/test/none/none.js index 2e81d7d72..cb19a4628 100644 --- a/test/none/none.js +++ b/test/none/none.js @@ -1,2 +1,3 @@ const none = (arr, fn = Boolean) => !arr.some(fn); + module.exports = none; \ No newline at end of file diff --git a/test/nthArg/nthArg.js b/test/nthArg/nthArg.js index dc08dad6b..c9b33e2da 100644 --- a/test/nthArg/nthArg.js +++ b/test/nthArg/nthArg.js @@ -1,2 +1,3 @@ const nthArg = n => (...args) => args.slice(n)[0]; + module.exports = nthArg; \ No newline at end of file diff --git a/test/nthElement/nthElement.js b/test/nthElement/nthElement.js index 76765b528..ff5f0047f 100644 --- a/test/nthElement/nthElement.js +++ b/test/nthElement/nthElement.js @@ -1,2 +1,3 @@ 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 diff --git a/test/objectFromPairs/objectFromPairs.js b/test/objectFromPairs/objectFromPairs.js index fa1f3fe47..2429d7e26 100644 --- a/test/objectFromPairs/objectFromPairs.js +++ b/test/objectFromPairs/objectFromPairs.js @@ -1,2 +1,3 @@ const objectFromPairs = arr => arr.reduce((a, v) => ((a[v[0]] = v[1]), a), {}); + module.exports = objectFromPairs; \ No newline at end of file diff --git a/test/objectToPairs/objectToPairs.js b/test/objectToPairs/objectToPairs.js index 6fbfbab75..3fa1d038c 100644 --- a/test/objectToPairs/objectToPairs.js +++ b/test/objectToPairs/objectToPairs.js @@ -1,2 +1,3 @@ const objectToPairs = obj => Object.keys(obj).map(k => [k, obj[k]]); + module.exports = objectToPairs; \ No newline at end of file diff --git a/test/observeMutations/observeMutations.js b/test/observeMutations/observeMutations.js index aabe9b998..2fe5f658a 100644 --- a/test/observeMutations/observeMutations.js +++ b/test/observeMutations/observeMutations.js @@ -1,19 +1,20 @@ const observeMutations = (element, callback, options) => { -const observer = new MutationObserver(mutations => mutations.forEach(m => callback(m))); -observer.observe( -element, -Object.assign( -{ -childList: true, -attributes: true, -attributeOldValue: true, -characterData: true, -characterDataOldValue: true, -subtree: true -}, -options -) -); -return observer; + const observer = new MutationObserver(mutations => mutations.forEach(m => callback(m))); + observer.observe( + element, + Object.assign( + { + childList: true, + attributes: true, + attributeOldValue: true, + characterData: true, + characterDataOldValue: true, + subtree: true + }, + options + ) + ); + return observer; }; + module.exports = observeMutations; \ No newline at end of file diff --git a/test/off/off.js b/test/off/off.js index ab9e91695..dfd5f8915 100644 --- a/test/off/off.js +++ b/test/off/off.js @@ -1,2 +1,3 @@ const off = (el, evt, fn, opts = false) => el.removeEventListener(evt, fn, opts); + module.exports = off; \ No newline at end of file diff --git a/test/offset/offset.js b/test/offset/offset.js index 7f25c5ec4..48c574b2d 100644 --- a/test/offset/offset.js +++ b/test/offset/offset.js @@ -1,2 +1,3 @@ const offset = (arr, offset) => [...arr.slice(offset), ...arr.slice(0, offset)]; + module.exports = offset; \ No newline at end of file diff --git a/test/omit/omit.js b/test/omit/omit.js index ffdbcbd82..98aa3b58d 100644 --- a/test/omit/omit.js +++ b/test/omit/omit.js @@ -1,5 +1,6 @@ const omit = (obj, arr) => -Object.keys(obj) -.filter(k => !arr.includes(k)) -.reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); + 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 diff --git a/test/omitBy/omitBy.js b/test/omitBy/omitBy.js index 5937a3d8a..66a1a5138 100644 --- a/test/omitBy/omitBy.js +++ b/test/omitBy/omitBy.js @@ -1,5 +1,6 @@ const omitBy = (obj, fn) => -Object.keys(obj) -.filter(k => !fn(obj[k], k)) -.reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); + 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 diff --git a/test/on/on.js b/test/on/on.js index 36b943813..e6a70168f 100644 --- a/test/on/on.js +++ b/test/on/on.js @@ -1,6 +1,7 @@ const on = (el, evt, fn, opts = {}) => { -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; + 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 diff --git a/test/onUserInputChange/onUserInputChange.js b/test/onUserInputChange/onUserInputChange.js index 5cb956112..59e3a4e1e 100644 --- a/test/onUserInputChange/onUserInputChange.js +++ b/test/onUserInputChange/onUserInputChange.js @@ -1,15 +1,16 @@ const onUserInputChange = callback => { -let type = 'mouse', -lastTime = 0; -const mousemoveHandler = () => { -const now = performance.now(); -if (now - lastTime < 20) -(type = 'mouse'), callback(type), document.removeEventListener('mousemove', mousemoveHandler); -lastTime = now; -}; -document.addEventListener('touchstart', () => { -if (type === 'touch') return; -(type = 'touch'), callback(type), document.addEventListener('mousemove', mousemoveHandler); -}); + let type = 'mouse', + lastTime = 0; + const mousemoveHandler = () => { + const now = performance.now(); + if (now - lastTime < 20) + (type = 'mouse'), callback(type), document.removeEventListener('mousemove', mousemoveHandler); + lastTime = now; + }; + document.addEventListener('touchstart', () => { + if (type === 'touch') return; + (type = 'touch'), callback(type), document.addEventListener('mousemove', mousemoveHandler); + }); }; + module.exports = onUserInputChange; \ No newline at end of file diff --git a/test/once/once.js b/test/once/once.js index d37dcdc87..7ae653feb 100644 --- a/test/once/once.js +++ b/test/once/once.js @@ -1,9 +1,10 @@ const once = fn => { -let called = false; -return function(...args) { -if (called) return; -called = true; -return fn.apply(this, args); -}; + let called = false; + return function(...args) { + if (called) return; + called = true; + return fn.apply(this, args); + }; }; + module.exports = once; \ No newline at end of file diff --git a/test/orderBy/orderBy.js b/test/orderBy/orderBy.js index c98d2e74c..cd4cddc1a 100644 --- a/test/orderBy/orderBy.js +++ b/test/orderBy/orderBy.js @@ -1,11 +1,12 @@ const orderBy = (arr, props, orders) => -[...arr].sort((a, b) => -props.reduce((acc, prop, i) => { -if (acc === 0) { -const [p1, p2] = orders && orders[i] === 'desc' ? [b[prop], a[prop]] : [a[prop], b[prop]]; -acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0; -} -return acc; -}, 0) -); + [...arr].sort((a, b) => + props.reduce((acc, prop, i) => { + if (acc === 0) { + const [p1, p2] = orders && orders[i] === 'desc' ? [b[prop], a[prop]] : [a[prop], b[prop]]; + acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0; + } + return acc; + }, 0) + ); + module.exports = orderBy; \ No newline at end of file diff --git a/test/over/over.js b/test/over/over.js index 56ed8046e..4a8c6dde7 100644 --- a/test/over/over.js +++ b/test/over/over.js @@ -1,2 +1,3 @@ const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args)); + module.exports = over; \ No newline at end of file diff --git a/test/overArgs/overArgs.js b/test/overArgs/overArgs.js index 10af7fd54..971399de4 100644 --- a/test/overArgs/overArgs.js +++ b/test/overArgs/overArgs.js @@ -1,2 +1,3 @@ const overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val))); + module.exports = overArgs; \ No newline at end of file diff --git a/test/pad/pad.js b/test/pad/pad.js index 34b6e0b89..ae3fdaffb 100644 --- a/test/pad/pad.js +++ b/test/pad/pad.js @@ -1,3 +1,4 @@ const pad = (str, length, char = ' ') => -str.padStart((str.length + length) / 2, char).padEnd(length, char); + str.padStart((str.length + length) / 2, char).padEnd(length, char); + module.exports = pad; \ No newline at end of file diff --git a/test/palindrome/palindrome.js b/test/palindrome/palindrome.js index c4f314113..8b822cd4a 100644 --- a/test/palindrome/palindrome.js +++ b/test/palindrome/palindrome.js @@ -1,5 +1,6 @@ const palindrome = str => { -const s = str.toLowerCase().replace(/[\W_]/g, ''); -return s === [...s].reverse().join(''); + const s = str.toLowerCase().replace(/[\W_]/g, ''); + return s === [...s].reverse().join(''); }; + module.exports = palindrome; \ No newline at end of file diff --git a/test/parseCookie/parseCookie.js b/test/parseCookie/parseCookie.js index 9e620bfe0..dc72ed972 100644 --- a/test/parseCookie/parseCookie.js +++ b/test/parseCookie/parseCookie.js @@ -1,9 +1,10 @@ const parseCookie = str => -str -.split(';') -.map(v => v.split('=')) -.reduce((acc, v) => { -acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); -return acc; -}, {}); + str + .split(';') + .map(v => v.split('=')) + .reduce((acc, v) => { + acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); + return acc; + }, {}); + module.exports = parseCookie; \ No newline at end of file diff --git a/test/partial/partial.js b/test/partial/partial.js index 202699ee7..3fb22387e 100644 --- a/test/partial/partial.js +++ b/test/partial/partial.js @@ -1,2 +1,3 @@ const partial = (fn, ...partials) => (...args) => fn(...partials, ...args); + module.exports = partial; \ No newline at end of file diff --git a/test/partialRight/partialRight.js b/test/partialRight/partialRight.js index d58d2f8ab..d38ee8079 100644 --- a/test/partialRight/partialRight.js +++ b/test/partialRight/partialRight.js @@ -1,2 +1,3 @@ const partialRight = (fn, ...partials) => (...args) => fn(...args, ...partials); + module.exports = partialRight; \ No newline at end of file diff --git a/test/partition/partition.js b/test/partition/partition.js index 6df2c8dc0..97b24f4fb 100644 --- a/test/partition/partition.js +++ b/test/partition/partition.js @@ -1,9 +1,10 @@ const partition = (arr, fn) => -arr.reduce( -(acc, val, i, arr) => { -acc[fn(val, i, arr) ? 0 : 1].push(val); -return acc; -}, -[[], []] -); + arr.reduce( + (acc, val, i, arr) => { + acc[fn(val, i, arr) ? 0 : 1].push(val); + return acc; + }, + [[], []] + ); + module.exports = partition; \ No newline at end of file diff --git a/test/percentile/percentile.js b/test/percentile/percentile.js index 3cf0936c8..67a0de491 100644 --- a/test/percentile/percentile.js +++ b/test/percentile/percentile.js @@ -1,3 +1,4 @@ const percentile = (arr, val) => -(100 * arr.reduce((acc, v) => acc + (v < val ? 1 : 0) + (v === val ? 0.5 : 0), 0)) / arr.length; + (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 diff --git a/test/permutations/permutations.js b/test/permutations/permutations.js index 6c002e581..3dd23f14d 100644 --- a/test/permutations/permutations.js +++ b/test/permutations/permutations.js @@ -1,11 +1,12 @@ const permutations = arr => { -if (arr.length <= 2) return arr.length === 2 ? [arr, [arr[1], arr[0]]] : arr; -return arr.reduce( -(acc, item, i) => -acc.concat( -permutations([...arr.slice(0, i), ...arr.slice(i + 1)]).map(val => [item, ...val]) -), -[] -); + if (arr.length <= 2) return arr.length === 2 ? [arr, [arr[1], arr[0]]] : arr; + return arr.reduce( + (acc, item, i) => + acc.concat( + permutations([...arr.slice(0, i), ...arr.slice(i + 1)]).map(val => [item, ...val]) + ), + [] + ); }; + module.exports = permutations; \ No newline at end of file diff --git a/test/pick/pick.js b/test/pick/pick.js index 28e8caac7..186bfade4 100644 --- a/test/pick/pick.js +++ b/test/pick/pick.js @@ -1,3 +1,4 @@ const pick = (obj, arr) => -arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); + arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); + module.exports = pick; \ No newline at end of file diff --git a/test/pickBy/pickBy.js b/test/pickBy/pickBy.js index fa2f4701f..c5b7009d2 100644 --- a/test/pickBy/pickBy.js +++ b/test/pickBy/pickBy.js @@ -1,5 +1,6 @@ const pickBy = (obj, fn) => -Object.keys(obj) -.filter(k => fn(obj[k], k)) -.reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); + 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 diff --git a/test/pipeAsyncFunctions/pipeAsyncFunctions.js b/test/pipeAsyncFunctions/pipeAsyncFunctions.js index 2057bfbd8..4cd443aab 100644 --- a/test/pipeAsyncFunctions/pipeAsyncFunctions.js +++ b/test/pipeAsyncFunctions/pipeAsyncFunctions.js @@ -1,2 +1,3 @@ const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg)); + module.exports = pipeAsyncFunctions; \ No newline at end of file diff --git a/test/pipeFunctions/pipeFunctions.js b/test/pipeFunctions/pipeFunctions.js index 730dcd382..036617ed2 100644 --- a/test/pipeFunctions/pipeFunctions.js +++ b/test/pipeFunctions/pipeFunctions.js @@ -1,2 +1,3 @@ const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); + module.exports = pipeFunctions; \ No newline at end of file diff --git a/test/pluralize/pluralize.js b/test/pluralize/pluralize.js index 53277ee84..64f42583d 100644 --- a/test/pluralize/pluralize.js +++ b/test/pluralize/pluralize.js @@ -1,7 +1,8 @@ const pluralize = (val, word, plural = word + 's') => { -const _pluralize = (num, word, plural = word + 's') => -[1, -1].includes(Number(num)) ? word : plural; -if (typeof val === 'object') return (num, word) => _pluralize(num, word, val[word]); -return _pluralize(val, word, plural); + const _pluralize = (num, word, plural = word + 's') => + [1, -1].includes(Number(num)) ? word : plural; + 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 diff --git a/test/powerset/powerset.js b/test/powerset/powerset.js index 87bfd2f95..bd230c83a 100644 --- a/test/powerset/powerset.js +++ b/test/powerset/powerset.js @@ -1,2 +1,3 @@ const powerset = arr => arr.reduce((a, v) => a.concat(a.map(r => [v].concat(r))), [[]]); + module.exports = powerset; \ No newline at end of file diff --git a/test/prefix/prefix.js b/test/prefix/prefix.js index 05515078e..512555e4a 100644 --- a/test/prefix/prefix.js +++ b/test/prefix/prefix.js @@ -1,9 +1,10 @@ const prefix = prop => { -const capitalizedProp = prop.charAt(0).toUpperCase() + prop.slice(1); -const prefixes = ['', 'webkit', 'moz', 'ms', 'o']; -const i = prefixes.findIndex( -prefix => typeof document.body.style[prefix ? prefix + capitalizedProp : prop] !== 'undefined' -); -return i !== -1 ? (i === 0 ? prop : prefixes[i] + capitalizedProp) : null; + const capitalizedProp = prop.charAt(0).toUpperCase() + prop.slice(1); + const prefixes = ['', 'webkit', 'moz', 'ms', 'o']; + const i = prefixes.findIndex( + prefix => typeof document.body.style[prefix ? prefix + capitalizedProp : prop] !== 'undefined' + ); + return i !== -1 ? (i === 0 ? prop : prefixes[i] + capitalizedProp) : null; }; + module.exports = prefix; \ No newline at end of file diff --git a/test/prettyBytes/prettyBytes.js b/test/prettyBytes/prettyBytes.js index 0841950dd..66d9e9a77 100644 --- a/test/prettyBytes/prettyBytes.js +++ b/test/prettyBytes/prettyBytes.js @@ -1,8 +1,9 @@ const prettyBytes = (num, precision = 3, addSpace = true) => { -const UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; -if (Math.abs(num) < 1) return num + (addSpace ? ' ' : '') + UNITS[0]; -const exponent = Math.min(Math.floor(Math.log10(num < 0 ? -num : num) / 3), UNITS.length - 1); -const n = Number(((num < 0 ? -num : num) / 1000 ** exponent).toPrecision(precision)); -return (num < 0 ? '-' : '') + n + (addSpace ? ' ' : '') + UNITS[exponent]; + const UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + if (Math.abs(num) < 1) return num + (addSpace ? ' ' : '') + UNITS[0]; + const exponent = Math.min(Math.floor(Math.log10(num < 0 ? -num : num) / 3), UNITS.length - 1); + 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 diff --git a/test/primes/primes.js b/test/primes/primes.js index 9b8d435b8..1b8e9fdc5 100644 --- a/test/primes/primes.js +++ b/test/primes/primes.js @@ -1,8 +1,9 @@ const primes = num => { -let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2), -sqroot = Math.floor(Math.sqrt(num)), -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; + let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2), + sqroot = Math.floor(Math.sqrt(num)), + 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 diff --git a/test/promisify/promisify.js b/test/promisify/promisify.js index e5f4a57b8..0a5084ddc 100644 --- a/test/promisify/promisify.js +++ b/test/promisify/promisify.js @@ -1,5 +1,6 @@ const promisify = func => (...args) => -new Promise((resolve, reject) => -func(...args, (err, result) => (err ? reject(err) : resolve(result))) -); + new Promise((resolve, reject) => + func(...args, (err, result) => (err ? reject(err) : resolve(result))) + ); + module.exports = promisify; \ No newline at end of file diff --git a/test/pull/pull.js b/test/pull/pull.js index b9b21eccb..fc90e79b3 100644 --- a/test/pull/pull.js +++ b/test/pull/pull.js @@ -1,7 +1,8 @@ const pull = (arr, ...args) => { -let argState = Array.isArray(args[0]) ? args[0] : args; -let pulled = arr.filter((v, i) => !argState.includes(v)); -arr.length = 0; -pulled.forEach(v => arr.push(v)); + let argState = Array.isArray(args[0]) ? args[0] : args; + 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 diff --git a/test/pullAtIndex/pullAtIndex.js b/test/pullAtIndex/pullAtIndex.js index c3f3e6c2e..89d497e4d 100644 --- a/test/pullAtIndex/pullAtIndex.js +++ b/test/pullAtIndex/pullAtIndex.js @@ -1,10 +1,11 @@ const pullAtIndex = (arr, pullArr) => { -let removed = []; -let pulled = arr -.map((v, i) => (pullArr.includes(i) ? removed.push(v) : v)) -.filter((v, i) => !pullArr.includes(i)); -arr.length = 0; -pulled.forEach(v => arr.push(v)); -return removed; + let removed = []; + let pulled = arr + .map((v, i) => (pullArr.includes(i) ? removed.push(v) : v)) + .filter((v, i) => !pullArr.includes(i)); + arr.length = 0; + pulled.forEach(v => arr.push(v)); + return removed; }; + module.exports = pullAtIndex; \ No newline at end of file diff --git a/test/pullAtValue/pullAtValue.js b/test/pullAtValue/pullAtValue.js index 93def969d..70cd17f6f 100644 --- a/test/pullAtValue/pullAtValue.js +++ b/test/pullAtValue/pullAtValue.js @@ -1,9 +1,10 @@ const pullAtValue = (arr, pullArr) => { -let removed = [], -pushToRemove = arr.forEach((v, i) => (pullArr.includes(v) ? removed.push(v) : v)), -mutateTo = arr.filter((v, i) => !pullArr.includes(v)); -arr.length = 0; -mutateTo.forEach(v => arr.push(v)); -return removed; + let removed = [], + pushToRemove = arr.forEach((v, i) => (pullArr.includes(v) ? removed.push(v) : v)), + mutateTo = arr.filter((v, i) => !pullArr.includes(v)); + arr.length = 0; + mutateTo.forEach(v => arr.push(v)); + return removed; }; + module.exports = pullAtValue; \ No newline at end of file diff --git a/test/pullBy/pullBy.js b/test/pullBy/pullBy.js index 76728052d..2cbfe212f 100644 --- a/test/pullBy/pullBy.js +++ b/test/pullBy/pullBy.js @@ -1,10 +1,11 @@ const pullBy = (arr, ...args) => { -const length = args.length; -let fn = length > 1 ? args[length - 1] : undefined; -fn = typeof fn == 'function' ? (args.pop(), fn) : undefined; -let argState = (Array.isArray(args[0]) ? args[0] : args).map(val => fn(val)); -let pulled = arr.filter((v, i) => !argState.includes(fn(v))); -arr.length = 0; -pulled.forEach(v => arr.push(v)); + const length = args.length; + let fn = length > 1 ? args[length - 1] : undefined; + fn = typeof fn == 'function' ? (args.pop(), fn) : undefined; + let argState = (Array.isArray(args[0]) ? args[0] : args).map(val => fn(val)); + let pulled = arr.filter((v, i) => !argState.includes(fn(v))); + arr.length = 0; + pulled.forEach(v => arr.push(v)); }; + module.exports = pullBy; \ No newline at end of file diff --git a/test/quickSort/quickSort.js b/test/quickSort/quickSort.js index b5bb4cf86..5b3331580 100644 --- a/test/quickSort/quickSort.js +++ b/test/quickSort/quickSort.js @@ -1,9 +1,10 @@ const quickSort = ([n, ...nums], desc) => -isNaN(n) -? [] -: [ -...quickSort(nums.filter(v => (desc ? v > n : v <= n)), desc), -n, -...quickSort(nums.filter(v => (!desc ? v > n : v <= n)), desc) -]; + isNaN(n) + ? [] + : [ + ...quickSort(nums.filter(v => (desc ? v > n : v <= n)), desc), + n, + ...quickSort(nums.filter(v => (!desc ? v > n : v <= n)), desc) + ]; + module.exports = quickSort; \ No newline at end of file diff --git a/test/radsToDegrees/radsToDegrees.js b/test/radsToDegrees/radsToDegrees.js index 8e1db3a18..bee1c99e6 100644 --- a/test/radsToDegrees/radsToDegrees.js +++ b/test/radsToDegrees/radsToDegrees.js @@ -1,2 +1,3 @@ const radsToDegrees = rad => (rad * 180.0) / Math.PI; + module.exports = radsToDegrees; \ No newline at end of file diff --git a/test/randomHexColorCode/randomHexColorCode.js b/test/randomHexColorCode/randomHexColorCode.js index e2ae04303..93e98f2f5 100644 --- a/test/randomHexColorCode/randomHexColorCode.js +++ b/test/randomHexColorCode/randomHexColorCode.js @@ -1,5 +1,6 @@ const randomHexColorCode = () => { -let n = (Math.random() * 0xfffff * 1000000).toString(16); -return '#' + n.slice(0, 6); + let n = (Math.random() * 0xfffff * 1000000).toString(16); + return '#' + n.slice(0, 6); }; + module.exports = randomHexColorCode; \ No newline at end of file diff --git a/test/randomIntArrayInRange/randomIntArrayInRange.js b/test/randomIntArrayInRange/randomIntArrayInRange.js index 6816c654b..c27cbda15 100644 --- a/test/randomIntArrayInRange/randomIntArrayInRange.js +++ b/test/randomIntArrayInRange/randomIntArrayInRange.js @@ -1,3 +1,4 @@ const randomIntArrayInRange = (min, max, n = 1) => -Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min); + Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min); + module.exports = randomIntArrayInRange; \ No newline at end of file diff --git a/test/randomIntegerInRange/randomIntegerInRange.js b/test/randomIntegerInRange/randomIntegerInRange.js index 465beef48..3e664fb54 100644 --- a/test/randomIntegerInRange/randomIntegerInRange.js +++ b/test/randomIntegerInRange/randomIntegerInRange.js @@ -1,2 +1,3 @@ const randomIntegerInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; + module.exports = randomIntegerInRange; \ No newline at end of file diff --git a/test/randomNumberInRange/randomNumberInRange.js b/test/randomNumberInRange/randomNumberInRange.js index bac57eef7..46ded402b 100644 --- a/test/randomNumberInRange/randomNumberInRange.js +++ b/test/randomNumberInRange/randomNumberInRange.js @@ -1,2 +1,3 @@ const randomNumberInRange = (min, max) => Math.random() * (max - min) + min; + module.exports = randomNumberInRange; \ No newline at end of file diff --git a/test/readFileLines/readFileLines.js b/test/readFileLines/readFileLines.js index 75a0af232..c4bca6989 100644 --- a/test/readFileLines/readFileLines.js +++ b/test/readFileLines/readFileLines.js @@ -1,7 +1,8 @@ const fs = require('fs'); const readFileLines = filename => -fs -.readFileSync(filename) -.toString('UTF8') -.split('\n'); + fs + .readFileSync(filename) + .toString('UTF8') + .split('\n'); + module.exports = readFileLines; \ No newline at end of file diff --git a/test/rearg/rearg.js b/test/rearg/rearg.js index d8353d7c0..2da6892d4 100644 --- a/test/rearg/rearg.js +++ b/test/rearg/rearg.js @@ -1,8 +1,9 @@ const rearg = (fn, indexes) => (...args) => -fn( -...args.reduce( -(acc, val, i) => ((acc[indexes.indexOf(i)] = val), acc), -Array.from({ length: indexes.length }) -) -); + fn( + ...args.reduce( + (acc, val, i) => ((acc[indexes.indexOf(i)] = val), acc), + Array.from({ length: indexes.length }) + ) + ); + module.exports = rearg; \ No newline at end of file diff --git a/test/recordAnimationFrames/recordAnimationFrames.js b/test/recordAnimationFrames/recordAnimationFrames.js index 7e7ca9004..54e536a23 100644 --- a/test/recordAnimationFrames/recordAnimationFrames.js +++ b/test/recordAnimationFrames/recordAnimationFrames.js @@ -1,21 +1,22 @@ const recordAnimationFrames = (callback, autoStart = true) => { -let running = true, -raf; -const stop = () => { -running = false; -cancelAnimationFrame(raf); -}; -const start = () => { -running = true; -run(); -}; -const run = () => { -raf = requestAnimationFrame(() => { -callback(); -if (running) run(); -}); -}; -if (autoStart) start(); -return { start, stop }; + let running = true, + raf; + const stop = () => { + running = false; + cancelAnimationFrame(raf); + }; + const start = () => { + running = true; + run(); + }; + const run = () => { + raf = requestAnimationFrame(() => { + callback(); + if (running) run(); + }); + }; + if (autoStart) start(); + return { start, stop }; }; + module.exports = recordAnimationFrames; \ No newline at end of file diff --git a/test/redirect/redirect.js b/test/redirect/redirect.js index 6b3c1821c..7d925a18a 100644 --- a/test/redirect/redirect.js +++ b/test/redirect/redirect.js @@ -1,3 +1,4 @@ const redirect = (url, asLink = true) => -asLink ? (window.location.href = url) : window.location.replace(url); + asLink ? (window.location.href = url) : window.location.replace(url); + module.exports = redirect; \ No newline at end of file diff --git a/test/reduceSuccessive/reduceSuccessive.js b/test/reduceSuccessive/reduceSuccessive.js index 8c2d8ccd3..a383aeb81 100644 --- a/test/reduceSuccessive/reduceSuccessive.js +++ b/test/reduceSuccessive/reduceSuccessive.js @@ -1,3 +1,4 @@ const reduceSuccessive = (arr, fn, acc) => -arr.reduce((res, val, i, arr) => (res.push(fn(res.slice(-1)[0], val, i, arr)), res), [acc]); + arr.reduce((res, val, i, arr) => (res.push(fn(res.slice(-1)[0], val, i, arr)), res), [acc]); + module.exports = reduceSuccessive; \ No newline at end of file diff --git a/test/reduceWhich/reduceWhich.js b/test/reduceWhich/reduceWhich.js index 5a2d4c7af..c5b2fee24 100644 --- a/test/reduceWhich/reduceWhich.js +++ b/test/reduceWhich/reduceWhich.js @@ -1,3 +1,4 @@ const reduceWhich = (arr, comparator = (a, b) => a - b) => -arr.reduce((a, b) => (comparator(a, b) >= 0 ? b : a)); + arr.reduce((a, b) => (comparator(a, b) >= 0 ? b : a)); + module.exports = reduceWhich; \ No newline at end of file diff --git a/test/reducedFilter/reducedFilter.js b/test/reducedFilter/reducedFilter.js index 8b5a361bd..46a37b59d 100644 --- a/test/reducedFilter/reducedFilter.js +++ b/test/reducedFilter/reducedFilter.js @@ -1,8 +1,9 @@ const reducedFilter = (data, keys, fn) => -data.filter(fn).map(el => -keys.reduce((acc, key) => { -acc[key] = el[key]; -return acc; -}, {}) -); + data.filter(fn).map(el => + keys.reduce((acc, key) => { + acc[key] = el[key]; + return acc; + }, {}) + ); + module.exports = reducedFilter; \ No newline at end of file diff --git a/test/reject/reject.js b/test/reject/reject.js index 85718b833..fe77ad6c4 100644 --- a/test/reject/reject.js +++ b/test/reject/reject.js @@ -1,2 +1,3 @@ const reject = (pred, array) => array.filter((...args) => !pred(...args)); + module.exports = reject; \ No newline at end of file diff --git a/test/remove/remove.js b/test/remove/remove.js index c4f4ec1f3..cf07fe88a 100644 --- a/test/remove/remove.js +++ b/test/remove/remove.js @@ -1,8 +1,9 @@ const remove = (arr, func) => -Array.isArray(arr) -? arr.filter(func).reduce((acc, val) => { -arr.splice(arr.indexOf(val), 1); -return acc.concat(val); -}, []) -: []; + Array.isArray(arr) + ? arr.filter(func).reduce((acc, val) => { + arr.splice(arr.indexOf(val), 1); + return acc.concat(val); + }, []) + : []; + module.exports = remove; \ No newline at end of file diff --git a/test/removeNonASCII/removeNonASCII.js b/test/removeNonASCII/removeNonASCII.js index ea6f6e31f..e6d9253d5 100644 --- a/test/removeNonASCII/removeNonASCII.js +++ b/test/removeNonASCII/removeNonASCII.js @@ -1,2 +1,3 @@ const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); + module.exports = removeNonASCII; \ No newline at end of file diff --git a/test/removeVowels/removeVowels.js b/test/removeVowels/removeVowels.js index 53a1638a4..7b62ecda6 100644 --- a/test/removeVowels/removeVowels.js +++ b/test/removeVowels/removeVowels.js @@ -1,2 +1,3 @@ const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi,repl); + module.exports = removeVowels; \ No newline at end of file diff --git a/test/renameKeys/renameKeys.js b/test/renameKeys/renameKeys.js index 5ecf08f90..e8d8aa096 100644 --- a/test/renameKeys/renameKeys.js +++ b/test/renameKeys/renameKeys.js @@ -1,9 +1,10 @@ const renameKeys = (keysMap, obj) => -Object.keys(obj).reduce( -(acc, key) => ({ -...acc, -...{ [keysMap[key] || key]: obj[key] } -}), -{} -); + Object.keys(obj).reduce( + (acc, key) => ({ + ...acc, + ...{ [keysMap[key] || key]: obj[key] } + }), + {} + ); + module.exports = renameKeys; \ No newline at end of file diff --git a/test/reverseString/reverseString.js b/test/reverseString/reverseString.js index fc40f8c4d..f33cee663 100644 --- a/test/reverseString/reverseString.js +++ b/test/reverseString/reverseString.js @@ -1,2 +1,3 @@ const reverseString = str => [...str].reverse().join(''); + module.exports = reverseString; \ No newline at end of file diff --git a/test/round/round.js b/test/round/round.js index c5c59560d..f4c3815a1 100644 --- a/test/round/round.js +++ b/test/round/round.js @@ -1,2 +1,3 @@ const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`); + module.exports = round; \ No newline at end of file diff --git a/test/runAsync/runAsync.js b/test/runAsync/runAsync.js index e049e49f0..416eb2607 100644 --- a/test/runAsync/runAsync.js +++ b/test/runAsync/runAsync.js @@ -1,16 +1,17 @@ const runAsync = fn => { -const worker = new Worker( -URL.createObjectURL(new Blob([`postMessage((${fn})());`]), { -type: 'application/javascript; charset=utf-8' -}) -); -return new Promise((res, rej) => { -worker.onmessage = ({ data }) => { -res(data), worker.terminate(); -}; -worker.onerror = err => { -rej(err), worker.terminate(); -}; -}); + const worker = new Worker( + URL.createObjectURL(new Blob([`postMessage((${fn})());`]), { + type: 'application/javascript; charset=utf-8' + }) + ); + return new Promise((res, rej) => { + worker.onmessage = ({ data }) => { + res(data), worker.terminate(); + }; + worker.onerror = err => { + rej(err), worker.terminate(); + }; + }); }; + module.exports = runAsync; \ No newline at end of file diff --git a/test/runPromisesInSeries/runPromisesInSeries.js b/test/runPromisesInSeries/runPromisesInSeries.js index 20184876f..e50743f65 100644 --- a/test/runPromisesInSeries/runPromisesInSeries.js +++ b/test/runPromisesInSeries/runPromisesInSeries.js @@ -1,2 +1,3 @@ const runPromisesInSeries = ps => ps.reduce((p, next) => p.then(next), Promise.resolve()); + module.exports = runPromisesInSeries; \ No newline at end of file diff --git a/test/sample/sample.js b/test/sample/sample.js index 1bf8aa450..68521d9cc 100644 --- a/test/sample/sample.js +++ b/test/sample/sample.js @@ -1,2 +1,3 @@ const sample = arr => arr[Math.floor(Math.random() * arr.length)]; + module.exports = sample; \ No newline at end of file diff --git a/test/sampleSize/sampleSize.js b/test/sampleSize/sampleSize.js index 3696ccf5d..9102c1550 100644 --- a/test/sampleSize/sampleSize.js +++ b/test/sampleSize/sampleSize.js @@ -1,9 +1,10 @@ const sampleSize = ([...arr], n = 1) => { -let m = arr.length; -while (m) { -const i = Math.floor(Math.random() * m--); -[arr[m], arr[i]] = [arr[i], arr[m]]; -} -return arr.slice(0, n); + let m = arr.length; + while (m) { + const i = Math.floor(Math.random() * m--); + [arr[m], arr[i]] = [arr[i], arr[m]]; + } + return arr.slice(0, n); }; + module.exports = sampleSize; \ No newline at end of file diff --git a/test/scrollToTop/scrollToTop.js b/test/scrollToTop/scrollToTop.js index 50eac27e7..83397206d 100644 --- a/test/scrollToTop/scrollToTop.js +++ b/test/scrollToTop/scrollToTop.js @@ -1,8 +1,9 @@ const scrollToTop = () => { -const c = document.documentElement.scrollTop || document.body.scrollTop; -if (c > 0) { -window.requestAnimationFrame(scrollToTop); -window.scrollTo(0, c - c / 8); -} + const c = document.documentElement.scrollTop || document.body.scrollTop; + if (c > 0) { + window.requestAnimationFrame(scrollToTop); + window.scrollTo(0, c - c / 8); + } }; + module.exports = scrollToTop; \ No newline at end of file diff --git a/test/sdbm/sdbm.js b/test/sdbm/sdbm.js index 97eb568ec..34d3848f3 100644 --- a/test/sdbm/sdbm.js +++ b/test/sdbm/sdbm.js @@ -1,9 +1,10 @@ const sdbm = str => { -let arr = str.split(''); -return arr.reduce( -(hashCode, currentVal) => -(hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode), -0 -); + let arr = str.split(''); + return arr.reduce( + (hashCode, currentVal) => + (hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode), + 0 + ); }; + module.exports = sdbm; \ No newline at end of file diff --git a/test/serializeCookie/serializeCookie.js b/test/serializeCookie/serializeCookie.js index b440d8e57..222c495af 100644 --- a/test/serializeCookie/serializeCookie.js +++ b/test/serializeCookie/serializeCookie.js @@ -1,2 +1,3 @@ const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`; + module.exports = serializeCookie; \ No newline at end of file diff --git a/test/setStyle/setStyle.js b/test/setStyle/setStyle.js index 1c6e61f53..4540bdd7b 100644 --- a/test/setStyle/setStyle.js +++ b/test/setStyle/setStyle.js @@ -1,2 +1,3 @@ const setStyle = (el, ruleName, val) => (el.style[ruleName] = val); + module.exports = setStyle; \ No newline at end of file diff --git a/test/shallowClone/shallowClone.js b/test/shallowClone/shallowClone.js index 71313e168..42319567b 100644 --- a/test/shallowClone/shallowClone.js +++ b/test/shallowClone/shallowClone.js @@ -1,2 +1,3 @@ const shallowClone = obj => Object.assign({}, obj); + module.exports = shallowClone; \ No newline at end of file diff --git a/test/show/show.js b/test/show/show.js index 1b4cd9632..41e3db299 100644 --- a/test/show/show.js +++ b/test/show/show.js @@ -1,2 +1,3 @@ const show = (...el) => [...el].forEach(e => (e.style.display = '')); + module.exports = show; \ No newline at end of file diff --git a/test/shuffle/shuffle.js b/test/shuffle/shuffle.js index 2c0c103e5..9cf8fee90 100644 --- a/test/shuffle/shuffle.js +++ b/test/shuffle/shuffle.js @@ -1,9 +1,10 @@ const shuffle = ([...arr]) => { -let m = arr.length; -while (m) { -const i = Math.floor(Math.random() * m--); -[arr[m], arr[i]] = [arr[i], arr[m]]; -} -return arr; + let m = arr.length; + while (m) { + const i = Math.floor(Math.random() * m--); + [arr[m], arr[i]] = [arr[i], arr[m]]; + } + return arr; }; + module.exports = shuffle; \ No newline at end of file diff --git a/test/similarity/similarity.js b/test/similarity/similarity.js index c3c853a61..9d7ac3a8d 100644 --- a/test/similarity/similarity.js +++ b/test/similarity/similarity.js @@ -1,2 +1,3 @@ const similarity = (arr, values) => arr.filter(v => values.includes(v)); + module.exports = similarity; \ No newline at end of file diff --git a/test/size/size.js b/test/size/size.js index 41e61cd2c..c09552595 100644 --- a/test/size/size.js +++ b/test/size/size.js @@ -1,9 +1,10 @@ const size = val => -Array.isArray(val) -? val.length -: val && typeof val === 'object' -? val.size || val.length || Object.keys(val).length -: typeof val === 'string' -? new Blob([val]).size -: 0; + Array.isArray(val) + ? val.length + : 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 diff --git a/test/sleep/sleep.js b/test/sleep/sleep.js index 42f6a0e0a..3d27d609f 100644 --- a/test/sleep/sleep.js +++ b/test/sleep/sleep.js @@ -1,2 +1,3 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); + module.exports = sleep; \ No newline at end of file diff --git a/test/smoothScroll/smoothScroll.js b/test/smoothScroll/smoothScroll.js index 6d4ff2a1c..ed53db3eb 100644 --- a/test/smoothScroll/smoothScroll.js +++ b/test/smoothScroll/smoothScroll.js @@ -1,5 +1,6 @@ const smoothScroll = element => -document.querySelector(element).scrollIntoView({ -behavior: 'smooth' -}); + document.querySelector(element).scrollIntoView({ + behavior: 'smooth' + }); + module.exports = smoothScroll; \ No newline at end of file diff --git a/test/solveRPN/solveRPN.js b/test/solveRPN/solveRPN.js index ac84c4a3d..79cfac2f2 100644 --- a/test/solveRPN/solveRPN.js +++ b/test/solveRPN/solveRPN.js @@ -1,29 +1,30 @@ const solveRPN = rpn => { -const OPERATORS = { -'*': (a, b) => a * b, -'+': (a, b) => a + b, -'-': (a, b) => a - b, -'/': (a, b) => a / b, -'**': (a, b) => a ** b -}; -const [stack, solve] = [ -[], -rpn -.replace(/\^/g, '**') -.split(/\s+/g) -.filter(el => !/\s+/.test(el) && el !== '') -]; -solve.forEach(symbol => { -if (!isNaN(parseFloat(symbol)) && isFinite(symbol)) { -stack.push(symbol); -} else if (Object.keys(OPERATORS).includes(symbol)) { -const [a, b] = [stack.pop(), stack.pop()]; -stack.push(OPERATORS[symbol](parseFloat(b), parseFloat(a))); -} else { -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`; + const OPERATORS = { + '*': (a, b) => a * b, + '+': (a, b) => a + b, + '-': (a, b) => a - b, + '/': (a, b) => a / b, + '**': (a, b) => a ** b + }; + const [stack, solve] = [ + [], + rpn + .replace(/\^/g, '**') + .split(/\s+/g) + .filter(el => !/\s+/.test(el) && el !== '') + ]; + solve.forEach(symbol => { + if (!isNaN(parseFloat(symbol)) && isFinite(symbol)) { + stack.push(symbol); + } else if (Object.keys(OPERATORS).includes(symbol)) { + const [a, b] = [stack.pop(), stack.pop()]; + stack.push(OPERATORS[symbol](parseFloat(b), parseFloat(a))); + } else { + 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 diff --git a/test/sortCharactersInString/sortCharactersInString.js b/test/sortCharactersInString/sortCharactersInString.js index f22f27613..4089fc27d 100644 --- a/test/sortCharactersInString/sortCharactersInString.js +++ b/test/sortCharactersInString/sortCharactersInString.js @@ -1,2 +1,3 @@ const sortCharactersInString = str => [...str].sort((a, b) => a.localeCompare(b)).join(''); + module.exports = sortCharactersInString; \ No newline at end of file diff --git a/test/sortedIndex/sortedIndex.js b/test/sortedIndex/sortedIndex.js index 7d6f7fcdd..ec0084c8e 100644 --- a/test/sortedIndex/sortedIndex.js +++ b/test/sortedIndex/sortedIndex.js @@ -1,6 +1,7 @@ const sortedIndex = (arr, n) => { -const isDescending = arr[0] > arr[arr.length - 1]; -const index = arr.findIndex(el => (isDescending ? n >= el : n <= el)); -return index === -1 ? arr.length : index; + 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 diff --git a/test/sortedIndexBy/sortedIndexBy.js b/test/sortedIndexBy/sortedIndexBy.js index 7602c8bca..0968ac2f6 100644 --- a/test/sortedIndexBy/sortedIndexBy.js +++ b/test/sortedIndexBy/sortedIndexBy.js @@ -1,7 +1,8 @@ const sortedIndexBy = (arr, n, fn) => { -const isDescending = fn(arr[0]) > fn(arr[arr.length - 1]); -const val = fn(n); -const index = arr.findIndex(el => (isDescending ? val >= fn(el) : val <= fn(el))); -return index === -1 ? arr.length : index; + const isDescending = fn(arr[0]) > fn(arr[arr.length - 1]); + const val = fn(n); + const index = arr.findIndex(el => (isDescending ? val >= fn(el) : val <= fn(el))); + return index === -1 ? arr.length : index; }; + module.exports = sortedIndexBy; \ No newline at end of file diff --git a/test/sortedLastIndex/sortedLastIndex.js b/test/sortedLastIndex/sortedLastIndex.js index b883fee5f..f81b4462e 100644 --- a/test/sortedLastIndex/sortedLastIndex.js +++ b/test/sortedLastIndex/sortedLastIndex.js @@ -1,6 +1,7 @@ const sortedLastIndex = (arr, n) => { -const isDescending = arr[0] > arr[arr.length - 1]; -const index = arr.reverse().findIndex(el => (isDescending ? n <= el : n >= el)); -return index === -1 ? 0 : arr.length - index; + const isDescending = arr[0] > arr[arr.length - 1]; + const index = arr.reverse().findIndex(el => (isDescending ? n <= el : n >= el)); + return index === -1 ? 0 : arr.length - index; }; + module.exports = sortedLastIndex; \ No newline at end of file diff --git a/test/sortedLastIndexBy/sortedLastIndexBy.js b/test/sortedLastIndexBy/sortedLastIndexBy.js index c1a88ece2..621316ce1 100644 --- a/test/sortedLastIndexBy/sortedLastIndexBy.js +++ b/test/sortedLastIndexBy/sortedLastIndexBy.js @@ -1,10 +1,11 @@ const sortedLastIndexBy = (arr, n, fn) => { -const isDescending = fn(arr[0]) > fn(arr[arr.length - 1]); -const val = fn(n); -const index = arr -.map(fn) -.reverse() -.findIndex(el => (isDescending ? val <= el : val >= el)); -return index === -1 ? 0 : arr.length - index; + const isDescending = fn(arr[0]) > fn(arr[arr.length - 1]); + const val = fn(n); + const index = arr + .map(fn) + .reverse() + .findIndex(el => (isDescending ? val <= el : val >= el)); + return index === -1 ? 0 : arr.length - index; }; + module.exports = sortedLastIndexBy; \ No newline at end of file diff --git a/test/speechSynthesis/speechSynthesis.js b/test/speechSynthesis/speechSynthesis.js index a194b30fe..f526ebe49 100644 --- a/test/speechSynthesis/speechSynthesis.js +++ b/test/speechSynthesis/speechSynthesis.js @@ -1,6 +1,7 @@ const speechSynthesis = message => { -const msg = new SpeechSynthesisUtterance(message); -msg.voice = window.speechSynthesis.getVoices()[0]; -window.speechSynthesis.speak(msg); + const msg = new SpeechSynthesisUtterance(message); + msg.voice = window.speechSynthesis.getVoices()[0]; + window.speechSynthesis.speak(msg); }; + module.exports = speechSynthesis; \ No newline at end of file diff --git a/test/splitLines/splitLines.js b/test/splitLines/splitLines.js index 8a10116b9..ccd68a942 100644 --- a/test/splitLines/splitLines.js +++ b/test/splitLines/splitLines.js @@ -1,2 +1,3 @@ const splitLines = str => str.split(/\r?\n/); + module.exports = splitLines; \ No newline at end of file diff --git a/test/spreadOver/spreadOver.js b/test/spreadOver/spreadOver.js index 2a5ca63dd..fd2fc9b0d 100644 --- a/test/spreadOver/spreadOver.js +++ b/test/spreadOver/spreadOver.js @@ -1,2 +1,3 @@ const spreadOver = fn => argsArr => fn(...argsArr); + module.exports = spreadOver; \ No newline at end of file diff --git a/test/stableSort/stableSort.js b/test/stableSort/stableSort.js index 452d6b726..e1549a63f 100644 --- a/test/stableSort/stableSort.js +++ b/test/stableSort/stableSort.js @@ -1,6 +1,7 @@ const stableSort = (arr, compare) => -arr -.map((item, index) => ({ item, index })) -.sort((a, b) => compare(a.item, b.item) || a.index - b.index) -.map(({ item }) => item); + arr + .map((item, index) => ({ item, index })) + .sort((a, b) => compare(a.item, b.item) || a.index - b.index) + .map(({ item }) => item); + module.exports = stableSort; \ No newline at end of file diff --git a/test/standardDeviation/standardDeviation.js b/test/standardDeviation/standardDeviation.js index fa74f2ad1..147600352 100644 --- a/test/standardDeviation/standardDeviation.js +++ b/test/standardDeviation/standardDeviation.js @@ -1,8 +1,9 @@ const standardDeviation = (arr, usePopulation = false) => { -const mean = arr.reduce((acc, val) => acc + val, 0) / arr.length; -return Math.sqrt( -arr.reduce((acc, val) => acc.concat((val - mean) ** 2), []).reduce((acc, val) => acc + val, 0) / -(arr.length - (usePopulation ? 0 : 1)) -); + const mean = arr.reduce((acc, val) => acc + val, 0) / arr.length; + return Math.sqrt( + arr.reduce((acc, val) => acc.concat((val - mean) ** 2), []).reduce((acc, val) => acc + val, 0) / + (arr.length - (usePopulation ? 0 : 1)) + ); }; + module.exports = standardDeviation; \ No newline at end of file diff --git a/test/stringPermutations/stringPermutations.js b/test/stringPermutations/stringPermutations.js index 47bb27da4..b8b3b318f 100644 --- a/test/stringPermutations/stringPermutations.js +++ b/test/stringPermutations/stringPermutations.js @@ -1,11 +1,12 @@ const stringPermutations = str => { -if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str]; -return str -.split('') -.reduce( -(acc, letter, i) => -acc.concat(stringPermutations(str.slice(0, i) + str.slice(i + 1)).map(val => letter + val)), -[] -); + if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str]; + return str + .split('') + .reduce( + (acc, letter, i) => + acc.concat(stringPermutations(str.slice(0, i) + str.slice(i + 1)).map(val => letter + val)), + [] + ); }; + module.exports = stringPermutations; \ No newline at end of file diff --git a/test/stripHTMLTags/stripHTMLTags.js b/test/stripHTMLTags/stripHTMLTags.js index 3ecfe2fbd..fc2b30989 100644 --- a/test/stripHTMLTags/stripHTMLTags.js +++ b/test/stripHTMLTags/stripHTMLTags.js @@ -1,2 +1,3 @@ const stripHTMLTags = str => str.replace(/<[^>]*>/g, ''); + module.exports = stripHTMLTags; \ No newline at end of file diff --git a/test/sum/sum.js b/test/sum/sum.js index 84bbe72a9..aad90f0fa 100644 --- a/test/sum/sum.js +++ b/test/sum/sum.js @@ -1,2 +1,3 @@ const sum = (...arr) => [...arr].reduce((acc, val) => acc + val, 0); + module.exports = sum; \ No newline at end of file diff --git a/test/sumBy/sumBy.js b/test/sumBy/sumBy.js index cf5253440..7d0ec9c8d 100644 --- a/test/sumBy/sumBy.js +++ b/test/sumBy/sumBy.js @@ -1,3 +1,4 @@ const sumBy = (arr, fn) => -arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0); + arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0); + module.exports = sumBy; \ No newline at end of file diff --git a/test/sumPower/sumPower.js b/test/sumPower/sumPower.js index 5b1ddbfd0..d341bc8ef 100644 --- a/test/sumPower/sumPower.js +++ b/test/sumPower/sumPower.js @@ -1,6 +1,7 @@ const sumPower = (end, power = 2, start = 1) => -Array(end + 1 - start) -.fill(0) -.map((x, i) => (i + start) ** power) -.reduce((a, b) => a + b, 0); + 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 diff --git a/test/symmetricDifference/symmetricDifference.js b/test/symmetricDifference/symmetricDifference.js index bbef282e2..8a83c1de0 100644 --- a/test/symmetricDifference/symmetricDifference.js +++ b/test/symmetricDifference/symmetricDifference.js @@ -1,6 +1,7 @@ const symmetricDifference = (a, b) => { -const sA = new Set(a), -sB = new Set(b); -return [...a.filter(x => !sB.has(x)), ...b.filter(x => !sA.has(x))]; + 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 diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.js index bd3c406e1..beecb9f6f 100644 --- a/test/symmetricDifferenceBy/symmetricDifferenceBy.js +++ b/test/symmetricDifferenceBy/symmetricDifferenceBy.js @@ -1,6 +1,7 @@ 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)))]; + 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/symmetricDifferenceWith/symmetricDifferenceWith.js b/test/symmetricDifferenceWith/symmetricDifferenceWith.js index 13a12660b..4a4b3d22d 100644 --- a/test/symmetricDifferenceWith/symmetricDifferenceWith.js +++ b/test/symmetricDifferenceWith/symmetricDifferenceWith.js @@ -1,5 +1,6 @@ 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) + ...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/tail/tail.js b/test/tail/tail.js index 98b888534..8c39e7f86 100644 --- a/test/tail/tail.js +++ b/test/tail/tail.js @@ -1,2 +1,3 @@ const tail = arr => (arr.length > 1 ? arr.slice(1) : arr); + module.exports = tail; \ No newline at end of file diff --git a/test/take/take.js b/test/take/take.js index 056163326..4d7d970ea 100644 --- a/test/take/take.js +++ b/test/take/take.js @@ -1,2 +1,3 @@ const take = (arr, n = 1) => arr.slice(0, n); + module.exports = take; \ No newline at end of file diff --git a/test/takeRight/takeRight.js b/test/takeRight/takeRight.js index b87e28e2c..bb1e28d7c 100644 --- a/test/takeRight/takeRight.js +++ b/test/takeRight/takeRight.js @@ -1,2 +1,3 @@ const takeRight = (arr, n = 1) => arr.slice(arr.length - n, arr.length); + module.exports = takeRight; \ No newline at end of file diff --git a/test/takeRightWhile/takeRightWhile.js b/test/takeRightWhile/takeRightWhile.js index d5ae4dcdc..62e89d401 100644 --- a/test/takeRightWhile/takeRightWhile.js +++ b/test/takeRightWhile/takeRightWhile.js @@ -1,6 +1,7 @@ const takeRightWhile = (arr, func) => { -for (let i of arr.reverse().keys()) -if (func(arr[i])) return arr.reverse().slice(arr.length - i, arr.length); -return arr; + for (let i of arr.reverse().keys()) + if (func(arr[i])) return arr.reverse().slice(arr.length - i, arr.length); + return arr; }; + module.exports = takeRightWhile; \ No newline at end of file diff --git a/test/takeWhile/takeWhile.js b/test/takeWhile/takeWhile.js index 79c3d432e..ed19bd0e1 100644 --- a/test/takeWhile/takeWhile.js +++ b/test/takeWhile/takeWhile.js @@ -1,5 +1,6 @@ const takeWhile = (arr, func) => { -for (const [i, val] of arr.entries()) if (func(val)) return arr.slice(0, i); -return arr; + for (const [i, val] of arr.entries()) if (func(val)) return arr.slice(0, i); + return arr; }; + module.exports = takeWhile; \ No newline at end of file diff --git a/test/testlog b/test/testlog index 5fd54fd4c..8b0e685f8 100644 --- a/test/testlog +++ b/test/testlog @@ -3,305 +3,305 @@ # Starting... # 344 test suites found. -# PASS test/toKebabCase/toKebabCase.test.js +# PASS test\toSnakeCase\toSnakeCase.test.js -ok 1 — toKebabCase is a Function -ok 2 — toKebabCase('camelCase') returns camel-case -ok 3 — toKebabCase('some text') returns some-text -ok 4 — toKebabCase('some-mixed-string With spaces-underscores-and-hyphens') returns some-mixed-string-with-spaces-underscores-and-hyphens -ok 5 — toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html -ok 6 — toKebabCase() returns undefined -ok 7 — toKebabCase([]) throws an erro -ok 8 — toKebabCase({}) throws an erro -ok 9 — toKebabCase(123) throws an erro -ok 10 — toKebabCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run +ok 1 — toSnakeCase is a Function +ok 2 — toSnakeCase('camelCase') returns camel_case +ok 3 — toSnakeCase('some text') returns some_text +ok 4 — toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens') returns some_mixed_string_with_spaces_underscores_and_hyphens +ok 5 — toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html +ok 6 — toSnakeCase() returns undefined +ok 7 — toSnakeCase([]) throws an error +ok 8 — toSnakeCase({}) throws an error +ok 9 — toSnakeCase(123) throws an error +ok 10 — toSnakeCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run -# PASS test/toCamelCase/toCamelCase.test.js +# PASS test\toKebabCase\toKebabCase.test.js -ok 11 — toCamelCase is a Function -ok 12 — toCamelCase('some_database_field_name') returns someDatabaseFieldName -ok 13 — toCamelCase('Some label that needs to be camelized') returns someLabelThatNeedsToBeCamelized -ok 14 — toCamelCase('some-javascript-property') return someJavascriptProperty -ok 15 — toCamelCase('some-mixed_string with spaces_underscores-and-hyphens') returns someMixedStringWithSpacesUnderscoresAndHyphens -ok 16 — toCamelCase() throws a error -ok 17 — toCamelCase([]) throws a error -ok 18 — toCamelCase({}) throws a error -ok 19 — toCamelCase(123) throws a error -ok 20 — toCamelCase(some-mixed_string with spaces_underscores-and-hyphens) takes less than 2s to run +ok 11 — toKebabCase is a Function +ok 12 — toKebabCase('camelCase') returns camel-case +ok 13 — toKebabCase('some text') returns some-text +ok 14 — toKebabCase('some-mixed-string With spaces-underscores-and-hyphens') returns some-mixed-string-with-spaces-underscores-and-hyphens +ok 15 — toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html +ok 16 — toKebabCase() returns undefined +ok 17 — toKebabCase([]) throws an erro +ok 18 — toKebabCase({}) throws an erro +ok 19 — toKebabCase(123) throws an erro +ok 20 — toKebabCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run -# PASS test/validateNumber/validateNumber.test.js +# PASS test\uniqueElements\uniqueElements.test.js -ok 21 — validateNumber is a Function -ok 22 — validateNumber(9) returns true -ok 23 — validateNumber(234asd.slice(0, 2)) returns true -ok 24 — validateNumber(1232) returns true -ok 25 — validateNumber(1232 + 13423) returns true -ok 26 — validateNumber(1232 * 2342 * 123) returns true -ok 27 — validateNumber(1232.23423536) returns true -ok 28 — validateNumber(234asd) returns false -ok 29 — validateNumber(e234d) returns false -ok 30 — validateNumber(false) returns false -ok 31 — validateNumber(true) returns false -ok 32 — validateNumber(null) returns false -ok 33 — validateNumber(123 * asd) returns false +ok 21 — uniqueElements is a Function +ok 22 — uniqueElements([1, 2, 2, 3, 4, 4, 5]) returns [1,2,3,4,5] +ok 23 — uniqueElements([1, 23, 53]) returns [1, 23, 53] +ok 24 — uniqueElements([true, 0, 1, false, false, undefined, null, '']) returns [true, 0, 1, false, false, undefined, null, ''] +ok 25 — uniqueElements() returns [] +ok 26 — uniqueElements(null) returns [] +ok 27 — uniqueElements(undefined) returns [] +ok 28 — uniqueElements('strt') returns ['s', 't', 'r'] +ok 29 — uniqueElements(1, 1, 2543, 534, 5) throws an error +ok 30 — uniqueElements({}) throws an error +ok 31 — uniqueElements(true) throws an error +ok 32 — uniqueElements(false) throws an error +ok 33 — uniqueElements([true, 0, 1, false, false, undefined, null]) takes less than 2s to run -# PASS test/average/average.test.js +# PASS test\toCamelCase\toCamelCase.test.js -ok 34 — average is a Function -ok 35 — average(true) returns 0 -ok 36 — average(false) returns 1 -ok 37 — average(9, 1) returns 5 -ok 38 — average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 -ok 39 — average(1, 2, 3) returns 2 -ok 40 — average(null) returns 0 -ok 41 — average(1, 2, 3) returns NaN -ok 42 — average(String) returns NaN -ok 43 — average({ a: 123}) returns NaN -ok 44 — average([undefined, 0, string]) returns NaN -ok 45 — average([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run +ok 34 — toCamelCase is a Function +ok 35 — toCamelCase('some_database_field_name') returns someDatabaseFieldName +ok 36 — toCamelCase('Some label that needs to be camelized') returns someLabelThatNeedsToBeCamelized +ok 37 — toCamelCase('some-javascript-property') return someJavascriptProperty +ok 38 — toCamelCase('some-mixed_string with spaces_underscores-and-hyphens') returns someMixedStringWithSpacesUnderscoresAndHyphens +ok 39 — toCamelCase() throws a error +ok 40 — toCamelCase([]) throws a error +ok 41 — toCamelCase({}) throws a error +ok 42 — toCamelCase(123) throws a error +ok 43 — toCamelCase(some-mixed_string with spaces_underscores-and-hyphens) takes less than 2s to run -# PASS test/toSnakeCase/toSnakeCase.test.js +# PASS test\is\is.test.js -ok 46 — toSnakeCase is a Function -ok 47 — toSnakeCase('camelCase') returns camel_case -ok 48 — toSnakeCase('some text') returns some_text -ok 49 — toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens') returns some_mixed_string_with_spaces_underscores_and_hyphens -ok 50 — toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html -ok 51 — toSnakeCase() returns undefined -ok 52 — toSnakeCase([]) throws an error -ok 53 — toSnakeCase({}) throws an error -ok 54 — toSnakeCase(123) throws an error -ok 55 — toSnakeCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run +ok 44 — is is a Function +ok 45 — Works for arrays with data +ok 46 — Works for empty arrays +ok 47 — Works for arrays, not objects +ok 48 — Works for objects +ok 49 — Works for maps +ok 50 — Works for regular expressions +ok 51 — Works for sets +ok 52 — Works for weak maps +ok 53 — Works for weak sets +ok 54 — Works for strings - returns true for primitive +ok 55 — Works for strings - returns true when using constructor +ok 56 — Works for numbers - returns true for primitive +ok 57 — Works for numbers - returns true when using constructor +ok 58 — Works for booleans - returns true for primitive +ok 59 — Works for booleans - returns true when using constructor +ok 60 — Works for functions -# PASS test/zipObject/zipObject.test.js +# PASS test\average\average.test.js -ok 56 — zipObject is a Function -ok 57 — zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined} -ok 58 — zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2} -ok 59 — zipObject([a, b, c], string) returns { a: s, b: t, c: r } -ok 60 — zipObject([a], string) returns { a: s } -ok 61 — zipObject() throws an error -ok 62 — zipObject((['string'], null) throws an error -ok 63 — zipObject(null, [1]) throws an error -ok 64 — zipObject('string') throws an error -ok 65 — zipObject('test', 'string') throws an error +ok 61 — average is a Function +ok 62 — average(true) returns 0 +ok 63 — average(false) returns 1 +ok 64 — average(9, 1) returns 5 +ok 65 — average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 +ok 66 — average(1, 2, 3) returns 2 +ok 67 — average(null) returns 0 +ok 68 — average(1, 2, 3) returns NaN +ok 69 — average(String) returns NaN +ok 70 — average({ a: 123}) returns NaN +ok 71 — average([undefined, 0, string]) returns NaN +ok 72 — average([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run -# PASS test/uniqueElements/uniqueElements.test.js +# PASS test\validateNumber\validateNumber.test.js -ok 66 — uniqueElements is a Function -ok 67 — uniqueElements([1, 2, 2, 3, 4, 4, 5]) returns [1,2,3,4,5] -ok 68 — uniqueElements([1, 23, 53]) returns [1, 23, 53] -ok 69 — uniqueElements([true, 0, 1, false, false, undefined, null, '']) returns [true, 0, 1, false, false, undefined, null, ''] -ok 70 — uniqueElements() returns [] -ok 71 — uniqueElements(null) returns [] -ok 72 — uniqueElements(undefined) returns [] -ok 73 — uniqueElements('strt') returns ['s', 't', 'r'] -ok 74 — uniqueElements(1, 1, 2543, 534, 5) throws an error -ok 75 — uniqueElements({}) throws an error -ok 76 — uniqueElements(true) throws an error -ok 77 — uniqueElements(false) throws an error -ok 78 — uniqueElements([true, 0, 1, false, false, undefined, null]) takes less than 2s to run +ok 73 — validateNumber is a Function +ok 74 — validateNumber(9) returns true +ok 75 — validateNumber(234asd.slice(0, 2)) returns true +ok 76 — validateNumber(1232) returns true +ok 77 — validateNumber(1232 + 13423) returns true +ok 78 — validateNumber(1232 * 2342 * 123) returns true +ok 79 — validateNumber(1232.23423536) returns true +ok 80 — validateNumber(234asd) returns false +ok 81 — validateNumber(e234d) returns false +ok 82 — validateNumber(false) returns false +ok 83 — validateNumber(true) returns false +ok 84 — validateNumber(null) returns false +ok 85 — validateNumber(123 * asd) returns false -# PASS test/words/words.test.js +# PASS test\toSafeInteger\toSafeInteger.test.js -ok 79 — words is a Function -ok 80 — words('I love javaScript!!') returns [I, love, javaScript] -ok 81 — words('python, javaScript & coffee') returns [python, javaScript, coffee] -ok 82 — words(I love javaScript!!) returns an array -ok 83 — words() throws an error -ok 84 — words(null) throws an error -ok 85 — words(undefined) throws an error -ok 86 — words({}) throws an error -ok 87 — words([]) throws an error -ok 88 — words(1234) throws an error +ok 86 — toSafeInteger is a Function +ok 87 — Number(toSafeInteger(3.2)) is a number +ok 88 — Converts a value to a safe integer +ok 89 — toSafeInteger('4.2') returns 4 +ok 90 — toSafeInteger(4.6) returns 5 +ok 91 — toSafeInteger([]) returns 0 +ok 92 — isNaN(toSafeInteger([1.5, 3124])) is true +ok 93 — isNaN(toSafeInteger('string')) is true +ok 94 — isNaN(toSafeInteger({})) is true +ok 95 — isNaN(toSafeInteger()) is true +ok 96 — toSafeInteger(Infinity) returns 9007199254740991 +ok 97 — toSafeInteger(3.2) takes less than 2s to run -# PASS test/isPrimitive/isPrimitive.test.js +# PASS test\union\union.test.js -ok 89 — isPrimitive is a Function -ok 90 — isPrimitive(null) is primitive -ok 91 — isPrimitive(undefined) is primitive -ok 92 — isPrimitive(string) is primitive -ok 93 — isPrimitive(true) is primitive -ok 94 — isPrimitive(50) is primitive -ok 95 — isPrimitive('Hello') is primitive -ok 96 — isPrimitive(false) is primitive -ok 97 — isPrimitive(Symbol()) is primitive -ok 98 — isPrimitive([1, 2, 3]) is not primitive -ok 99 — isPrimitive({ a: 123 }) is not primitive -ok 100 — isPrimitive({ a: 123 }) takes less than 2s to run +ok 98 — union is a Function +ok 99 — union([1, 2, 3], [4, 3, 2]) returns [1, 2, 3, 4] +ok 100 — union('str', 'asd') returns [ 's', 't', 'r', 'a', 'd' ] +ok 101 — union([[], {}], [1, 2, 3]) returns [[], {}, 1, 2, 3] +ok 102 — union([], []) returns [] +ok 103 — union() throws an error +ok 104 — union(true, 'str') throws an error +ok 105 — union('false', true) throws an error +ok 106 — union((123, {}) throws an error +ok 107 — union([], {}) throws an error +ok 108 — union(undefined, null) throws an error +ok 109 — union([1, 2, 3], [4, 3, 2]) takes less than 2s to run -# PASS test/without/without.test.js +# PASS test\isPrimitive\isPrimitive.test.js -ok 101 — without is a Function -ok 102 — without([2, 1, 2, 3], 1, 2) returns [3] -ok 103 — without([]) returns [] -ok 104 — without([3, 1, true, '3', true], '3', true) returns [3, 1] -ok 105 — without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n'] -ok 106 — without() throws an error -ok 107 — without(null) throws an error -ok 108 — without(undefined) throws an error -ok 109 — without(123) throws an error -ok 110 — without({}) throws an error +ok 110 — isPrimitive is a Function +ok 111 — isPrimitive(null) is primitive +ok 112 — isPrimitive(undefined) is primitive +ok 113 — isPrimitive(string) is primitive +ok 114 — isPrimitive(true) is primitive +ok 115 — isPrimitive(50) is primitive +ok 116 — isPrimitive('Hello') is primitive +ok 117 — isPrimitive(false) is primitive +ok 118 — isPrimitive(Symbol()) is primitive +ok 119 — isPrimitive([1, 2, 3]) is not primitive +ok 120 — isPrimitive({ a: 123 }) is not primitive +ok 121 — isPrimitive({ a: 123 }) takes less than 2s to run -# PASS test/yesNo/yesNo.test.js +# PASS test\zipObject\zipObject.test.js -ok 111 — yesNo is a Function -ok 112 — yesNo(Y) returns true -ok 113 — yesNo(yes) returns true -ok 114 — yesNo(foo, true) returns true -ok 115 — yesNo(No) returns false -ok 116 — yesNo() returns false -ok 117 — yesNo(null) returns false -ok 118 — yesNo(undefined) returns false -ok 119 — yesNo([123, null]) returns false -ok 120 — yesNo([Yes, No]) returns false -ok 121 — yesNo({ 2: Yes }) returns false -ok 122 — yesNo([Yes, No], true) returns true -ok 123 — yesNo({ 2: Yes }, true) returns true +ok 122 — zipObject is a Function +ok 123 — zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined} +ok 124 — zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2} +ok 125 — zipObject([a, b, c], string) returns { a: s, b: t, c: r } +ok 126 — zipObject([a], string) returns { a: s } +ok 127 — zipObject() throws an error +ok 128 — zipObject((['string'], null) throws an error +ok 129 — zipObject(null, [1]) throws an error +ok 130 — zipObject('string') throws an error +ok 131 — zipObject('test', 'string') throws an error -# PASS test/is/is.test.js +# PASS test\round\round.test.js -ok 124 — is is a Function -ok 125 — Works for arrays with data -ok 126 — Works for empty arrays -ok 127 — Works for arrays, not objects -ok 128 — Works for objects -ok 129 — Works for maps -ok 130 — Works for regular expressions -ok 131 — Works for sets -ok 132 — Works for weak maps -ok 133 — Works for weak sets -ok 134 — Works for strings - returns true for primitive -ok 135 — Works for strings - returns true when using constructor -ok 136 — Works for numbers - returns true for primitive -ok 137 — Works for numbers - returns true when using constructor -ok 138 — Works for booleans - returns true for primitive -ok 139 — Works for booleans - returns true when using constructor -ok 140 — Works for functions +ok 132 — round is a Function +ok 133 — round(1.005, 2) returns 1.01 +ok 134 — round(123.3423345345345345344, 11) returns 123.34233453453 +ok 135 — round(3.342, 11) returns 3.342 +ok 136 — round(1.005) returns 1 +ok 137 — round([1.005, 2]) returns NaN +ok 138 — round(string) returns NaN +ok 139 — round() returns NaN +ok 140 — round(132, 413, 4134) returns NaN +ok 141 — round({a: 132}, 413) returns NaN +ok 142 — round(123.3423345345345345344, 11) takes less than 2s to run -# PASS test/toSafeInteger/toSafeInteger.test.js +# PASS test\quickSort\quickSort.test.js -ok 141 — toSafeInteger is a Function -ok 142 — Number(toSafeInteger(3.2)) is a number -ok 143 — Converts a value to a safe integer -ok 144 — toSafeInteger('4.2') returns 4 -ok 145 — toSafeInteger(4.6) returns 5 -ok 146 — toSafeInteger([]) returns 0 -ok 147 — isNaN(toSafeInteger([1.5, 3124])) is true -ok 148 — isNaN(toSafeInteger('string')) is true -ok 149 — isNaN(toSafeInteger({})) is true -ok 150 — isNaN(toSafeInteger()) is true -ok 151 — toSafeInteger(Infinity) returns 9007199254740991 -ok 152 — toSafeInteger(3.2) takes less than 2s to run +ok 143 — quickSort is a Function +ok 144 — quickSort([5, 6, 4, 3, 1, 2]) returns [1, 2, 3, 4, 5, 6] +ok 145 — quickSort([-1, 0, -2]) returns [-2, -1, 0] +ok 146 — quickSort() throws an error +ok 147 — quickSort(123) throws an error +ok 148 — quickSort({ 234: string}) throws an error +ok 149 — quickSort(null) throws an error +ok 150 — quickSort(undefined) throws an error +ok 151 — quickSort([11, 1, 324, 23232, -1, 53, 2, 524, 32, 13, 156, 133, 62, 12, 4]) takes less than 2s to run -# PASS test/quickSort/quickSort.test.js +# PASS test\yesNo\yesNo.test.js -ok 153 — quickSort is a Function -ok 154 — quickSort([5, 6, 4, 3, 1, 2]) returns [1, 2, 3, 4, 5, 6] -ok 155 — quickSort([-1, 0, -2]) returns [-2, -1, 0] -ok 156 — quickSort() throws an error -ok 157 — quickSort(123) throws an error -ok 158 — quickSort({ 234: string}) throws an error -ok 159 — quickSort(null) throws an error -ok 160 — quickSort(undefined) throws an error -ok 161 — quickSort([11, 1, 324, 23232, -1, 53, 2, 524, 32, 13, 156, 133, 62, 12, 4]) takes less than 2s to run +ok 152 — yesNo is a Function +ok 153 — yesNo(Y) returns true +ok 154 — yesNo(yes) returns true +ok 155 — yesNo(foo, true) returns true +ok 156 — yesNo(No) returns false +ok 157 — yesNo() returns false +ok 158 — yesNo(null) returns false +ok 159 — yesNo(undefined) returns false +ok 160 — yesNo([123, null]) returns false +ok 161 — yesNo([Yes, No]) returns false +ok 162 — yesNo({ 2: Yes }) returns false +ok 163 — yesNo([Yes, No], true) returns true +ok 164 — yesNo({ 2: Yes }, true) returns true -# PASS test/isEmpty/isEmpty.test.js +# PASS test\isSorted\isSorted.test.js -ok 162 — isEmpty is a Function -ok 163 — Returns true for empty Map -ok 164 — Returns true for empty Set -ok 165 — Returns true for empty array -ok 166 — Returns true for empty object -ok 167 — Returns true for empty string -ok 168 — Returns false for non-empty array -ok 169 — Returns false for non-empty object -ok 170 — Returns false for non-empty string -ok 171 — Returns true - type is not considered a collection -ok 172 — Returns true - type is not considered a collection +ok 165 — isSorted is a Function +ok 166 — Array is sorted in ascending order +ok 167 — Array is sorted in ascending order +ok 168 — Array is sorted in ascending order +ok 169 — Array is sorted in ascending order +ok 170 — Array is sorted in descending order +ok 171 — Array is sorted in descending order +ok 172 — Array is sorted in descending order +ok 173 — Array is sorted in descending order +ok 174 — Array is empty +ok 175 — Array is not sorted, direction changed in array +ok 176 — Array is not sorted, direction changed in array -# PASS test/round/round.test.js +# PASS test\words\words.test.js -ok 173 — round is a Function -ok 174 — round(1.005, 2) returns 1.01 -ok 175 — round(123.3423345345345345344, 11) returns 123.34233453453 -ok 176 — round(3.342, 11) returns 3.342 -ok 177 — round(1.005) returns 1 -ok 178 — round([1.005, 2]) returns NaN -ok 179 — round(string) returns NaN -ok 180 — round() returns NaN -ok 181 — round(132, 413, 4134) returns NaN -ok 182 — round({a: 132}, 413) returns NaN -ok 183 — round(123.3423345345345345344, 11) takes less than 2s to run +ok 177 — words is a Function +ok 178 — words('I love javaScript!!') returns [I, love, javaScript] +ok 179 — words('python, javaScript & coffee') returns [python, javaScript, coffee] +ok 180 — words(I love javaScript!!) returns an array +ok 181 — words() throws an error +ok 182 — words(null) throws an error +ok 183 — words(undefined) throws an error +ok 184 — words({}) throws an error +ok 185 — words([]) throws an error +ok 186 — words(1234) throws an error -# PASS test/last/last.test.js +# PASS test\without\without.test.js -ok 184 — last is a Function -ok 185 — last({ a: 1234}) returns undefined -ok 186 — last([1, 2, 3]) returns 3 -ok 187 — last({ 0: false}) returns undefined -ok 188 — last(String) returns g -ok 189 — last(null) throws an Error -ok 190 — last(undefined) throws an Error -ok 191 — last() throws an Error -ok 192 — last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run +ok 187 — without is a Function +ok 188 — without([2, 1, 2, 3], 1, 2) returns [3] +ok 189 — without([]) returns [] +ok 190 — without([3, 1, true, '3', true], '3', true) returns [3, 1] +ok 191 — without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n'] +ok 192 — without() throws an error +ok 193 — without(null) throws an error +ok 194 — without(undefined) throws an error +ok 195 — without(123) throws an error +ok 196 — without({}) throws an error -# PASS test/zip/zip.test.js +# PASS test\chunk\chunk.test.js -ok 193 — zip is a Function -ok 194 — zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]] -ok 195 — zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]] -ok 196 — zip([]) returns [] -ok 197 — zip(123) returns [] -ok 198 — zip([a, b], [1, 2], [true, false]) returns an Array -ok 199 — zip([a], [1, 2], [true, false]) returns an Array -ok 200 — zip(null) throws an error -ok 201 — zip(undefined) throws an error +ok 197 — chunk is a Function +ok 198 — chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] +ok 199 — chunk([]) returns [] +ok 200 — chunk(123) returns [] +ok 201 — chunk({ a: 123}) returns [] +ok 202 — chunk(string, 2) returns [ st, ri, ng ] +ok 203 — chunk() throws an error +ok 204 — chunk(undefined) throws an error +ok 205 — chunk(null) throws an error +ok 206 — chunk(This is a string, 2) takes less than 2s to run -# PASS test/isSorted/isSorted.test.js +# PASS test\zip\zip.test.js -ok 202 — isSorted is a Function -ok 203 — Array is sorted in ascending order -ok 204 — Array is sorted in ascending order -ok 205 — Array is sorted in ascending order -ok 206 — Array is sorted in ascending order -ok 207 — Array is sorted in descending order -ok 208 — Array is sorted in descending order -ok 209 — Array is sorted in descending order -ok 210 — Array is sorted in descending order -ok 211 — Array is empty -ok 212 — Array is not sorted, direction changed in array -ok 213 — Array is not sorted, direction changed in array +ok 207 — zip is a Function +ok 208 — zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]] +ok 209 — zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]] +ok 210 — zip([]) returns [] +ok 211 — zip(123) returns [] +ok 212 — zip([a, b], [1, 2], [true, false]) returns an Array +ok 213 — zip([a], [1, 2], [true, false]) returns an Array +ok 214 — zip(null) throws an error +ok 215 — zip(undefined) throws an error -# PASS test/union/union.test.js +# PASS test\isEmpty\isEmpty.test.js -ok 214 — union is a Function -ok 215 — union([1, 2, 3], [4, 3, 2]) returns [1, 2, 3, 4] -ok 216 — union('str', 'asd') returns [ 's', 't', 'r', 'a', 'd' ] -ok 217 — union([[], {}], [1, 2, 3]) returns [[], {}, 1, 2, 3] -ok 218 — union([], []) returns [] -ok 219 — union() throws an error -ok 220 — union(true, 'str') throws an error -ok 221 — union('false', true) throws an error -ok 222 — union((123, {}) throws an error -ok 223 — union([], {}) throws an error -ok 224 — union(undefined, null) throws an error -ok 225 — union([1, 2, 3], [4, 3, 2]) takes less than 2s to run +ok 216 — isEmpty is a Function +ok 217 — Returns true for empty Map +ok 218 — Returns true for empty Set +ok 219 — Returns true for empty array +ok 220 — Returns true for empty object +ok 221 — Returns true for empty string +ok 222 — Returns false for non-empty array +ok 223 — Returns false for non-empty object +ok 224 — Returns false for non-empty string +ok 225 — Returns true - type is not considered a collection +ok 226 — Returns true - type is not considered a collection -# PASS test/chunk/chunk.test.js +# PASS test\last\last.test.js -ok 226 — chunk is a Function -ok 227 — chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] -ok 228 — chunk([]) returns [] -ok 229 — chunk(123) returns [] -ok 230 — chunk({ a: 123}) returns [] -ok 231 — chunk(string, 2) returns [ st, ri, ng ] -ok 232 — chunk() throws an error -ok 233 — chunk(undefined) throws an error -ok 234 — chunk(null) throws an error -ok 235 — chunk(This is a string, 2) takes less than 2s to run +ok 227 — last is a Function +ok 228 — last({ a: 1234}) returns undefined +ok 229 — last([1, 2, 3]) returns 3 +ok 230 — last({ 0: false}) returns undefined +ok 231 — last(String) returns g +ok 232 — last(null) throws an Error +ok 233 — last(undefined) throws an Error +ok 234 — last() throws an Error +ok 235 — last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run -# PASS test/head/head.test.js +# PASS test\head\head.test.js ok 236 — head is a Function ok 237 — head({ a: 1234}) returns undefined @@ -313,63 +313,63 @@ ok 242 — head(undefined) throws an Error ok 243 — head() throws an Error ok 244 — head([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run -# PASS test/uniqueElementsByRight/uniqueElementsByRight.test.js +# PASS test\uniqueElementsByRight\uniqueElementsByRight.test.js ok 245 — uniqueElementsByRight is a Function ok 246 — uniqueElementsByRight works for properties ok 247 — uniqueElementsByRight works for nested properties -# PASS test/uniqueElementsBy/uniqueElementsBy.test.js +# PASS test\uniqueElementsBy\uniqueElementsBy.test.js ok 248 — uniqueElementsBy is a Function ok 249 — uniqueElementsBy works for properties ok 250 — uniqueElementsBy works for nested properties -# PASS test/all/all.test.js +# PASS test\offset\offset.test.js -ok 251 — all is a Function -ok 252 — Returns true for arrays with no falsey values -ok 253 — Returns false for arrays with 0 -ok 254 — Returns false for arrays with NaN -ok 255 — Returns false for arrays with undefined -ok 256 — Returns false for arrays with null -ok 257 — Returns false for arrays with empty strings -ok 258 — Returns true with predicate function -ok 259 — Returns false with a predicate function +ok 251 — offset is a Function +ok 252 — Offset of 0 returns the same array. +ok 253 — Offset > 0 returns the offsetted array. +ok 254 — Offset < 0 returns the reverse offsetted array. +ok 255 — Offset greater than the length of the array returns the same array. +ok 256 — Offset less than the negative length of the array returns the same array. +ok 257 — Offsetting empty array returns an empty array. -# PASS test/offset/offset.test.js +# PASS test\all\all.test.js -ok 260 — offset is a Function -ok 261 — Offset of 0 returns the same array. -ok 262 — Offset > 0 returns the offsetted array. -ok 263 — Offset < 0 returns the reverse offsetted array. -ok 264 — Offset greater than the length of the array returns the same array. -ok 265 — Offset less than the negative length of the array returns the same array. -ok 266 — Offsetting empty array returns an empty array. +ok 258 — all is a Function +ok 259 — Returns true for arrays with no falsey values +ok 260 — Returns false for arrays with 0 +ok 261 — Returns false for arrays with NaN +ok 262 — Returns false for arrays with undefined +ok 263 — Returns false for arrays with null +ok 264 — Returns false for arrays with empty strings +ok 265 — Returns true with predicate function +ok 266 — Returns false with a predicate function -# PASS test/filterNonUniqueBy/filterNonUniqueBy.test.js +# PASS test\equals\equals.test.js -ok 267 — filterNonUniqueBy is a Function -ok 268 — filterNonUniqueBy works for properties -ok 269 — filterNonUniqueBy works for nested properties +ok 267 — equals is a Function +ok 268 — { a: [2, {e: 3}], b: [4], c: 'foo' } is equal to { a: [2, {e: 3}], b: [4], c: 'foo' } +ok 269 — [1,2,3] is equal to [1,2,3] +ok 270 — { a: [2, 3], b: [4] } is not equal to { a: [2, 3], b: [6] } +ok 271 — [1,2,3] is not equal to [1,2,4] +ok 272 — [1, 2, 3] should be equal to { 0: 1, 1: 2, 2: 3 }) - type is different, but their enumerable properties match. -# PASS test/sampleSize/sampleSize.test.js +# PASS test\filterNonUniqueBy\filterNonUniqueBy.test.js -ok 270 — sampleSize is a Function -ok 271 — Returns a single element without n specified -ok 272 — Returns a random sample of specified size from an array -ok 273 — Returns all elements in an array if n >= length -ok 274 — Returns an empty array if original array is empty -ok 275 — Returns an empty array if n = 0 +ok 273 — filterNonUniqueBy is a Function +ok 274 — filterNonUniqueBy works for properties +ok 275 — filterNonUniqueBy works for nested properties -# PASS test/randomIntArrayInRange/randomIntArrayInRange.test.js +# PASS test\randomIntArrayInRange\randomIntArrayInRange.test.js ok 276 — randomIntArrayInRange is a Function ok 277 — The returned array contains only integers ok 278 — The returned array has the proper length ok 279 — The returned array's values lie between provided lowerLimit and upperLimit (both inclusive). -# PASS test/pluralize/pluralize.test.js +# PASS test\pluralize\pluralize.test.js ok 280 — pluralize is a Function ok 281 — Produces the plural of the word @@ -378,363 +378,363 @@ ok 283 — Produces the plural of the word ok 284 — Prodices the defined plural of the word ok 285 — Works with a dictionary -# PASS test/CSVToArray/CSVToArray.test.js +# PASS test\sampleSize\sampleSize.test.js -ok 286 — CSVToArray is a Function -ok 287 — CSVToArray works with default delimiter -ok 288 — CSVToArray works with custom delimiter -ok 289 — CSVToArray omits the first row -ok 290 — CSVToArray omits the first row and works with a custom delimiter +ok 286 — sampleSize is a Function +ok 287 — Returns a single element without n specified +ok 288 — Returns a random sample of specified size from an array +ok 289 — Returns all elements in an array if n >= length +ok 290 — Returns an empty array if original array is empty +ok 291 — Returns an empty array if n = 0 -# PASS test/randomNumberInRange/randomNumberInRange.test.js +# PASS test\CSVToArray\CSVToArray.test.js -ok 291 — randomNumberInRange is a Function -ok 292 — The returned value is a number -ok 293 — The returned value lies between provided lowerLimit and upperLimit (both inclusive). +ok 292 — CSVToArray is a Function +ok 293 — CSVToArray works with default delimiter +ok 294 — CSVToArray works with custom delimiter +ok 295 — CSVToArray omits the first row +ok 296 — CSVToArray omits the first row and works with a custom delimiter -# PASS test/randomIntegerInRange/randomIntegerInRange.test.js +# PASS test\randomIntegerInRange\randomIntegerInRange.test.js -ok 294 — randomIntegerInRange is a Function -ok 295 — The returned value is an integer -ok 296 — The returned value lies between provided lowerLimit and upperLimit (both inclusive). +ok 297 — randomIntegerInRange is a Function +ok 298 — The returned value is an integer +ok 299 — The returned value lies between provided lowerLimit and upperLimit (both inclusive). -# PASS test/equals/equals.test.js +# PASS test\randomNumberInRange\randomNumberInRange.test.js -ok 297 — equals is a Function -ok 298 — { a: [2, {e: 3}], b: [4], c: 'foo' } is equal to { a: [2, {e: 3}], b: [4], c: 'foo' } -ok 299 — [1,2,3] is equal to [1,2,3] -ok 300 — { a: [2, 3], b: [4] } is not equal to { a: [2, 3], b: [6] } -ok 301 — [1,2,3] is not equal to [1,2,4] -ok 302 — [1, 2, 3] should be equal to { 0: 1, 1: 2, 2: 3 }) - type is different, but their enumerable properties match. +ok 300 — randomNumberInRange is a Function +ok 301 — The returned value is a number +ok 302 — The returned value lies between provided lowerLimit and upperLimit (both inclusive). -# PASS test/join/join.test.js +# PASS test\orderBy\orderBy.test.js -ok 303 — join is a Function -ok 304 — Joins all elements of an array into a string and returns this string -ok 305 — Joins all elements of an array into a string and returns this string -ok 306 — Joins all elements of an array into a string and returns this string +ok 303 — orderBy is a Function +ok 304 — Returns a sorted array of objects ordered by properties and orders. +ok 305 — Returns a sorted array of objects ordered by properties and orders. -# PASS test/orderBy/orderBy.test.js +# PASS test\geometricProgression\geometricProgression.test.js -ok 307 — orderBy is a Function -ok 308 — Returns a sorted array of objects ordered by properties and orders. -ok 309 — Returns a sorted array of objects ordered by properties and orders. +ok 306 — geometricProgression is a Function +ok 307 — Initializes an array containing the numbers in the specified range +ok 308 — Initializes an array containing the numbers in the specified range +ok 309 — Initializes an array containing the numbers in the specified range -# PASS test/geometricProgression/geometricProgression.test.js +# PASS test\any\any.test.js -ok 310 — geometricProgression is a Function -ok 311 — Initializes an array containing the numbers in the specified range -ok 312 — Initializes an array containing the numbers in the specified range -ok 313 — Initializes an array containing the numbers in the specified range +ok 310 — any is a Function +ok 311 — Returns true for arrays with at least one truthy value +ok 312 — Returns false for arrays with no truthy values +ok 313 — Returns false for arrays with no truthy values +ok 314 — Returns true with predicate function +ok 315 — Returns false with a predicate function -# PASS test/approximatelyEqual/approximatelyEqual.test.js +# PASS test\mapObject\mapObject.test.js -ok 314 — approximatelyEqual is a Function -ok 315 — Works for PI / 2 -ok 316 — Works for 0.1 + 0.2 === 0.3 -ok 317 — Works for exactly equal values -ok 318 — Works for a custom epsilon +ok 316 — mapObject is a Function +ok 317 — mapObject([1, 2, 3], a => a * a) returns { 1: 1, 2: 4, 3: 9 } +ok 318 — mapObject([1, 2, 3, 4], (a, b) => b - a) returns { 1: -1, 2: -1, 3: -1, 4: -1 } +ok 319 — mapObject([1, 2, 3, 4], (a, b) => a - b) returns { 1: 1, 2: 1, 3: 1, 4: 1 } -# PASS test/any/any.test.js +# PASS test\join\join.test.js -ok 319 — any is a Function -ok 320 — Returns true for arrays with at least one truthy value -ok 321 — Returns false for arrays with no truthy values -ok 322 — Returns false for arrays with no truthy values -ok 323 — Returns true with predicate function -ok 324 — Returns false with a predicate function +ok 320 — join is a Function +ok 321 — Joins all elements of an array into a string and returns this string +ok 322 — Joins all elements of an array into a string and returns this string +ok 323 — Joins all elements of an array into a string and returns this string -# PASS test/mapObject/mapObject.test.js +# PASS test\binomialCoefficient\binomialCoefficient.test.js -ok 325 — mapObject is a Function -ok 326 — mapObject([1, 2, 3], a => a * a) returns { 1: 1, 2: 4, 3: 9 } -ok 327 — mapObject([1, 2, 3, 4], (a, b) => b - a) returns { 1: -1, 2: -1, 3: -1, 4: -1 } -ok 328 — mapObject([1, 2, 3, 4], (a, b) => a - b) returns { 1: 1, 2: 1, 3: 1, 4: 1 } +ok 324 — binomialCoefficient is a Function +ok 325 — Returns the appropriate value +ok 326 — Returns the appropriate value +ok 327 — Returns the appropriate value +ok 328 — Returns NaN +ok 329 — Returns NaN -# PASS test/mapString/mapString.test.js +# PASS test\toCurrency\toCurrency.test.js -ok 329 — mapString is a Function -ok 330 — mapString returns a capitalized string -ok 331 — mapString can deal with indexes -ok 332 — mapString can deal with the full string +ok 330 — toCurrency is a Function +ok 331 — currency: Euro | currencyLangFormat: Local +ok 332 — currency: US Dollar | currencyLangFormat: English (United States) +ok 333 — currency: Japanese Yen | currencyLangFormat: Local -# PASS test/toCurrency/toCurrency.test.js +# PASS test\mapString\mapString.test.js -ok 333 — toCurrency is a Function -ok 334 — currency: Euro | currencyLangFormat: Local -ok 335 — currency: US Dollar | currencyLangFormat: English (United States) -ok 336 — currency: Japanese Yen | currencyLangFormat: Local +ok 334 — mapString is a Function +ok 335 — mapString returns a capitalized string +ok 336 — mapString can deal with indexes +ok 337 — mapString can deal with the full string -# PASS test/reduceWhich/reduceWhich.test.js +# PASS test\dig\dig.test.js -ok 337 — reduceWhich is a Function -ok 338 — Returns the minimum of an array -ok 339 — Returns the maximum of an array -ok 340 — Returns the object with the minimum specified value in an array +ok 338 — dig is a Function +ok 339 — Dig target success +ok 340 — Dig target with falsey value +ok 341 — Dig target with array +ok 342 — Unknown target return undefined -# PASS test/dig/dig.test.js +# PASS test\invertKeyValues\invertKeyValues.test.js -ok 341 — dig is a Function -ok 342 — Dig target success -ok 343 — Dig target with falsey value -ok 344 — Dig target with array -ok 345 — Unknown target return undefined +ok 343 — invertKeyValues is a Function +ok 344 — invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] } +ok 345 — invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] } -# PASS test/binarySearch/binarySearch.test.js +# PASS test\reduceWhich\reduceWhich.test.js -ok 346 — binarySearch is a Function -ok 347 — Finds item in array -ok 348 — Returns -1 when not found -ok 349 — Works with empty arrays -ok 350 — Works for one element arrays +ok 346 — reduceWhich is a Function +ok 347 — Returns the minimum of an array +ok 348 — Returns the maximum of an array +ok 349 — Returns the object with the minimum specified value in an array -# PASS test/invertKeyValues/invertKeyValues.test.js +# PASS test\fromCamelCase\fromCamelCase.test.js -ok 351 — invertKeyValues is a Function -ok 352 — invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] } -ok 353 — invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] } +ok 350 — fromCamelCase is a Function +ok 351 — Converts a string from camelcase +ok 352 — Converts a string from camelcase +ok 353 — Converts a string from camelcase -# PASS test/inRange/inRange.test.js +# PASS test\approximatelyEqual\approximatelyEqual.test.js -ok 354 — inRange is a Function -ok 355 — The given number falls within the given range -ok 356 — The given number falls within the given range -ok 357 — The given number does not falls within the given range -ok 358 — The given number does not falls within the given range +ok 354 — approximatelyEqual is a Function +ok 355 — Works for PI / 2 +ok 356 — Works for 0.1 + 0.2 === 0.3 +ok 357 — Works for exactly equal values +ok 358 — Works for a custom epsilon -# PASS test/binomialCoefficient/binomialCoefficient.test.js +# PASS test\castArray\castArray.test.js -ok 359 — binomialCoefficient is a Function -ok 360 — Returns the appropriate value -ok 361 — Returns the appropriate value -ok 362 — Returns the appropriate value -ok 363 — Returns NaN -ok 364 — Returns NaN +ok 359 — castArray is a Function +ok 360 — Works for single values +ok 361 — Works for arrays with one value +ok 362 — Works for arrays with multiple value +ok 363 — Works for strings +ok 364 — Works for objects -# PASS test/none/none.test.js +# PASS test\binarySearch\binarySearch.test.js -ok 365 — none is a Function -ok 366 — Returns true for arrays with no truthy values -ok 367 — Returns false for arrays with at least one truthy value -ok 368 — Returns true with a predicate function -ok 369 — Returns false with predicate function +ok 365 — binarySearch is a Function +ok 366 — Finds item in array +ok 367 — Returns -1 when not found +ok 368 — Works with empty arrays +ok 369 — Works for one element arrays -# PASS test/fromCamelCase/fromCamelCase.test.js +# PASS test\none\none.test.js -ok 370 — fromCamelCase is a Function -ok 371 — Converts a string from camelcase -ok 372 — Converts a string from camelcase -ok 373 — Converts a string from camelcase +ok 370 — none is a Function +ok 371 — Returns true for arrays with no truthy values +ok 372 — Returns false for arrays with at least one truthy value +ok 373 — Returns true with a predicate function +ok 374 — Returns false with predicate function -# PASS test/mask/mask.test.js +# PASS test\inRange\inRange.test.js -ok 374 — mask is a Function -ok 375 — Replaces all but the last num of characters with the specified mask character -ok 376 — Replaces all but the last num of characters with the specified mask character -ok 377 — Replaces all but the last num of characters with the specified mask character +ok 375 — inRange is a Function +ok 376 — The given number falls within the given range +ok 377 — The given number falls within the given range +ok 378 — The given number does not falls within the given range +ok 379 — The given number does not falls within the given range -# PASS test/castArray/castArray.test.js +# PASS test\mask\mask.test.js -ok 378 — castArray is a Function -ok 379 — Works for single values -ok 380 — Works for arrays with one value -ok 381 — Works for arrays with multiple value -ok 382 — Works for strings -ok 383 — Works for objects +ok 380 — mask is a Function +ok 381 — Replaces all but the last num of characters with the specified mask character +ok 382 — Replaces all but the last num of characters with the specified mask character +ok 383 — Replaces all but the last num of characters with the specified mask character -# PASS test/randomHexColorCode/randomHexColorCode.test.js +# PASS test\factorial\factorial.test.js -ok 384 — randomHexColorCode is a Function -ok 385 — randomHexColorCode has to proper length -ok 386 — The color code starts with "#" -ok 387 — The color code contains only valid hex-digits +ok 384 — factorial is a Function +ok 385 — Calculates the factorial of 720 +ok 386 — Calculates the factorial of 0 +ok 387 — Calculates the factorial of 1 +ok 388 — Calculates the factorial of 4 +ok 389 — Calculates the factorial of 10 -# PASS test/isAnagram/isAnagram.test.js +# PASS test\converge\converge.test.js -ok 388 — isAnagram is a Function -ok 389 — Checks valid anagram -ok 390 — Works with spaces -ok 391 — Ignores case -ok 392 — Ignores special characters +ok 390 — converge is a Function +ok 391 — Produces the average of the array +ok 392 — Produces the strange concatenation -# PASS test/factorial/factorial.test.js +# PASS test\toOrdinalSuffix\toOrdinalSuffix.test.js -ok 393 — factorial is a Function -ok 394 — Calculates the factorial of 720 -ok 395 — Calculates the factorial of 0 -ok 396 — Calculates the factorial of 1 -ok 397 — Calculates the factorial of 4 -ok 398 — Calculates the factorial of 10 +ok 393 — toOrdinalSuffix is a Function +ok 394 — Adds an ordinal suffix to a number +ok 395 — Adds an ordinal suffix to a number +ok 396 — Adds an ordinal suffix to a number +ok 397 — Adds an ordinal suffix to a number -# PASS test/capitalize/capitalize.test.js +# PASS test\deepClone\deepClone.test.js -ok 399 — capitalize is a Function -ok 400 — Capitalizes the first letter of a string -ok 401 — Capitalizes the first letter of a string -ok 402 — Works with characters -ok 403 — "Works with single character words +ok 398 — deepClone is a Function +ok 399 — Shallow cloning works +ok 400 — Deep cloning works +ok 401 — Array shallow cloning works +ok 402 — Array deep cloning works -# PASS test/converge/converge.test.js +# PASS test\capitalize\capitalize.test.js -ok 404 — converge is a Function -ok 405 — Produces the average of the array -ok 406 — Produces the strange concatenation +ok 403 — capitalize is a Function +ok 404 — Capitalizes the first letter of a string +ok 405 — Capitalizes the first letter of a string +ok 406 — Works with characters +ok 407 — "Works with single character words -# PASS test/toOrdinalSuffix/toOrdinalSuffix.test.js +# PASS test\isAnagram\isAnagram.test.js -ok 407 — toOrdinalSuffix is a Function -ok 408 — Adds an ordinal suffix to a number -ok 409 — Adds an ordinal suffix to a number -ok 410 — Adds an ordinal suffix to a number -ok 411 — Adds an ordinal suffix to a number +ok 408 — isAnagram is a Function +ok 409 — Checks valid anagram +ok 410 — Works with spaces +ok 411 — Ignores case +ok 412 — Ignores special characters -# PASS test/isString/isString.test.js +# PASS test\randomHexColorCode\randomHexColorCode.test.js -ok 412 — isString is a Function -ok 413 — foo is a string -ok 414 — "10" is a string -ok 415 — Empty string is a string -ok 416 — 10 is not a string -ok 417 — true is not string +ok 413 — randomHexColorCode is a Function +ok 414 — randomHexColorCode has to proper length +ok 415 — The color code starts with "#" +ok 416 — The color code contains only valid hex-digits -# PASS test/prettyBytes/prettyBytes.test.js +# PASS test\tomorrow\tomorrow.test.js -ok 418 — prettyBytes is a Function -ok 419 — Converts a number in bytes to a human-readable string. -ok 420 — Converts a number in bytes to a human-readable string. -ok 421 — Converts a number in bytes to a human-readable string. +ok 417 — tomorrow is a Function +ok 418 — Returns the correct year +ok 419 — Returns the correct month +ok 420 — Returns the correct date -# PASS test/shuffle/shuffle.test.js +# PASS test\JSONtoCSV\JSONtoCSV.test.js -ok 422 — shuffle is a Function -ok 423 — Shuffles the array -ok 424 — New array contains all original elements -ok 425 — Works for empty arrays -ok 426 — Works for single-element arrays +ok 421 — JSONtoCSV is a Function +ok 422 — JSONtoCSV works with default delimiter +ok 423 — JSONtoCSV works with custom delimiter -# PASS test/deepClone/deepClone.test.js +# PASS test\prettyBytes\prettyBytes.test.js -ok 427 — deepClone is a Function -ok 428 — Shallow cloning works -ok 429 — Deep cloning works -ok 430 — Array shallow cloning works -ok 431 — Array deep cloning works +ok 424 — prettyBytes is a Function +ok 425 — Converts a number in bytes to a human-readable string. +ok 426 — Converts a number in bytes to a human-readable string. +ok 427 — Converts a number in bytes to a human-readable string. -# PASS test/partition/partition.test.js +# PASS test\shuffle\shuffle.test.js -ok 432 — partition is a Function -ok 433 — Groups the elements into two arrays, depending on the provided function's truthiness for each element. +ok 428 — shuffle is a Function +ok 429 — Shuffles the array +ok 430 — New array contains all original elements +ok 431 — Works for empty arrays +ok 432 — Works for single-element arrays -# PASS test/isObjectLike/isObjectLike.test.js +# PASS test\isString\isString.test.js -ok 434 — isObjectLike is a Function -ok 435 — Returns true for an object -ok 436 — Returns true for an array -ok 437 — Returns false for a function -ok 438 — Returns false for null +ok 433 — isString is a Function +ok 434 — foo is a string +ok 435 — "10" is a string +ok 436 — Empty string is a string +ok 437 — 10 is not a string +ok 438 — true is not string -# PASS test/dropRight/dropRight.test.js +# PASS test\hexToRGB\hexToRGB.test.js -ok 439 — dropRight is a Function -ok 440 — Returns a new array with n elements removed from the right -ok 441 — Returns a new array with n elements removed from the right -ok 442 — Returns a new array with n elements removed from the right +ok 439 — hexToRGB is a Function +ok 440 — Converts a color code to a rgb() or rgba() string +ok 441 — Converts a color code to a rgb() or rgba() string +ok 442 — Converts a color code to a rgb() or rgba() string -# PASS test/stringPermutations/stringPermutations.test.js +# PASS test\dropRight\dropRight.test.js -ok 443 — stringPermutations is a Function -ok 444 — Generates all stringPermutations of a string -ok 445 — Works for single-letter strings -ok 446 — Works for empty strings +ok 443 — dropRight is a Function +ok 444 — Returns a new array with n elements removed from the right +ok 445 — Returns a new array with n elements removed from the right +ok 446 — Returns a new array with n elements removed from the right -# PASS test/capitalizeEveryWord/capitalizeEveryWord.test.js +# PASS test\stringPermutations\stringPermutations.test.js -ok 447 — capitalizeEveryWord is a Function -ok 448 — Capitalizes the first letter of every word in a string -ok 449 — Works with characters -ok 450 — Works with one word string +ok 447 — stringPermutations is a Function +ok 448 — Generates all stringPermutations of a string +ok 449 — Works for single-letter strings +ok 450 — Works for empty strings -# PASS test/JSONtoCSV/JSONtoCSV.test.js +# PASS test\partition\partition.test.js -ok 451 — JSONtoCSV is a Function -ok 452 — JSONtoCSV works with default delimiter -ok 453 — JSONtoCSV works with custom delimiter +ok 451 — partition is a Function +ok 452 — Groups the elements into two arrays, depending on the provided function's truthiness for each element. -# PASS test/hexToRGB/hexToRGB.test.js +# PASS test\isObjectLike\isObjectLike.test.js -ok 454 — hexToRGB is a Function -ok 455 — Converts a color code to a rgb() or rgba() string -ok 456 — Converts a color code to a rgb() or rgba() string -ok 457 — Converts a color code to a rgb() or rgba() string +ok 453 — isObjectLike is a Function +ok 454 — Returns true for an object +ok 455 — Returns true for an array +ok 456 — Returns false for a function +ok 457 — Returns false for null -# PASS test/tomorrow/tomorrow.test.js +# PASS test\capitalizeEveryWord\capitalizeEveryWord.test.js -ok 458 — tomorrow is a Function -ok 459 — Returns the correct year -ok 460 — Returns the correct month -ok 461 — Returns the correct date +ok 458 — capitalizeEveryWord is a Function +ok 459 — Capitalizes the first letter of every word in a string +ok 460 — Works with characters +ok 461 — Works with one word string -# PASS test/unzip/unzip.test.js +# PASS test\sumPower\sumPower.test.js -ok 462 — unzip is a Function -ok 463 — unzip([['a', 1, true], ['b', 2, false]]) equals [['a','b'], [1, 2], [true, false]] -ok 464 — unzip([['a', 1, true], ['b', 2]]) equals [['a','b'], [1, 2], [true]] +ok 462 — sumPower is a Function +ok 463 — Returns the sum of the powers of all the numbers from start to end +ok 464 — Returns the sum of the powers of all the numbers from start to end +ok 465 — Returns the sum of the powers of all the numbers from start to end -# PASS test/standardDeviation/standardDeviation.test.js +# PASS test\unzip\unzip.test.js -ok 465 — standardDeviation is a Function -ok 466 — Returns the standard deviation of an array of numbers -ok 467 — Returns the standard deviation of an array of numbers +ok 466 — unzip is a Function +ok 467 — unzip([['a', 1, true], ['b', 2, false]]) equals [['a','b'], [1, 2], [true, false]] +ok 468 — unzip([['a', 1, true], ['b', 2]]) equals [['a','b'], [1, 2], [true]] -# PASS test/isObject/isObject.test.js +# PASS test\untildify\untildify.test.js -ok 468 — isObject is a Function -ok 469 — isObject([1, 2, 3, 4]) is a object -ok 470 — isObject([]) is a object -ok 471 — isObject({ a:1 }) is a object -ok 472 — isObject(true) is not a object +ok 469 — untildify is a Function +ok 470 — Contains no tildes +ok 471 — Does not alter the rest of the path +ok 472 — Does not alter paths without tildes -# PASS test/sumPower/sumPower.test.js +# PASS test\isObject\isObject.test.js -ok 473 — sumPower is a Function -ok 474 — Returns the sum of the powers of all the numbers from start to end -ok 475 — Returns the sum of the powers of all the numbers from start to end -ok 476 — Returns the sum of the powers of all the numbers from start to end +ok 473 — isObject is a Function +ok 474 — isObject([1, 2, 3, 4]) is a object +ok 475 — isObject([]) is a object +ok 476 — isObject({ a:1 }) is a object +ok 477 — isObject(true) is not a object -# PASS test/untildify/untildify.test.js +# PASS test\formatDuration\formatDuration.test.js -ok 477 — untildify is a Function -ok 478 — Contains no tildes -ok 479 — Does not alter the rest of the path -ok 480 — Does not alter paths without tildes +ok 478 — formatDuration is a Function +ok 479 — Returns the human readable format of the given number of milliseconds +ok 480 — Returns the human readable format of the given number of milliseconds -# PASS test/sortedIndex/sortedIndex.test.js +# PASS test\byteSize\byteSize.test.js -ok 481 — sortedIndex is a Function -ok 482 — Returns the lowest index at which value should be inserted into array in order to maintain its sort order. -ok 483 — Returns the lowest index at which value should be inserted into array in order to maintain its sort order. +ok 481 — byteSize is a Function +ok 482 — Works for a single letter +ok 483 — Works for a common string +ok 484 — Works for emoji -# PASS test/formatDuration/formatDuration.test.js +# PASS test\standardDeviation\standardDeviation.test.js -ok 484 — formatDuration is a Function -ok 485 — Returns the human readable format of the given number of milliseconds -ok 486 — Returns the human readable format of the given number of milliseconds +ok 485 — standardDeviation is a Function +ok 486 — Returns the standard deviation of an array of numbers +ok 487 — Returns the standard deviation of an array of numbers -# PASS test/isAbsoluteURL/isAbsoluteURL.test.js +# PASS test\sortedIndex\sortedIndex.test.js -ok 487 — isAbsoluteURL is a Function -ok 488 — Given string is an absolute URL -ok 489 — Given string is an absolute URL -ok 490 — Given string is not an absolute URL +ok 488 — sortedIndex is a Function +ok 489 — Returns the lowest index at which value should be inserted into array in order to maintain its sort order. +ok 490 — Returns the lowest index at which value should be inserted into array in order to maintain its sort order. -# PASS test/byteSize/byteSize.test.js +# PASS test\uncurry\uncurry.test.js -ok 491 — byteSize is a Function -ok 492 — Works for a single letter -ok 493 — Works for a common string -ok 494 — Works for emoji +ok 491 — uncurry is a Function +ok 492 — Works without a provided value for n +ok 493 — Works with n = 2 +ok 494 — Works with n = 3 -# PASS test/pad/pad.test.js +# PASS test\pad\pad.test.js ok 495 — pad is a Function ok 496 — cat is padded on both sides @@ -742,1320 +742,1320 @@ ok 497 — length of string is 8 ok 498 — pads 42 with "0" ok 499 — does not truncates if string exceeds length -# PASS test/uncurry/uncurry.test.js +# PASS test\isAbsoluteURL\isAbsoluteURL.test.js -ok 500 — uncurry is a Function -ok 501 — Works without a provided value for n -ok 502 — Works with n = 2 -ok 503 — Works with n = 3 +ok 500 — isAbsoluteURL is a Function +ok 501 — Given string is an absolute URL +ok 502 — Given string is an absolute URL +ok 503 — Given string is not an absolute URL -# PASS test/CSVToJSON/CSVToJSON.test.js +# PASS test\isValidJSON\isValidJSON.test.js -ok 504 — CSVToJSON is a Function -ok 505 — CSVToJSON works with default delimiter -ok 506 — CSVToJSON works with custom delimiter +ok 504 — isValidJSON is a Function +ok 505 — {"name":"Adam","age":20} is a valid JSON +ok 506 — {"name":"Adam",age:"20"} is not a valid JSON +ok 507 — null is a valid JSON -# PASS test/isValidJSON/isValidJSON.test.js +# PASS test\CSVToJSON\CSVToJSON.test.js -ok 507 — isValidJSON is a Function -ok 508 — {"name":"Adam","age":20} is a valid JSON -ok 509 — {"name":"Adam",age:"20"} is not a valid JSON -ok 510 — null is a valid JSON +ok 508 — CSVToJSON is a Function +ok 509 — CSVToJSON works with default delimiter +ok 510 — CSVToJSON works with custom delimiter -# PASS test/URLJoin/URLJoin.test.js +# PASS test\URLJoin\URLJoin.test.js ok 511 — URLJoin is a Function ok 512 — Returns proper URL ok 513 — Returns proper URL -# PASS test/groupBy/groupBy.test.js +# PASS test\reject\reject.test.js -ok 514 — groupBy is a Function -ok 515 — Groups the elements of an array based on the given function -ok 516 — Groups the elements of an array based on the given function +ok 514 — reject is a Function +ok 515 — Works with numbers +ok 516 — Works with strings -# PASS test/matches/matches.test.js +# PASS test\reducedFilter\reducedFilter.test.js -ok 517 — matches is a Function -ok 518 — Matches returns true for two similar objects -ok 519 — Matches returns false for two non-similar objects +ok 517 — reducedFilter is a Function +ok 518 — Filter an array of objects based on a condition while also filtering out unspecified keys. -# PASS test/lowercaseKeys/lowercaseKeys.test.js +# PASS test\groupBy\groupBy.test.js -ok 520 — lowercaseKeys is a Function -ok 521 — Lowercases object keys -ok 522 — Does not mutate original object +ok 519 — groupBy is a Function +ok 520 — Groups the elements of an array based on the given function +ok 521 — Groups the elements of an array based on the given function -# PASS test/reject/reject.test.js +# PASS test\matches\matches.test.js -ok 523 — reject is a Function -ok 524 — Works with numbers -ok 525 — Works with strings +ok 522 — matches is a Function +ok 523 — Matches returns true for two similar objects +ok 524 — Matches returns false for two non-similar objects -# PASS test/reducedFilter/reducedFilter.test.js +# PASS test\functionName\functionName.test.js -ok 526 — reducedFilter is a Function -ok 527 — Filter an array of objects based on a condition while also filtering out unspecified keys. +ok 525 — functionName is a Function +ok 526 — Works for native functions +ok 527 — Works for functions +ok 528 — Works for arrow functions -# PASS test/functionName/functionName.test.js +# PASS test\lowercaseKeys\lowercaseKeys.test.js -ok 528 — functionName is a Function -ok 529 — Works for native functions -ok 530 — Works for functions -ok 531 — Works for arrow functions +ok 529 — lowercaseKeys is a Function +ok 530 — Lowercases object keys +ok 531 — Does not mutate original object -# PASS test/collectInto/collectInto.test.js +# PASS test\collatz\collatz.test.js -ok 532 — collectInto is a Function -ok 533 — Works with multiple promises +ok 532 — collatz is a Function +ok 533 — When n is even, divide by 2 +ok 534 — When n is odd, times by 3 and add 1 +ok 535 — Eventually reaches 1 -# PASS test/symmetricDifferenceWith/symmetricDifferenceWith.test.js +# PASS test\symmetricDifferenceWith\symmetricDifferenceWith.test.js -ok 534 — symmetricDifferenceWith is a Function -ok 535 — Returns the symmetric difference between two arrays, using a provided function as a comparator +ok 536 — symmetricDifferenceWith is a Function +ok 537 — Returns the symmetric difference between two arrays, using a provided function as a comparator -# PASS test/collatz/collatz.test.js +# PASS test\collectInto\collectInto.test.js -ok 536 — collatz is a Function -ok 537 — When n is even, divide by 2 -ok 538 — When n is odd, times by 3 and add 1 -ok 539 — Eventually reaches 1 +ok 538 — collectInto is a Function +ok 539 — Works with multiple promises -# PASS test/sample/sample.test.js +# PASS test\UUIDGeneratorNode\UUIDGeneratorNode.test.js -ok 540 — sample is a Function -ok 541 — Returns a random element from the array -ok 542 — Works for single-element arrays -ok 543 — Returns undefined for empty array +ok 540 — UUIDGeneratorNode is a Function +ok 541 — Contains dashes in the proper places +ok 542 — Only contains hexadecimal digits -# PASS test/matchesWith/matchesWith.test.js +# PASS test\nthArg\nthArg.test.js -ok 544 — matchesWith is a Function -ok 545 — Returns true for two objects with similar values, based on the provided function +ok 543 — nthArg is a Function +ok 544 — Returns the nth argument +ok 545 — Returns undefined if arguments too few +ok 546 — Works for negative values -# PASS test/nthArg/nthArg.test.js +# PASS test\luhnCheck\luhnCheck.test.js -ok 546 — nthArg is a Function -ok 547 — Returns the nth argument -ok 548 — Returns undefined if arguments too few -ok 549 — Works for negative values +ok 547 — luhnCheck is a Function +ok 548 — validates identification number +ok 549 — validates identification number +ok 550 — validates identification number -# PASS test/isLowerCase/isLowerCase.test.js +# PASS test\matchesWith\matchesWith.test.js -ok 550 — isLowerCase is a Function -ok 551 — passed string is a lowercase -ok 552 — passed string is a lowercase -ok 553 — passed value is not a lowercase +ok 551 — matchesWith is a Function +ok 552 — Returns true for two objects with similar values, based on the provided function -# PASS test/luhnCheck/luhnCheck.test.js +# PASS test\functions\functions.test.js -ok 554 — luhnCheck is a Function -ok 555 — validates identification number -ok 556 — validates identification number -ok 557 — validates identification number +ok 553 — functions is a Function +ok 554 — Returns own methods +ok 555 — Returns own and inherited methods -# PASS test/differenceBy/differenceBy.test.js +# PASS test\sample\sample.test.js -ok 558 — differenceBy is a Function -ok 559 — Works using a native function and numbers -ok 560 — Works with arrow function and objects +ok 556 — sample is a Function +ok 557 — Returns a random element from the array +ok 558 — Works for single-element arrays +ok 559 — Returns undefined for empty array -# PASS test/UUIDGeneratorNode/UUIDGeneratorNode.test.js +# PASS test\differenceBy\differenceBy.test.js -ok 561 — UUIDGeneratorNode is a Function -ok 562 — Contains dashes in the proper places -ok 563 — Only contains hexadecimal digits +ok 560 — differenceBy is a Function +ok 561 — Works using a native function and numbers +ok 562 — Works with arrow function and objects -# PASS test/functions/functions.test.js +# PASS test\drop\drop.test.js -ok 564 — functions is a Function -ok 565 — Returns own methods -ok 566 — Returns own and inherited methods +ok 563 — drop is a Function +ok 564 — Works without the last argument +ok 565 — Removes appropriate element count as specified +ok 566 — Empties array given a count greater than length -# PASS test/flattenObject/flattenObject.test.js +# PASS test\pipeAsyncFunctions\pipeAsyncFunctions.test.js -ok 567 — flattenObject is a Function -ok 568 — Flattens an object with the paths for keys -ok 569 — Works with arrays +ok 567 — pipeAsyncFunctions is a Function +ok 568 — pipeAsyncFunctions result should be 15 -# PASS test/drop/drop.test.js +# PASS test\flattenObject\flattenObject.test.js -ok 570 — drop is a Function -ok 571 — Works without the last argument -ok 572 — Removes appropriate element count as specified -ok 573 — Empties array given a count greater than length +ok 569 — flattenObject is a Function +ok 570 — Flattens an object with the paths for keys +ok 571 — Works with arrays -# PASS test/pipeAsyncFunctions/pipeAsyncFunctions.test.js +# PASS test\elo\elo.test.js -ok 574 — pipeAsyncFunctions is a Function -ok 575 — pipeAsyncFunctions result should be 15 +ok 572 — elo is a Function +ok 573 — Standard 1v1s +ok 574 — Standard 1v1s +ok 575 — 4 player FFA, all same rank -# PASS test/averageBy/averageBy.test.js +# PASS test\memoize\memoize.test.js -ok 576 — averageBy is a Function -ok 577 — Produces the right result with a function -ok 578 — Produces the right result with a property name +ok 576 — memoize is a Function +ok 577 — Function works properly +ok 578 — Function works properly +ok 579 — Cache stores values -# PASS test/renameKeys/renameKeys.test.js +# PASS test\isLowerCase\isLowerCase.test.js -ok 579 — renameKeys is a Function -ok 580 — renameKeys is a Function +ok 580 — isLowerCase is a Function +ok 581 — passed string is a lowercase +ok 582 — passed string is a lowercase +ok 583 — passed value is not a lowercase -# PASS test/bindKey/bindKey.test.js +# PASS test\averageBy\averageBy.test.js -ok 581 — bindKey is a Function -ok 582 — Binds function to an object context +ok 584 — averageBy is a Function +ok 585 — Produces the right result with a function +ok 586 — Produces the right result with a property name -# PASS test/elo/elo.test.js +# PASS test\renameKeys\renameKeys.test.js -ok 583 — elo is a Function -ok 584 — Standard 1v1s -ok 585 — Standard 1v1s -ok 586 — 4 player FFA, all same rank +ok 587 — renameKeys is a Function +ok 588 — renameKeys is a Function -# PASS test/isUpperCase/isUpperCase.test.js +# PASS test\bindKey\bindKey.test.js -ok 587 — isUpperCase is a Function -ok 588 — ABC is all upper case -ok 589 — abc is not all upper case -ok 590 — A3@$ is all uppercase +ok 589 — bindKey is a Function +ok 590 — Binds function to an object context -# PASS test/isArrayLike/isArrayLike.test.js +# PASS test\symmetricDifferenceBy\symmetricDifferenceBy.test.js -ok 591 — isArrayLike is a Function -ok 592 — Returns true for a string -ok 593 — Returns true for an array -ok 594 — Returns false for null +ok 591 — symmetricDifferenceBy is a Function +ok 592 — Returns the symmetric difference between two arrays, after applying the provided function to each array element of both -# PASS test/intersectionWith/intersectionWith.test.js +# PASS test\isArrayLike\isArrayLike.test.js -ok 595 — intersectionWith is a Function -ok 596 — Returns a list of elements that exist in both arrays, using a provided comparator function +ok 593 — isArrayLike is a Function +ok 594 — Returns true for a string +ok 595 — Returns true for an array +ok 596 — Returns false for null -# PASS test/memoize/memoize.test.js +# PASS test\promisify\promisify.test.js -ok 597 — memoize is a Function -ok 598 — Function works properly -ok 599 — Function works properly -ok 600 — Cache stores values +ok 597 — promisify is a Function +ok 598 — Returns a promise +ok 599 — Runs the function provided -# PASS test/symmetricDifferenceBy/symmetricDifferenceBy.test.js +# PASS test\isUpperCase\isUpperCase.test.js -ok 601 — symmetricDifferenceBy is a Function -ok 602 — Returns the symmetric difference between two arrays, after applying the provided function to each array element of both +ok 600 — isUpperCase is a Function +ok 601 — ABC is all upper case +ok 602 — abc is not all upper case +ok 603 — A3@$ is all uppercase -# PASS test/promisify/promisify.test.js +# PASS test\pullAtValue\pullAtValue.test.js -ok 603 — promisify is a Function -ok 604 — Returns a promise -ok 605 — Runs the function provided +ok 604 — pullAtValue is a Function +ok 605 — Pulls the specified values +ok 606 — Pulls the specified values -# PASS test/pullAtValue/pullAtValue.test.js +# PASS test\arrayToCSV\arrayToCSV.test.js -ok 606 — pullAtValue is a Function -ok 607 — Pulls the specified values -ok 608 — Pulls the specified values +ok 607 — arrayToCSV is a Function +ok 608 — arrayToCSV works with default delimiter +ok 609 — arrayToCSV works with custom delimiter -# PASS test/arrayToCSV/arrayToCSV.test.js +# PASS test\intersectionWith\intersectionWith.test.js -ok 609 — arrayToCSV is a Function -ok 610 — arrayToCSV works with default delimiter -ok 611 — arrayToCSV works with custom delimiter +ok 610 — intersectionWith is a Function +ok 611 — Returns a list of elements that exist in both arrays, using a provided comparator function -# PASS test/minBy/minBy.test.js +# PASS test\isPromiseLike\isPromiseLike.test.js -ok 612 — minBy is a Function -ok 613 — Produces the right result with a function -ok 614 — Produces the right result with a property name +ok 612 — isPromiseLike is a Function +ok 613 — Returns true for a promise-like object +ok 614 — Returns false for an empty object -# PASS test/maxBy/maxBy.test.js +# PASS test\maxBy\maxBy.test.js ok 615 — maxBy is a Function ok 616 — Produces the right result with a function ok 617 — Produces the right result with a property name -# PASS test/isPromiseLike/isPromiseLike.test.js +# PASS test\minBy\minBy.test.js -ok 618 — isPromiseLike is a Function -ok 619 — Returns true for a promise-like object -ok 620 — Returns false for an empty object +ok 618 — minBy is a Function +ok 619 — Produces the right result with a function +ok 620 — Produces the right result with a property name -# PASS test/pullAtIndex/pullAtIndex.test.js +# PASS test\pullAtIndex\pullAtIndex.test.js ok 621 — pullAtIndex is a Function ok 622 — Pulls the given values ok 623 — Pulls the given values -# PASS test/bind/bind.test.js +# PASS test\unzipWith\unzipWith.test.js -ok 624 — bind is a Function -ok 625 — Binds to an object context +ok 624 — unzipWith is a Function +ok 625 — unzipWith([[1, 10, 100], [2, 20, 200]], (...args) => args.reduce((acc, v) => acc + v, 0)) equals [3, 30, 300] -# PASS test/unzipWith/unzipWith.test.js +# PASS test\merge\merge.test.js -ok 626 — unzipWith is a Function -ok 627 — unzipWith([[1, 10, 100], [2, 20, 200]], (...args) => args.reduce((acc, v) => acc + v, 0)) equals [3, 30, 300] +ok 626 — merge is a Function +ok 627 — Merges two objects -# PASS test/runPromisesInSeries/runPromisesInSeries.test.js +# PASS test\bind\bind.test.js -ok 628 — runPromisesInSeries is a Function -ok 629 — Runs promises in series +ok 628 — bind is a Function +ok 629 — Binds to an object context -# PASS test/findLastKey/findLastKey.test.js +# PASS test\coalesceFactory\coalesceFactory.test.js -ok 630 — findLastKey is a Function -ok 631 — eturns the appropriate key +ok 630 — coalesceFactory is a Function +ok 631 — Returns a customized coalesce function -# PASS test/merge/merge.test.js +# PASS test\takeRight\takeRight.test.js -ok 632 — merge is a Function -ok 633 — Merges two objects +ok 632 — takeRight is a Function +ok 633 — Returns an array with n elements removed from the end +ok 634 — Returns an array with n elements removed from the end -# PASS test/truthCheckCollection/truthCheckCollection.test.js +# PASS test\truthCheckCollection\truthCheckCollection.test.js -ok 634 — truthCheckCollection is a Function -ok 635 — second argument is truthy on all elements of a collection +ok 635 — truthCheckCollection is a Function +ok 636 — second argument is truthy on all elements of a collection -# PASS test/coalesceFactory/coalesceFactory.test.js +# PASS test\findLastKey\findLastKey.test.js -ok 636 — coalesceFactory is a Function -ok 637 — Returns a customized coalesce function +ok 637 — findLastKey is a Function +ok 638 — eturns the appropriate key -# PASS test/takeRight/takeRight.test.js +# PASS test\isNil\isNil.test.js -ok 638 — takeRight is a Function -ok 639 — Returns an array with n elements removed from the end -ok 640 — Returns an array with n elements removed from the end +ok 639 — isNil is a Function +ok 640 — Returns true for null +ok 641 — Returns true for undefined +ok 642 — Returns false for an empty string -# PASS test/intersectionBy/intersectionBy.test.js +# PASS test\chainAsync\chainAsync.test.js -ok 641 — intersectionBy is a Function -ok 642 — Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both +ok 643 — chainAsync is a Function +ok 644 — Calls all functions in an array -# PASS test/isPlainObject/isPlainObject.test.js +# PASS test\gcd\gcd.test.js -ok 643 — isPlainObject is a Function -ok 644 — Returns true for a plain object -ok 645 — Returns false for a Map (example of non-plain object) - -# PASS test/gcd/gcd.test.js - -ok 646 — gcd is a Function +ok 645 — gcd is a Function +ok 646 — Calculates the greatest common divisor between two or more numbers/arrays ok 647 — Calculates the greatest common divisor between two or more numbers/arrays -ok 648 — Calculates the greatest common divisor between two or more numbers/arrays -# PASS test/extendHex/extendHex.test.js +# PASS test\isPlainObject\isPlainObject.test.js -ok 649 — extendHex is a Function -ok 650 — Extends a 3-digit color code to a 6-digit color code -ok 651 — Extends a 3-digit color code to a 6-digit color code +ok 648 — isPlainObject is a Function +ok 649 — Returns true for a plain object +ok 650 — Returns false for a Map (example of non-plain object) -# PASS test/isTravisCI/isTravisCI.test.js +# PASS test\runPromisesInSeries\runPromisesInSeries.test.js -ok 652 — isTravisCI is a Function -ok 653 — Running on Travis, correctly evaluates +ok 651 — runPromisesInSeries is a Function +ok 652 — Runs promises in series -# PASS test/take/take.test.js +# PASS test\pipeFunctions\pipeFunctions.test.js -ok 654 — take is a Function -ok 655 — Returns an array with n elements removed from the beginning. -ok 656 — Returns an array with n elements removed from the beginning. +ok 653 — pipeFunctions is a Function +ok 654 — Performs left-to-right function composition -# PASS test/indexOfAll/indexOfAll.test.js +# PASS test\isTravisCI\isTravisCI.test.js -ok 657 — indexOfAll is a Function -ok 658 — Returns all indices of val in an array -ok 659 — Returns all indices of val in an array +ok 655 — isTravisCI is a Function +ok 656 — Not running on Travis, correctly evaluates -# PASS test/chainAsync/chainAsync.test.js +# PASS test\extendHex\extendHex.test.js -ok 660 — chainAsync is a Function -ok 661 — Calls all functions in an array +ok 657 — extendHex is a Function +ok 658 — Extends a 3-digit color code to a 6-digit color code +ok 659 — Extends a 3-digit color code to a 6-digit color code -# PASS test/isNil/isNil.test.js +# PASS test\intersectionBy\intersectionBy.test.js -ok 662 — isNil is a Function -ok 663 — Returns true for null -ok 664 — Returns true for undefined -ok 665 — Returns false for an empty string +ok 660 — intersectionBy is a Function +ok 661 — Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both -# PASS test/pipeFunctions/pipeFunctions.test.js +# PASS test\take\take.test.js -ok 666 — pipeFunctions is a Function -ok 667 — Performs left-to-right function composition +ok 662 — take is a Function +ok 663 — Returns an array with n elements removed from the beginning. +ok 664 — Returns an array with n elements removed from the beginning. -# PASS test/shallowClone/shallowClone.test.js +# PASS test\indexOfAll\indexOfAll.test.js -ok 668 — shallowClone is a Function -ok 669 — Shallow cloning works -ok 670 — Does not clone deeply +ok 665 — indexOfAll is a Function +ok 666 — Returns all indices of val in an array +ok 667 — Returns all indices of val in an array -# PASS test/getURLParameters/getURLParameters.test.js +# PASS test\when\when.test.js -ok 671 — getURLParameters is a Function -ok 672 — Returns an object containing the parameters of the current URL +ok 668 — when is a Function +ok 669 — Returns the proper result +ok 670 — Returns the proper result -# PASS test/spreadOver/spreadOver.test.js +# PASS test\shallowClone\shallowClone.test.js -ok 673 — spreadOver is a Function -ok 674 — Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function. +ok 671 — shallowClone is a Function +ok 672 — Shallow cloning works +ok 673 — Does not clone deeply -# PASS test/overArgs/overArgs.test.js +# PASS test\getURLParameters\getURLParameters.test.js -ok 675 — overArgs is a Function -ok 676 — Invokes the provided function with its arguments transformed +ok 674 — getURLParameters is a Function +ok 675 — Returns an object containing the parameters of the current URL -# PASS test/cleanObj/cleanObj.test.js +# PASS test\decapitalize\decapitalize.test.js -ok 677 — cleanObj is a Function -ok 678 — Removes any properties except the ones specified from a JSON object +ok 676 — decapitalize is a Function +ok 677 — Works with default parameter +ok 678 — Works with second parameter set to true -# PASS test/decapitalize/decapitalize.test.js +# PASS test\overArgs\overArgs.test.js -ok 679 — decapitalize is a Function -ok 680 — Works with default parameter -ok 681 — Works with second parameter set to true +ok 679 — overArgs is a Function +ok 680 — Invokes the provided function with its arguments transformed -# PASS test/when/when.test.js +# PASS test\cleanObj\cleanObj.test.js -ok 682 — when is a Function -ok 683 — Returns the proper result -ok 684 — Returns the proper result +ok 681 — cleanObj is a Function +ok 682 — Removes any properties except the ones specified from a JSON object -# PASS test/findKey/findKey.test.js +# PASS test\countBy\countBy.test.js -ok 685 — findKey is a Function -ok 686 — Returns the appropriate key +ok 683 — countBy is a Function +ok 684 — Works for functions +ok 685 — Works for property names -# PASS test/nthElement/nthElement.test.js +# PASS test\nthElement\nthElement.test.js -ok 687 — nthElement is a Function +ok 686 — nthElement is a Function +ok 687 — Returns the nth element of an array. ok 688 — Returns the nth element of an array. -ok 689 — Returns the nth element of an array. -# PASS test/countBy/countBy.test.js +# PASS test\findKey\findKey.test.js -ok 690 — countBy is a Function -ok 691 — Works for functions -ok 692 — Works for property names +ok 689 — findKey is a Function +ok 690 — Returns the appropriate key -# PASS test/partialRight/partialRight.test.js +# PASS test\partialRight\partialRight.test.js -ok 693 — partialRight is a Function -ok 694 — Appends arguments +ok 691 — partialRight is a Function +ok 692 — Appends arguments -# PASS test/composeRight/composeRight.test.js +# PASS test\spreadOver\spreadOver.test.js -ok 695 — composeRight is a Function -ok 696 — Performs left-to-right function composition +ok 693 — spreadOver is a Function +ok 694 — Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function. -# PASS test/minN/minN.test.js +# PASS test\minN\minN.test.js -ok 697 — minN is a Function -ok 698 — Returns the n minimum elements from the provided array -ok 699 — Returns the n minimum elements from the provided array +ok 695 — minN is a Function +ok 696 — Returns the n minimum elements from the provided array +ok 697 — Returns the n minimum elements from the provided array -# PASS test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js +# PASS test\composeRight\composeRight.test.js -ok 700 — getDaysDiffBetweenDates is a Function -ok 701 — Returns the difference in days between two dates +ok 698 — composeRight is a Function +ok 699 — Performs left-to-right function composition -# PASS test/hashNode/hashNode.test.js +# PASS test\maxN\maxN.test.js -ok 702 — hashNode is a Function -ok 703 — Produces the appropriate hash +ok 700 — maxN is a Function +ok 701 — Returns the n maximum elements from the provided array +ok 702 — Returns the n maximum elements from the provided array -# PASS test/initializeArrayWithValues/initializeArrayWithValues.test.js +# PASS test\flatten\flatten.test.js -ok 704 — initializeArrayWithValues is a Function -ok 705 — Initializes and fills an array with the specified values +ok 703 — flatten is a Function +ok 704 — Flattens an array +ok 705 — Flattens an array -# PASS test/reduceSuccessive/reduceSuccessive.test.js +# PASS test\getDaysDiffBetweenDates\getDaysDiffBetweenDates.test.js -ok 706 — reduceSuccessive is a Function -ok 707 — Returns the array of successively reduced values +ok 706 — getDaysDiffBetweenDates is a Function +ok 707 — Returns the difference in days between two dates -# PASS test/sortedLastIndexBy/sortedLastIndexBy.test.js +# PASS test\hashNode\hashNode.test.js -ok 708 — sortedLastIndexBy is a Function -ok 709 — Returns the highest index to insert the element without messing up the list order +ok 708 — hashNode is a Function +ok 709 — Produces the appropriate hash -# PASS test/maxN/maxN.test.js +# PASS test\initializeArrayWithRange\initializeArrayWithRange.test.js -ok 710 — maxN is a Function -ok 711 — Returns the n maximum elements from the provided array -ok 712 — Returns the n maximum elements from the provided array +ok 710 — initializeArrayWithRange is a Function +ok 711 — Initializes an array containing the numbers in the specified range -# PASS test/initializeArrayWithRange/initializeArrayWithRange.test.js +# PASS test\sortedLastIndexBy\sortedLastIndexBy.test.js -ok 713 — initializeArrayWithRange is a Function -ok 714 — Initializes an array containing the numbers in the specified range +ok 712 — sortedLastIndexBy is a Function +ok 713 — Returns the highest index to insert the element without messing up the list order -# PASS test/flatten/flatten.test.js +# PASS test\bindAll\bindAll.test.js -ok 715 — flatten is a Function -ok 716 — Flattens an array -ok 717 — Flattens an array +ok 714 — bindAll is a Function +ok 715 — Binds to an object context -# PASS test/compose/compose.test.js +# PASS test\initializeArrayWithValues\initializeArrayWithValues.test.js + +ok 716 — initializeArrayWithValues is a Function +ok 717 — Initializes and fills an array with the specified values + +# PASS test\compose\compose.test.js ok 718 — compose is a Function ok 719 — Performs right-to-left function composition -# PASS test/partial/partial.test.js +# PASS test\lcm\lcm.test.js -ok 720 — partial is a Function -ok 721 — Prepends arguments +ok 720 — lcm is a Function +ok 721 — Returns the least common multiple of two or more numbers. +ok 722 — Returns the least common multiple of two or more numbers. -# PASS test/degreesToRads/degreesToRads.test.js +# PASS test\transform\transform.test.js -ok 722 — degreesToRads is a Function -ok 723 — Returns the appropriate value +ok 723 — transform is a Function +ok 724 — Transforms an object -# PASS test/sortedIndexBy/sortedIndexBy.test.js +# PASS test\reduceSuccessive\reduceSuccessive.test.js -ok 724 — sortedIndexBy is a Function -ok 725 — Returns the lowest index to insert the element without messing up the list order +ok 725 — reduceSuccessive is a Function +ok 726 — Returns the array of successively reduced values -# PASS test/lcm/lcm.test.js +# PASS test\percentile\percentile.test.js -ok 726 — lcm is a Function -ok 727 — Returns the least common multiple of two or more numbers. -ok 728 — Returns the least common multiple of two or more numbers. +ok 727 — percentile is a Function +ok 728 — Uses the percentile formula to calculate how many numbers in the given array are less or equal to the given value. -# PASS test/differenceWith/differenceWith.test.js +# PASS test\mapValues\mapValues.test.js -ok 729 — differenceWith is a Function -ok 730 — Filters out all values from an array +ok 729 — mapValues is a Function +ok 730 — Maps values -# PASS test/mapValues/mapValues.test.js +# PASS test\permutations\permutations.test.js -ok 731 — mapValues is a Function -ok 732 — Maps values +ok 731 — permutations is a Function +ok 732 — Generates all permutations of an array -# PASS test/pickBy/pickBy.test.js +# PASS test\partial\partial.test.js -ok 733 — pickBy is a Function -ok 734 — Creates an object composed of the properties the given function returns truthy for. +ok 733 — partial is a Function +ok 734 — Prepends arguments -# PASS test/percentile/percentile.test.js +# PASS test\differenceWith\differenceWith.test.js -ok 735 — percentile is a Function -ok 736 — Uses the percentile formula to calculate how many numbers in the given array are less or equal to the given value. +ok 735 — differenceWith is a Function +ok 736 — Filters out all values from an array -# PASS test/size/size.test.js +# PASS test\palindrome\palindrome.test.js -ok 737 — size is a Function -ok 738 — Get size of arrays, objects or strings. -ok 739 — Get size of arrays, objects or strings. +ok 737 — palindrome is a Function +ok 738 — Given string is a palindrome +ok 739 — Given string is not a palindrome -# PASS test/bindAll/bindAll.test.js +# PASS test\size\size.test.js -ok 740 — bindAll is a Function -ok 741 — Binds to an object context +ok 740 — size is a Function +ok 741 — Get size of arrays, objects or strings. +ok 742 — Get size of arrays, objects or strings. -# PASS test/transform/transform.test.js +# PASS test\median\median.test.js -ok 742 — transform is a Function -ok 743 — Transforms an object +ok 743 — median is a Function +ok 744 — Returns the median of an array of numbers +ok 745 — Returns the median of an array of numbers -# PASS test/palindrome/palindrome.test.js +# PASS test\degreesToRads\degreesToRads.test.js -ok 744 — palindrome is a Function -ok 745 — Given string is a palindrome -ok 746 — Given string is not a palindrome +ok 746 — degreesToRads is a Function +ok 747 — Returns the appropriate value -# PASS test/permutations/permutations.test.js +# PASS test\forOwnRight\forOwnRight.test.js -ok 747 — permutations is a Function -ok 748 — Generates all permutations of an array +ok 748 — forOwnRight is a Function +ok 749 — Iterates over an element's key-value pairs in reverse -# PASS test/forOwnRight/forOwnRight.test.js +# PASS test\sortedIndexBy\sortedIndexBy.test.js -ok 749 — forOwnRight is a Function -ok 750 — Iterates over an element's key-value pairs in reverse +ok 750 — sortedIndexBy is a Function +ok 751 — Returns the lowest index to insert the element without messing up the list order -# PASS test/median/median.test.js +# PASS test\rearg\rearg.test.js -ok 751 — median is a Function -ok 752 — Returns the median of an array of numbers -ok 753 — Returns the median of an array of numbers +ok 752 — rearg is a Function +ok 753 — Reorders arguments in invoked function -# PASS test/isFunction/isFunction.test.js +# PASS test\isFunction\isFunction.test.js ok 754 — isFunction is a Function ok 755 — passed value is a function ok 756 — passed value is not a function -# PASS test/dropRightWhile/dropRightWhile.test.js +# PASS test\pickBy\pickBy.test.js -ok 757 — dropRightWhile is a Function -ok 758 — Removes elements from the end of an array until the passed function returns true. +ok 757 — pickBy is a Function +ok 758 — Creates an object composed of the properties the given function returns truthy for. -# PASS test/sortCharactersInString/sortCharactersInString.test.js +# PASS test\dropRightWhile\dropRightWhile.test.js -ok 759 — sortCharactersInString is a Function -ok 760 — Alphabetically sorts the characters in a string. +ok 759 — dropRightWhile is a Function +ok 760 — Removes elements from the end of an array until the passed function returns true. -# PASS test/symmetricDifference/symmetricDifference.test.js +# PASS test\unionWith\unionWith.test.js -ok 761 — symmetricDifference is a Function -ok 762 — Returns the symmetric difference between two arrays. +ok 761 — unionWith is a Function +ok 762 — Produces the appropriate results -# PASS test/bifurcateBy/bifurcateBy.test.js +# PASS test\bifurcate\bifurcate.test.js -ok 763 — bifurcateBy is a Function +ok 763 — bifurcate is a Function ok 764 — Splits the collection into two groups -# PASS test/bifurcate/bifurcate.test.js +# PASS test\bifurcateBy\bifurcateBy.test.js -ok 765 — bifurcate is a Function +ok 765 — bifurcateBy is a Function ok 766 — Splits the collection into two groups -# PASS test/sortedLastIndex/sortedLastIndex.test.js +# PASS test\flip\flip.test.js -ok 767 — sortedLastIndex is a Function -ok 768 — Returns the highest index to insert the element without messing up the list order +ok 767 — flip is a Function +ok 768 — Flips argument order -# PASS test/unionWith/unionWith.test.js +# PASS test\sortedLastIndex\sortedLastIndex.test.js -ok 769 — unionWith is a Function -ok 770 — Produces the appropriate results +ok 769 — sortedLastIndex is a Function +ok 770 — Returns the highest index to insert the element without messing up the list order -# PASS test/isBoolean/isBoolean.test.js +# PASS test\splitLines\splitLines.test.js -ok 771 — isBoolean is a Function -ok 772 — passed value is not a boolean -ok 773 — passed value is not a boolean +ok 771 — splitLines is a Function +ok 772 — Splits a multiline string into an array of lines. -# PASS test/flip/flip.test.js +# PASS test\isBoolean\isBoolean.test.js -ok 774 — flip is a Function -ok 775 — Flips argument order +ok 773 — isBoolean is a Function +ok 774 — passed value is not a boolean +ok 775 — passed value is not a boolean -# PASS test/omitBy/omitBy.test.js +# PASS test\sortCharactersInString\sortCharactersInString.test.js -ok 776 — omitBy is a Function -ok 777 — Creates an object composed of the properties the given function returns falsey for +ok 776 — sortCharactersInString is a Function +ok 777 — Alphabetically sorts the characters in a string. -# PASS test/unescapeHTML/unescapeHTML.test.js +# PASS test\omitBy\omitBy.test.js -ok 778 — unescapeHTML is a Function -ok 779 — Unescapes escaped HTML characters. +ok 778 — omitBy is a Function +ok 779 — Creates an object composed of the properties the given function returns falsey for -# PASS test/xProd/xProd.test.js +# PASS test\symmetricDifference\symmetricDifference.test.js -ok 780 — xProd is a Function -ok 781 — xProd([1, 2], ['a', 'b']) returns [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] +ok 780 — symmetricDifference is a Function +ok 781 — Returns the symmetric difference between two arrays. -# PASS test/splitLines/splitLines.test.js +# PASS test\get\get.test.js -ok 782 — splitLines is a Function -ok 783 — Splits a multiline string into an array of lines. +ok 782 — get is a Function +ok 783 — Retrieve a property indicated by the selector from an object. -# PASS test/get/get.test.js +# PASS test\pullBy\pullBy.test.js -ok 784 — get is a Function -ok 785 — Retrieve a property indicated by the selector from an object. +ok 784 — pullBy is a Function +ok 785 — Pulls the specified values -# PASS test/rearg/rearg.test.js +# PASS test\xProd\xProd.test.js -ok 786 — rearg is a Function -ok 787 — Reorders arguments in invoked function +ok 786 — xProd is a Function +ok 787 — xProd([1, 2], ['a', 'b']) returns [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] -# PASS test/isArray/isArray.test.js +# PASS test\unescapeHTML\unescapeHTML.test.js -ok 788 — isArray is a Function -ok 789 — passed value is an array -ok 790 — passed value is not an array +ok 788 — unescapeHTML is a Function +ok 789 — Unescapes escaped HTML characters. -# PASS test/escapeHTML/escapeHTML.test.js +# PASS test\unflattenObject\unflattenObject.test.js -ok 791 — escapeHTML is a Function -ok 792 — Escapes a string for use in HTML +ok 790 — unflattenObject is a Function +ok 791 — Unflattens an object with the paths for keys -# PASS test/pullBy/pullBy.test.js +# PASS test\stableSort\stableSort.test.js -ok 793 — pullBy is a Function -ok 794 — Pulls the specified values +ok 792 — stableSort is a Function +ok 793 — Array is properly sorted -# PASS test/initialize2DArray/initialize2DArray.test.js +# PASS test\initialize2DArray\initialize2DArray.test.js -ok 795 — initialize2DArray is a Function -ok 796 — Initializes a 2D array of given width and height and value +ok 794 — initialize2DArray is a Function +ok 795 — Initializes a 2D array of given width and height and value -# PASS test/objectToPairs/objectToPairs.test.js +# PASS test\attempt\attempt.test.js -ok 797 — objectToPairs is a Function -ok 798 — Creates an array of key-value pair arrays from an object. +ok 796 — attempt is a Function +ok 797 — Returns a value +ok 798 — Returns an error -# PASS test/isNumber/isNumber.test.js +# PASS test\isNumber\isNumber.test.js ok 799 — isNumber is a Function ok 800 — passed argument is a number ok 801 — passed argument is not a number -# PASS test/attempt/attempt.test.js +# PASS test\objectFromPairs\objectFromPairs.test.js -ok 802 — attempt is a Function -ok 803 — Returns a value -ok 804 — Returns an error +ok 802 — objectFromPairs is a Function +ok 803 — Creates an object from the given key-value pairs. -# PASS test/objectFromPairs/objectFromPairs.test.js +# PASS test\isArray\isArray.test.js -ok 805 — objectFromPairs is a Function -ok 806 — Creates an object from the given key-value pairs. +ok 804 — isArray is a Function +ok 805 — passed value is an array +ok 806 — passed value is not an array -# PASS test/stableSort/stableSort.test.js +# PASS test\escapeHTML\escapeHTML.test.js -ok 807 — stableSort is a Function -ok 808 — Array is properly sorted +ok 807 — escapeHTML is a Function +ok 808 — Escapes a string for use in HTML -# PASS test/toDecimalMark/toDecimalMark.test.js +# PASS test\toDecimalMark\toDecimalMark.test.js ok 809 — toDecimalMark is a Function ok 810 — convert a float-point arithmetic to the Decimal mark form -# PASS test/forEachRight/forEachRight.test.js +# PASS test\forEachRight\forEachRight.test.js ok 811 — forEachRight is a Function ok 812 — Iterates over the array in reverse -# PASS test/unflattenObject/unflattenObject.test.js +# PASS test\unfold\unfold.test.js -ok 813 — unflattenObject is a Function -ok 814 — Unflattens an object with the paths for keys +ok 813 — unfold is a Function +ok 814 — Works with a given function, producing an array -# PASS test/unfold/unfold.test.js +# PASS test\objectToPairs\objectToPairs.test.js -ok 815 — unfold is a Function -ok 816 — Works with a given function, producing an array +ok 815 — objectToPairs is a Function +ok 816 — Creates an array of key-value pair arrays from an object. -# PASS test/stripHTMLTags/stripHTMLTags.test.js +# PASS test\filterNonUnique\filterNonUnique.test.js -ok 817 — stripHTMLTags is a Function -ok 818 — Removes HTML tags +ok 817 — filterNonUnique is a Function +ok 818 — Filters out the non-unique values in an array -# PASS test/filterNonUnique/filterNonUnique.test.js +# PASS test\curry\curry.test.js -ok 819 — filterNonUnique is a Function -ok 820 — Filters out the non-unique values in an array +ok 819 — curry is a Function +ok 820 — curries a Math.pow +ok 821 — curries a Math.min -# PASS test/findLastIndex/findLastIndex.test.js +# PASS test\findLastIndex\findLastIndex.test.js -ok 821 — findLastIndex is a Function -ok 822 — Finds last index for which the given function returns true +ok 822 — findLastIndex is a Function +ok 823 — Finds last index for which the given function returns true -# PASS test/countOccurrences/countOccurrences.test.js +# PASS test\forOwn\forOwn.test.js -ok 823 — countOccurrences is a Function -ok 824 — Counts the occurrences of a value in an array +ok 824 — forOwn is a Function +ok 825 — Iterates over an element's key-value pairs -# PASS test/removeNonASCII/removeNonASCII.test.js +# PASS test\ary\ary.test.js -ok 825 — removeNonASCII is a Function -ok 826 — Removes non-ASCII characters +ok 826 — ary is a Function +ok 827 — Discards arguments with index >=n -# PASS test/ary/ary.test.js +# PASS test\countOccurrences\countOccurrences.test.js -ok 827 — ary is a Function -ok 828 — Discards arguments with index >=n +ok 828 — countOccurrences is a Function +ok 829 — Counts the occurrences of a value in an array -# PASS test/forOwn/forOwn.test.js +# PASS test\stripHTMLTags\stripHTMLTags.test.js -ok 829 — forOwn is a Function -ok 830 — Iterates over an element's key-value pairs +ok 830 — stripHTMLTags is a Function +ok 831 — Removes HTML tags -# PASS test/takeRightWhile/takeRightWhile.test.js +# PASS test\takeRightWhile\takeRightWhile.test.js -ok 831 — takeRightWhile is a Function -ok 832 — Removes elements until the function returns true +ok 832 — takeRightWhile is a Function +ok 833 — Removes elements until the function returns true -# PASS test/curry/curry.test.js +# PASS test\removeNonASCII\removeNonASCII.test.js -ok 833 — curry is a Function -ok 834 — curries a Math.pow -ok 835 — curries a Math.min +ok 834 — removeNonASCII is a Function +ok 835 — Removes non-ASCII characters -# PASS test/compact/compact.test.js +# PASS test\compact\compact.test.js ok 836 — compact is a Function ok 837 — Removes falsey values from an array -# PASS test/isNull/isNull.test.js +# PASS test\isNull\isNull.test.js ok 838 — isNull is a Function ok 839 — passed argument is a null ok 840 — passed argument is a null -# PASS test/truncateString/truncateString.test.js +# PASS test\pick\pick.test.js -ok 841 — truncateString is a Function -ok 842 — Truncates a "boomerang" up to a specified length. +ok 841 — pick is a Function +ok 842 — Picks the key-value pairs corresponding to the given keys from an object. -# PASS test/pick/pick.test.js +# PASS test\delay\delay.test.js -ok 843 — pick is a Function -ok 844 — Picks the key-value pairs corresponding to the given keys from an object. +ok 843 — delay is a Function +ok 844 — Works as expecting, passing arguments properly -# PASS test/dropWhile/dropWhile.test.js +# PASS test\dropWhile\dropWhile.test.js ok 845 — dropWhile is a Function ok 846 — Removes elements in an array until the passed function returns true. -# PASS test/defaults/defaults.test.js +# PASS test\atob\atob.test.js -ok 847 — defaults is a Function -ok 848 — Assigns default values for undefined properties +ok 847 — atob is a Function +ok 848 — atob("Zm9vYmFy") equals "foobar" +ok 849 — atob("Z") returns "" -# PASS test/remove/remove.test.js +# PASS test\defaults\defaults.test.js -ok 849 — remove is a Function -ok 850 — Removes elements from an array for which the given function returns false +ok 850 — defaults is a Function +ok 851 — Assigns default values for undefined properties -# PASS test/omit/omit.test.js +# PASS test\remove\remove.test.js -ok 851 — omit is a Function -ok 852 — Omits the key-value pairs corresponding to the given keys from an object +ok 852 — remove is a Function +ok 853 — Removes elements from an array for which the given function returns false -# PASS test/delay/delay.test.js +# PASS test\omit\omit.test.js -ok 853 — delay is a Function -ok 854 — Works as expecting, passing arguments properly +ok 854 — omit is a Function +ok 855 — Omits the key-value pairs corresponding to the given keys from an object -# PASS test/intersection/intersection.test.js +# PASS test\truncateString\truncateString.test.js -ok 855 — intersection is a Function -ok 856 — Returns a list of elements that exist in both arrays +ok 856 — truncateString is a Function +ok 857 — Truncates a "boomerang" up to a specified length. -# PASS test/parseCookie/parseCookie.test.js +# PASS test\clampNumber\clampNumber.test.js -ok 857 — parseCookie is a Function -ok 858 — Parses the cookie +ok 858 — clampNumber is a Function +ok 859 — Clamps num within the inclusive range specified by the boundary values a and b -# PASS test/clampNumber/clampNumber.test.js +# PASS test\intersection\intersection.test.js -ok 859 — clampNumber is a Function -ok 860 — Clamps num within the inclusive range specified by the boundary values a and b +ok 860 — intersection is a Function +ok 861 — Returns a list of elements that exist in both arrays -# PASS test/similarity/similarity.test.js +# PASS test\parseCookie\parseCookie.test.js -ok 861 — similarity is a Function -ok 862 — Returns an array of elements that appear in both arrays. +ok 862 — parseCookie is a Function +ok 863 — Parses the cookie -# PASS test/findLast/findLast.test.js +# PASS test\similarity\similarity.test.js -ok 863 — findLast is a Function -ok 864 — Finds last element for which the given function returns true +ok 864 — similarity is a Function +ok 865 — Returns an array of elements that appear in both arrays. -# PASS test/over/over.test.js +# PASS test\over\over.test.js -ok 865 — over is a Function -ok 866 — Applies given functions over multiple arguments +ok 866 — over is a Function +ok 867 — Applies given functions over multiple arguments -# PASS test/takeWhile/takeWhile.test.js +# PASS test\isEven\isEven.test.js -ok 867 — takeWhile is a Function -ok 868 — Removes elements until the function returns true +ok 868 — isEven is a Function +ok 869 — 4 is even number +ok 870 — 5 is not an even number -# PASS test/isEven/isEven.test.js +# PASS test\pull\pull.test.js -ok 869 — isEven is a Function -ok 870 — 4 is even number -ok 871 — 5 is not an even number +ok 871 — pull is a Function +ok 872 — Pulls the specified values -# PASS test/cloneRegExp/cloneRegExp.test.js +# PASS test\findLast\findLast.test.js -ok 872 — cloneRegExp is a Function -ok 873 — Clones regular expressions properly +ok 873 — findLast is a Function +ok 874 — Finds last element for which the given function returns true -# PASS test/atob/atob.test.js +# PASS test\cloneRegExp\cloneRegExp.test.js -ok 874 — atob is a Function -ok 875 — atob("Zm9vYmFy") equals "foobar" -ok 876 — atob("Z") returns "" +ok 875 — cloneRegExp is a Function +ok 876 — Clones regular expressions properly -# PASS test/escapeRegExp/escapeRegExp.test.js +# PASS test\escapeRegExp\escapeRegExp.test.js ok 877 — escapeRegExp is a Function ok 878 — Escapes a string to use in a regular expression -# PASS test/pull/pull.test.js +# PASS test\times\times.test.js -ok 879 — pull is a Function -ok 880 — Pulls the specified values +ok 879 — times is a Function +ok 880 — Runs a function the specified amount of times -# PASS test/coalesce/coalesce.test.js +# PASS test\takeWhile\takeWhile.test.js -ok 881 — coalesce is a Function -ok 882 — Returns the first non-null/undefined argument +ok 881 — takeWhile is a Function +ok 882 — Removes elements until the function returns true -# PASS test/longestItem/longestItem.test.js +# PASS test\coalesce\coalesce.test.js -ok 883 — longestItem is a Function -ok 884 — Returns the longest object +ok 883 — coalesce is a Function +ok 884 — Returns the first non-null/undefined argument -# PASS test/times/times.test.js +# PASS test\longestItem\longestItem.test.js -ok 885 — times is a Function -ok 886 — Runs a function the specified amount of times +ok 885 — longestItem is a Function +ok 886 — Returns the longest object -# PASS test/hammingDistance/hammingDistance.test.js +# PASS test\tail\tail.test.js -ok 887 — hammingDistance is a Function -ok 888 — retuns hamming disance between 2 values +ok 887 — tail is a Function +ok 888 — Returns tail +ok 889 — Returns tail -# PASS test/distance/distance.test.js +# PASS test\powerset\powerset.test.js -ok 889 — distance is a Function -ok 890 — Calculates the distance between two points +ok 890 — powerset is a Function +ok 891 — Returns the powerset of a given array of numbers. -# PASS test/fibonacci/fibonacci.test.js +# PASS test\fibonacci\fibonacci.test.js -ok 891 — fibonacci is a Function -ok 892 — Generates an array, containing the Fibonacci sequence +ok 892 — fibonacci is a Function +ok 893 — Generates an array, containing the Fibonacci sequence -# PASS test/primes/primes.test.js +# PASS test\hammingDistance\hammingDistance.test.js -ok 893 — primes is a Function -ok 894 — Generates primes up to a given number, using the Sieve of Eratosthenes. +ok 894 — hammingDistance is a Function +ok 895 — retuns hamming disance between 2 values -# PASS test/powerset/powerset.test.js +# PASS test\primes\primes.test.js -ok 895 — powerset is a Function -ok 896 — Returns the powerset of a given array of numbers. +ok 896 — primes is a Function +ok 897 — Generates primes up to a given number, using the Sieve of Eratosthenes. -# PASS test/tail/tail.test.js +# PASS test\distance\distance.test.js -ok 897 — tail is a Function -ok 898 — Returns tail -ok 899 — Returns tail +ok 898 — distance is a Function +ok 899 — Calculates the distance between two points -# PASS test/RGBToHex/RGBToHex.test.js +# PASS test\serializeCookie\serializeCookie.test.js -ok 900 — RGBToHex is a Function -ok 901 — Converts the values of RGB components to a color code. +ok 900 — serializeCookie is a Function +ok 901 — Serializes the cookie -# PASS test/deepFlatten/deepFlatten.test.js +# PASS test\deepFlatten\deepFlatten.test.js ok 902 — deepFlatten is a Function ok 903 — Deep flattens an array -# PASS test/serializeCookie/serializeCookie.test.js +# PASS test\difference\difference.test.js -ok 904 — serializeCookie is a Function -ok 905 — Serializes the cookie +ok 904 — difference is a Function +ok 905 — Returns the difference between two arrays -# PASS test/negate/negate.test.js +# PASS test\RGBToHex\RGBToHex.test.js -ok 906 — negate is a Function -ok 907 — Negates a predicate function +ok 906 — RGBToHex is a Function +ok 907 — Converts the values of RGB components to a color code. -# PASS test/difference/difference.test.js +# PASS test\negate\negate.test.js -ok 908 — difference is a Function -ok 909 — Returns the difference between two arrays +ok 908 — negate is a Function +ok 909 — Negates a predicate function -# PASS test/unionBy/unionBy.test.js +# PASS test\everyNth\everyNth.test.js -ok 910 — unionBy is a Function -ok 911 — Produces the appropriate results +ok 910 — everyNth is a Function +ok 911 — Returns every nth element in an array -# PASS test/initial/initial.test.js +# PASS test\unary\unary.test.js -ok 912 — initial is a Function -ok 913 — Returns all the elements of an array except the last one +ok 912 — unary is a Function +ok 913 — Discards arguments after the first one -# PASS test/unary/unary.test.js +# PASS test\unionBy\unionBy.test.js -ok 914 — unary is a Function -ok 915 — Discards arguments after the first one +ok 914 — unionBy is a Function +ok 915 — Produces the appropriate results -# PASS test/sleep/sleep.test.js +# PASS test\initial\initial.test.js -ok 916 — sleep is a Function -ok 917 — Works as expected +ok 916 — initial is a Function +ok 917 — Returns all the elements of an array except the last one -# PASS test/everyNth/everyNth.test.js +# PASS test\sleep\sleep.test.js -ok 918 — everyNth is a Function -ok 919 — Returns every nth element in an array +ok 918 — sleep is a Function +ok 919 — Works as expected -# PASS test/mapKeys/mapKeys.test.js +# PASS test\radsToDegrees\radsToDegrees.test.js -ok 920 — mapKeys is a Function -ok 921 — Maps keys +ok 920 — radsToDegrees is a Function +ok 921 — Returns the appropriate value -# PASS test/radsToDegrees/radsToDegrees.test.js +# PASS test\mapKeys\mapKeys.test.js -ok 922 — radsToDegrees is a Function -ok 923 — Returns the appropriate value +ok 922 — mapKeys is a Function +ok 923 — Maps keys -# PASS test/digitize/digitize.test.js +# PASS test\reverseString\reverseString.test.js -ok 924 — digitize is a Function -ok 925 — Converts a number to an array of digits +ok 924 — reverseString is a Function +ok 925 — Reverses a string. -# PASS test/reverseString/reverseString.test.js +# PASS test\isDivisible\isDivisible.test.js -ok 926 — reverseString is a Function -ok 927 — Reverses a string. +ok 926 — isDivisible is a Function +ok 927 — The number 6 is divisible by 3 -# PASS test/isSymbol/isSymbol.test.js +# PASS test\isSymbol\isSymbol.test.js ok 928 — isSymbol is a Function ok 929 — Checks if the given argument is a symbol -# PASS test/isDivisible/isDivisible.test.js +# PASS test\isUndefined\isUndefined.test.js -ok 930 — isDivisible is a Function -ok 931 — The number 6 is divisible by 3 +ok 930 — isUndefined is a Function +ok 931 — Returns true for undefined -# PASS test/sdbm/sdbm.test.js +# PASS test\digitize\digitize.test.js -ok 932 — sdbm is a Function -ok 933 — Hashes the input string into a whole number. +ok 932 — digitize is a Function +ok 933 — Converts a number to an array of digits -# PASS test/getType/getType.test.js +# PASS test\getType\getType.test.js ok 934 — getType is a Function ok 935 — Returns the native type of a value -# PASS test/isUndefined/isUndefined.test.js +# PASS test\sdbm\sdbm.test.js -ok 936 — isUndefined is a Function -ok 937 — Returns true for undefined +ok 936 — sdbm is a Function +ok 937 — Hashes the input string into a whole number. -# PASS test/call/call.test.js +# PASS test\call\call.test.js ok 938 — call is a Function ok 939 — Calls function on given object -# PASS test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js +# PASS test\debounce\debounce.test.js -ok 940 — initializeArrayWithRangeRight is a Function +ok 940 — debounce is a Function +ok 941 — Works as expected -# PASS test/sum/sum.test.js +# PASS test\initializeArrayWithRangeRight\initializeArrayWithRangeRight.test.js -ok 941 — sum is a Function -ok 942 — Returns the sum of two or more numbers/arrays. +ok 942 — initializeArrayWithRangeRight is a Function -# PASS test/debounce/debounce.test.js +# PASS test\sum\sum.test.js -ok 943 — debounce is a Function -ok 944 — Works as expected +ok 943 — sum is a Function +ok 944 — Returns the sum of two or more numbers/arrays. -# PASS test/btoa/btoa.test.js +# PASS test\btoa\btoa.test.js ok 945 — btoa is a Function ok 946 — btoa("foobar") equals "Zm9vYmFy" -# PASS test/isPrime/isPrime.test.js +# PASS test\elementIsVisibleInViewport\elementIsVisibleInViewport.test.js -ok 947 — isPrime is a Function -ok 948 — passed number is a prime +ok 947 — elementIsVisibleInViewport is a Function -# PASS test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.test.js +# PASS test\isPrime\isPrime.test.js -ok 949 — getMeridiemSuffixOfInteger is a Function +ok 948 — isPrime is a Function +ok 949 — passed number is a prime -# PASS test/getColonTimeFromDate/getColonTimeFromDate.test.js +# PASS test\getMeridiemSuffixOfInteger\getMeridiemSuffixOfInteger.test.js -ok 950 — getColonTimeFromDate is a Function +ok 950 — getMeridiemSuffixOfInteger is a Function -# PASS test/fibonacciCountUntilNum/fibonacciCountUntilNum.test.js +# PASS test\fibonacciCountUntilNum\fibonacciCountUntilNum.test.js ok 951 — fibonacciCountUntilNum is a Function -# PASS test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js +# PASS test\recordAnimationFrames\recordAnimationFrames.test.js -ok 952 — elementIsVisibleInViewport is a Function +ok 952 — recordAnimationFrames is a Function -# PASS test/isBrowserTabFocused/isBrowserTabFocused.test.js +# PASS test\UUIDGeneratorBrowser\UUIDGeneratorBrowser.test.js -ok 953 — isBrowserTabFocused is a Function +ok 953 — UUIDGeneratorBrowser is a Function -# PASS test/recordAnimationFrames/recordAnimationFrames.test.js +# PASS test\getColonTimeFromDate\getColonTimeFromDate.test.js -ok 954 — recordAnimationFrames is a Function +ok 954 — getColonTimeFromDate is a Function -# PASS test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js +# PASS test\isBrowserTabFocused\isBrowserTabFocused.test.js -ok 955 — UUIDGeneratorBrowser is a Function +ok 955 — isBrowserTabFocused is a Function -# PASS test/isArmstrongNumber/isArmstrongNumber.test.js +# PASS test\levenshteinDistance\levenshteinDistance.test.js -ok 956 — isArmstrongNumber is a Function +ok 956 — levenshteinDistance is a Function -# PASS test/detectDeviceType/detectDeviceType.test.js +# PASS test\initializeNDArray\initializeNDArray.test.js -ok 957 — detectDeviceType is a Function +ok 957 — initializeNDArray is a Function -# PASS test/getScrollPosition/getScrollPosition.test.js +# PASS test\isArmstrongNumber\isArmstrongNumber.test.js -ok 958 — getScrollPosition is a Function +ok 958 — isArmstrongNumber is a Function -# PASS test/initializeNDArray/initializeNDArray.test.js +# PASS test\fibonacciUntilNum\fibonacciUntilNum.test.js -ok 959 — initializeNDArray is a Function +ok 959 — fibonacciUntilNum is a Function -# PASS test/levenshteinDistance/levenshteinDistance.test.js +# PASS test\getScrollPosition\getScrollPosition.test.js -ok 960 — levenshteinDistance is a Function +ok 960 — getScrollPosition is a Function -# PASS test/fibonacciUntilNum/fibonacciUntilNum.test.js +# PASS test\onUserInputChange\onUserInputChange.test.js -ok 961 — fibonacciUntilNum is a Function +ok 961 — onUserInputChange is a Function -# PASS test/onUserInputChange/onUserInputChange.test.js +# PASS test\observeMutations\observeMutations.test.js -ok 962 — onUserInputChange is a Function +ok 962 — observeMutations is a Function -# PASS test/speechSynthesis/speechSynthesis.test.js +# PASS test\detectDeviceType\detectDeviceType.test.js -ok 963 — speechSynthesis is a Function +ok 963 — detectDeviceType is a Function -# PASS test/observeMutations/observeMutations.test.js +# PASS test\arrayToHtmlList\arrayToHtmlList.test.js -ok 964 — observeMutations is a Function +ok 964 — arrayToHtmlList is a Function -# PASS test/arrayToHtmlList/arrayToHtmlList.test.js +# PASS test\speechSynthesis\speechSynthesis.test.js -ok 965 — arrayToHtmlList is a Function +ok 965 — speechSynthesis is a Function -# PASS test/nodeListToArray/nodeListToArray.test.js +# PASS test\copyToClipboard\copyToClipboard.test.js -ok 966 — nodeListToArray is a Function +ok 966 — copyToClipboard is a Function -# PASS test/elementContains/elementContains.test.js +# PASS test\elementContains\elementContains.test.js ok 967 — elementContains is a Function -# PASS test/copyToClipboard/copyToClipboard.test.js +# PASS test\nodeListToArray\nodeListToArray.test.js -ok 968 — copyToClipboard is a Function +ok 968 — nodeListToArray is a Function -# PASS test/createElement/createElement.test.js +# PASS test\createEventHub\createEventHub.test.js -ok 969 — createElement is a Function +ok 969 — createEventHub is a Function -# PASS test/bottomVisible/bottomVisible.test.js +# PASS test\mostPerformant\mostPerformant.test.js -ok 970 — bottomVisible is a Function +ok 970 — mostPerformant is a Function -# PASS test/mostPerformant/mostPerformant.test.js +# PASS test\createElement\createElement.test.js -ok 971 — mostPerformant is a Function +ok 971 — createElement is a Function -# PASS test/isArrayBuffer/isArrayBuffer.test.js +# PASS test\readFileLines\readFileLines.test.js -ok 972 — isArrayBuffer is a Function +ok 972 — readFileLines is a Function -# PASS test/createEventHub/createEventHub.test.js +# PASS test\httpsRedirect\httpsRedirect.test.js -ok 973 — createEventHub is a Function +ok 973 — httpsRedirect is a Function -# PASS test/httpsRedirect/httpsRedirect.test.js +# PASS test\bottomVisible\bottomVisible.test.js -ok 974 — httpsRedirect is a Function +ok 974 — bottomVisible is a Function -# PASS test/readFileLines/readFileLines.test.js +# PASS test\isArrayBuffer\isArrayBuffer.test.js -ok 975 — readFileLines is a Function +ok 975 — isArrayBuffer is a Function -# PASS test/isTypedArray/isTypedArray.test.js +# PASS test\removeVowels\removeVowels.test.js -ok 976 — isTypedArray is a Function +ok 976 — removeVowels is a Function -# PASS test/removeVowels/removeVowels.test.js +# PASS test\isTypedArray\isTypedArray.test.js -ok 977 — removeVowels is a Function +ok 977 — isTypedArray is a Function -# PASS test/howManyTimes/howManyTimes.test.js +# PASS test\howManyTimes\howManyTimes.test.js ok 978 — howManyTimes is a Function -# PASS test/smoothScroll/smoothScroll.test.js +# PASS test\smoothScroll\smoothScroll.test.js ok 979 — smoothScroll is a Function -# PASS test/insertBefore/insertBefore.test.js +# PASS test\triggerEvent\triggerEvent.test.js -ok 980 — insertBefore is a Function +ok 980 — triggerEvent is a Function -# PASS test/hashBrowser/hashBrowser.test.js +# PASS test\insertBefore\insertBefore.test.js -ok 981 — hashBrowser is a Function +ok 981 — insertBefore is a Function -# PASS test/countVowels/countVowels.test.js +# PASS test\hashBrowser\hashBrowser.test.js -ok 982 — countVowels is a Function +ok 982 — hashBrowser is a Function -# PASS test/insertAfter/insertAfter.test.js +# PASS test\scrollToTop\scrollToTop.test.js -ok 983 — insertAfter is a Function +ok 983 — scrollToTop is a Function -# PASS test/triggerEvent/triggerEvent.test.js +# PASS test\countVowels\countVowels.test.js -ok 984 — triggerEvent is a Function +ok 984 — countVowels is a Function -# PASS test/scrollToTop/scrollToTop.test.js +# PASS test\toggleClass\toggleClass.test.js -ok 985 — scrollToTop is a Function +ok 985 — toggleClass is a Function -# PASS test/toggleClass/toggleClass.test.js +# PASS test\insertAfter\insertAfter.test.js -ok 986 — toggleClass is a Function +ok 986 — insertAfter is a Function -# PASS test/isBrowser/isBrowser.test.js +# PASS test\httpDelete\httpDelete.test.js -ok 987 — isBrowser is a Function +ok 987 — httpDelete is a Function -# PASS test/currentURL/currentURL.test.js +# PASS test\JSONToDate\JSONToDate.test.js -ok 988 — currentURL is a Function +ok 988 — JSONToDate is a Function -# PASS test/timeTaken/timeTaken.test.js +# PASS test\currentURL\currentURL.test.js -ok 989 — timeTaken is a Function +ok 989 — currentURL is a Function -# PASS test/isSimilar/isSimilar.test.js +# PASS test\JSONToFile\JSONToFile.test.js -ok 990 — isSimilar is a Function +ok 990 — JSONToFile is a Function -# PASS test/isWeakSet/isWeakSet.test.js +# PASS test\isBrowser\isBrowser.test.js -ok 991 — isWeakSet is a Function +ok 991 — isBrowser is a Function -# PASS test/JSONToFile/JSONToFile.test.js +# PASS test\timeTaken\timeTaken.test.js -ok 992 — JSONToFile is a Function +ok 992 — timeTaken is a Function -# PASS test/JSONToDate/JSONToDate.test.js +# PASS test\isWeakMap\isWeakMap.test.js -ok 993 — JSONToDate is a Function +ok 993 — isWeakMap is a Function -# PASS test/isWeakMap/isWeakMap.test.js +# PASS test\isWeakSet\isWeakSet.test.js -ok 994 — isWeakMap is a Function +ok 994 — isWeakSet is a Function -# PASS test/httpDelete/httpDelete.test.js +# PASS test\isSimilar\isSimilar.test.js -ok 995 — httpDelete is a Function +ok 995 — isSimilar is a Function -# PASS test/hasClass/hasClass.test.js +# PASS test\hasClass\hasClass.test.js ok 996 — hasClass is a Function -# PASS test/getStyle/getStyle.test.js +# PASS test\setStyle\setStyle.test.js -ok 997 — getStyle is a Function +ok 997 — setStyle is a Function -# PASS test/redirect/redirect.test.js +# PASS test\getStyle\getStyle.test.js -ok 998 — redirect is a Function +ok 998 — getStyle is a Function -# PASS test/isRegExp/isRegExp.test.js +# PASS test\colorize\colorize.test.js -ok 999 — isRegExp is a Function +ok 999 — colorize is a Function -# PASS test/setStyle/setStyle.test.js +# PASS test\throttle\throttle.test.js -ok 1000 — setStyle is a Function +ok 1000 — throttle is a Function -# PASS test/hasFlags/hasFlags.test.js +# PASS test\runAsync\runAsync.test.js -ok 1001 — hasFlags is a Function +ok 1001 — runAsync is a Function -# PASS test/runAsync/runAsync.test.js +# PASS test\solveRPN\solveRPN.test.js -ok 1002 — runAsync is a Function +ok 1002 — solveRPN is a Function -# PASS test/httpPost/httpPost.test.js +# PASS test\isRegExp\isRegExp.test.js -ok 1003 — httpPost is a Function +ok 1003 — isRegExp is a Function -# PASS test/throttle/throttle.test.js +# PASS test\redirect\redirect.test.js -ok 1004 — throttle is a Function +ok 1004 — redirect is a Function -# PASS test/httpGet/httpGet.test.js +# PASS test\hasFlags\hasFlags.test.js -ok 1005 — httpGet is a Function +ok 1005 — hasFlags is a Function -# PASS test/solveRPN/solveRPN.test.js +# PASS test\counter\counter.test.js -ok 1006 — solveRPN is a Function +ok 1006 — counter is a Function -# PASS test/factors/factors.test.js +# PASS test\httpPost\httpPost.test.js -ok 1007 — factors is a Function +ok 1007 — httpPost is a Function -# PASS test/counter/counter.test.js +# PASS test\httpGet\httpGet.test.js -ok 1008 — counter is a Function +ok 1008 — httpGet is a Function -# PASS test/colorize/colorize.test.js +# PASS test\factors\factors.test.js -ok 1009 — colorize is a Function +ok 1009 — factors is a Function -# PASS test/httpPut/httpPut.test.js +# PASS test\httpPut\httpPut.test.js ok 1010 — httpPut is a Function -# PASS test/zipWith/zipWith.test.js +# PASS test\zipWith\zipWith.test.js ok 1011 — zipWith is a Function -# PASS test/isSet/isSet.test.js +# PASS test\prefix\prefix.test.js -ok 1012 — isSet is a Function +ok 1012 — prefix is a Function -# PASS test/isMap/isMap.test.js +# PASS test\toHash\toHash.test.js -ok 1013 — isMap is a Function +ok 1013 — toHash is a Function -# PASS test/defer/defer.test.js +# PASS test\isMap\isMap.test.js -ok 1014 — defer is a Function +ok 1014 — isMap is a Function -# PASS test/show/show.test.js +# PASS test\isSet\isSet.test.js -ok 1015 — show is a Function +ok 1015 — isSet is a Function -# PASS test/prefix/prefix.test.js +# PASS test\sumBy\sumBy.test.js -ok 1016 — prefix is a Function +ok 1016 — sumBy is a Function -# PASS test/toHash/toHash.test.js +# PASS test\defer\defer.test.js -ok 1017 — toHash is a Function +ok 1017 — defer is a Function -# PASS test/sumBy/sumBy.test.js +# PASS test\hide\hide.test.js -ok 1018 — sumBy is a Function +ok 1018 — hide is a Function -# PASS test/on/on.test.js +# PASS test\nest\nest.test.js -ok 1019 — on is a Function +ok 1019 — nest is a Function -# PASS test/nest/nest.test.js +# PASS test\once\once.test.js -ok 1020 — nest is a Function +ok 1020 — once is a Function -# PASS test/once/once.test.js +# PASS test\show\show.test.js -ok 1021 — once is a Function +ok 1021 — show is a Function -# PASS test/hide/hide.test.js +# PASS test\off\off.test.js -ok 1022 — hide is a Function +ok 1022 — off is a Function -# PASS test/off/off.test.js +# PASS test\on\on.test.js -ok 1023 — off is a Function +ok 1023 — on is a Function -# PASS test/hz/hz.test.js +# PASS test\hz\hz.test.js ok 1024 — hz is a Function @@ -2063,7 +2063,7 @@ ok 1024 — hz is a Function # Test Suites: 100% ██████████, 344 passed, 344 total # Tests: 100% ██████████, 1024 passed, 1024 total -# Time: 40.730s +# Time: 16.972s # Ran all test suites. diff --git a/test/throttle/throttle.js b/test/throttle/throttle.js index 5b3a0b0ec..716a2b0b6 100644 --- a/test/throttle/throttle.js +++ b/test/throttle/throttle.js @@ -1,21 +1,22 @@ const throttle = (fn, wait) => { -let inThrottle, lastFn, lastTime; -return function() { -const context = this, -args = arguments; -if (!inThrottle) { -fn.apply(context, args); -lastTime = Date.now(); -inThrottle = true; -} else { -clearTimeout(lastFn); -lastFn = setTimeout(function() { -if (Date.now() - lastTime >= wait) { -fn.apply(context, args); -lastTime = Date.now(); -} -}, wait - (Date.now() - lastTime)); -} -}; + let inThrottle, lastFn, lastTime; + return function() { + const context = this, + args = arguments; + if (!inThrottle) { + fn.apply(context, args); + lastTime = Date.now(); + inThrottle = true; + } else { + clearTimeout(lastFn); + lastFn = setTimeout(function() { + if (Date.now() - lastTime >= wait) { + fn.apply(context, args); + lastTime = Date.now(); + } + }, wait - (Date.now() - lastTime)); + } + }; }; + module.exports = throttle; \ No newline at end of file diff --git a/test/timeTaken/timeTaken.js b/test/timeTaken/timeTaken.js index 126533ef7..1ae4f8142 100644 --- a/test/timeTaken/timeTaken.js +++ b/test/timeTaken/timeTaken.js @@ -1,7 +1,8 @@ const timeTaken = callback => { -console.time('timeTaken'); -const r = callback(); -console.timeEnd('timeTaken'); -return r; + console.time('timeTaken'); + const r = callback(); + console.timeEnd('timeTaken'); + return r; }; + module.exports = timeTaken; \ No newline at end of file diff --git a/test/times/times.js b/test/times/times.js index 2c1f71c94..e5ba840d9 100644 --- a/test/times/times.js +++ b/test/times/times.js @@ -1,5 +1,6 @@ const times = (n, fn, context = undefined) => { -let i = 0; -while (fn.call(context, i) !== false && ++i < n) {} + let i = 0; + while (fn.call(context, i) !== false && ++i < n) {} }; + module.exports = times; \ No newline at end of file diff --git a/test/toCamelCase/toCamelCase.js b/test/toCamelCase/toCamelCase.js index 2e396c7c1..cd5a861bf 100644 --- a/test/toCamelCase/toCamelCase.js +++ b/test/toCamelCase/toCamelCase.js @@ -1,10 +1,11 @@ const toCamelCase = str => { -let s = -str && -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.slice(0, 1).toUpperCase() + x.slice(1).toLowerCase()) -.join(''); -return s.slice(0, 1).toLowerCase() + s.slice(1); + let s = + str && + 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.slice(0, 1).toUpperCase() + x.slice(1).toLowerCase()) + .join(''); + return s.slice(0, 1).toLowerCase() + s.slice(1); }; + module.exports = toCamelCase; \ No newline at end of file diff --git a/test/toCurrency/toCurrency.js b/test/toCurrency/toCurrency.js index b7e12c4ca..5d2685375 100644 --- a/test/toCurrency/toCurrency.js +++ b/test/toCurrency/toCurrency.js @@ -1,3 +1,4 @@ const toCurrency = (n, curr, LanguageFormat = undefined) => -Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n); + Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n); + module.exports = toCurrency; \ No newline at end of file diff --git a/test/toDecimalMark/toDecimalMark.js b/test/toDecimalMark/toDecimalMark.js index 100b300a6..4f3401aa4 100644 --- a/test/toDecimalMark/toDecimalMark.js +++ b/test/toDecimalMark/toDecimalMark.js @@ -1,2 +1,3 @@ const toDecimalMark = num => num.toLocaleString('en-US'); + module.exports = toDecimalMark; \ No newline at end of file diff --git a/test/toHash/toHash.js b/test/toHash/toHash.js index 9e86342f1..e9ceae4af 100644 --- a/test/toHash/toHash.js +++ b/test/toHash/toHash.js @@ -1,7 +1,8 @@ const toHash = (object, key) => -Array.prototype.reduce.call( -object, -(acc, data, index) => ((acc[!key ? index : data[key]] = data), acc), -{} -); + Array.prototype.reduce.call( + object, + (acc, data, index) => ((acc[!key ? index : data[key]] = data), acc), + {} + ); + module.exports = toHash; \ No newline at end of file diff --git a/test/toKebabCase/toKebabCase.js b/test/toKebabCase/toKebabCase.js index c4de1c3bf..2a80c63c2 100644 --- a/test/toKebabCase/toKebabCase.js +++ b/test/toKebabCase/toKebabCase.js @@ -1,7 +1,8 @@ const toKebabCase = str => -str && -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('-'); + str && + 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 diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.js b/test/toOrdinalSuffix/toOrdinalSuffix.js index 8efc575fb..f6e32c976 100644 --- a/test/toOrdinalSuffix/toOrdinalSuffix.js +++ b/test/toOrdinalSuffix/toOrdinalSuffix.js @@ -1,11 +1,12 @@ const toOrdinalSuffix = num => { -const int = parseInt(num), -digits = [int % 10, int % 100], -ordinals = ['st', 'nd', 'rd', 'th'], -oPattern = [1, 2, 3, 4], -tPattern = [11, 12, 13, 14, 15, 16, 17, 18, 19]; -return oPattern.includes(digits[0]) && !tPattern.includes(digits[1]) -? int + ordinals[digits[0] - 1] -: int + ordinals[3]; + const int = parseInt(num), + digits = [int % 10, int % 100], + ordinals = ['st', 'nd', 'rd', 'th'], + oPattern = [1, 2, 3, 4], + tPattern = [11, 12, 13, 14, 15, 16, 17, 18, 19]; + 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 diff --git a/test/toSafeInteger/toSafeInteger.js b/test/toSafeInteger/toSafeInteger.js index f162e6167..9e54b2f4c 100644 --- a/test/toSafeInteger/toSafeInteger.js +++ b/test/toSafeInteger/toSafeInteger.js @@ -1,3 +1,4 @@ const toSafeInteger = num => -Math.round(Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER)); + Math.round(Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER)); + module.exports = toSafeInteger; \ No newline at end of file diff --git a/test/toSnakeCase/toSnakeCase.js b/test/toSnakeCase/toSnakeCase.js index 2990ea732..8f9d78803 100644 --- a/test/toSnakeCase/toSnakeCase.js +++ b/test/toSnakeCase/toSnakeCase.js @@ -1,7 +1,8 @@ const toSnakeCase = str => -str && -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('_'); + str && + 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 diff --git a/test/toggleClass/toggleClass.js b/test/toggleClass/toggleClass.js index 1ce2b663c..5c34eec24 100644 --- a/test/toggleClass/toggleClass.js +++ b/test/toggleClass/toggleClass.js @@ -1,2 +1,3 @@ const toggleClass = (el, className) => el.classList.toggle(className); + module.exports = toggleClass; \ No newline at end of file diff --git a/test/tomorrow/tomorrow.js b/test/tomorrow/tomorrow.js index d177e0f9a..1643aa3d0 100644 --- a/test/tomorrow/tomorrow.js +++ b/test/tomorrow/tomorrow.js @@ -1,9 +1,10 @@ const tomorrow = (long = false) => { -let t = new Date(); -t.setDate(t.getDate() + 1); -const ret = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String( -t.getDate() -).padStart(2, '0')}`; -return !long ? ret : `${ret}T00:00:00`; + let t = new Date(); + t.setDate(t.getDate() + 1); + const ret = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String( + t.getDate() + ).padStart(2, '0')}`; + return !long ? ret : `${ret}T00:00:00`; }; + module.exports = tomorrow; \ No newline at end of file diff --git a/test/transform/transform.js b/test/transform/transform.js index 64d62fd28..44f10f3fd 100644 --- a/test/transform/transform.js +++ b/test/transform/transform.js @@ -1,2 +1,3 @@ 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 diff --git a/test/triggerEvent/triggerEvent.js b/test/triggerEvent/triggerEvent.js index d6bcf2ebf..24d4d46bf 100644 --- a/test/triggerEvent/triggerEvent.js +++ b/test/triggerEvent/triggerEvent.js @@ -1,3 +1,4 @@ const triggerEvent = (el, eventType, detail = undefined) => -el.dispatchEvent(new CustomEvent(eventType, { detail: detail })); + el.dispatchEvent(new CustomEvent(eventType, { detail: detail })); + module.exports = triggerEvent; \ No newline at end of file diff --git a/test/truncateString/truncateString.js b/test/truncateString/truncateString.js index 83977ca52..495431aa3 100644 --- a/test/truncateString/truncateString.js +++ b/test/truncateString/truncateString.js @@ -1,3 +1,4 @@ const truncateString = (str, num) => -str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; + str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; + module.exports = truncateString; \ No newline at end of file diff --git a/test/truthCheckCollection/truthCheckCollection.js b/test/truthCheckCollection/truthCheckCollection.js index 71b660f77..88ec49189 100644 --- a/test/truthCheckCollection/truthCheckCollection.js +++ b/test/truthCheckCollection/truthCheckCollection.js @@ -1,2 +1,3 @@ const truthCheckCollection = (collection, pre) => collection.every(obj => obj[pre]); + module.exports = truthCheckCollection; \ No newline at end of file diff --git a/test/unary/unary.js b/test/unary/unary.js index 7930f086d..a177a851f 100644 --- a/test/unary/unary.js +++ b/test/unary/unary.js @@ -1,2 +1,3 @@ const unary = fn => val => fn(val); + module.exports = unary; \ No newline at end of file diff --git a/test/uncurry/uncurry.js b/test/uncurry/uncurry.js index a926982d5..b68dceb59 100644 --- a/test/uncurry/uncurry.js +++ b/test/uncurry/uncurry.js @@ -1,6 +1,7 @@ const uncurry = (fn, n = 1) => (...args) => { -const next = acc => args => args.reduce((x, y) => x(y), acc); -if (n > args.length) throw new RangeError('Arguments too few!'); -return next(fn)(args.slice(0, n)); + const next = acc => args => args.reduce((x, y) => x(y), acc); + if (n > args.length) throw new RangeError('Arguments too few!'); + return next(fn)(args.slice(0, n)); }; + module.exports = uncurry; \ No newline at end of file diff --git a/test/unescapeHTML/unescapeHTML.js b/test/unescapeHTML/unescapeHTML.js index 4f5ffe3dd..9e01cb8be 100644 --- a/test/unescapeHTML/unescapeHTML.js +++ b/test/unescapeHTML/unescapeHTML.js @@ -1,13 +1,14 @@ const unescapeHTML = str => -str.replace( -/&|<|>|'|"/g, -tag => -({ -'&': '&', -'<': '<', -'>': '>', -''': "'", -'"': '"' -}[tag] || tag) -); + str.replace( + /&|<|>|'|"/g, + tag => + ({ + '&': '&', + '<': '<', + '>': '>', + ''': "'", + '"': '"' + }[tag] || tag) + ); + module.exports = unescapeHTML; \ No newline at end of file diff --git a/test/unflattenObject/unflattenObject.js b/test/unflattenObject/unflattenObject.js index b0b4f48ba..c34f43e58 100644 --- a/test/unflattenObject/unflattenObject.js +++ b/test/unflattenObject/unflattenObject.js @@ -1,17 +1,18 @@ const unflattenObject = obj => -Object.keys(obj).reduce((acc, k) => { -if (k.indexOf('.') !== -1) { -const keys = k.split('.'); -Object.assign( -acc, -JSON.parse( -'{' + -keys.map((v, i) => (i !== keys.length - 1 ? `"${v}":{` : `"${v}":`)).join('') + -obj[k] + -'}'.repeat(keys.length) -) -); -} else acc[k] = obj[k]; -return acc; -}, {}); + Object.keys(obj).reduce((acc, k) => { + if (k.indexOf('.') !== -1) { + const keys = k.split('.'); + Object.assign( + acc, + JSON.parse( + '{' + + keys.map((v, i) => (i !== keys.length - 1 ? `"${v}":{` : `"${v}":`)).join('') + + obj[k] + + '}'.repeat(keys.length) + ) + ); + } else acc[k] = obj[k]; + return acc; + }, {}); + module.exports = unflattenObject; \ No newline at end of file diff --git a/test/unfold/unfold.js b/test/unfold/unfold.js index 597ebcf9c..45cc27f60 100644 --- a/test/unfold/unfold.js +++ b/test/unfold/unfold.js @@ -1,7 +1,8 @@ const unfold = (fn, seed) => { -let result = [], -val = [null, seed]; -while ((val = fn(val[1]))) result.push(val[0]); -return result; + let result = [], + val = [null, seed]; + while ((val = fn(val[1]))) result.push(val[0]); + return result; }; + module.exports = unfold; \ No newline at end of file diff --git a/test/union/union.js b/test/union/union.js index 958406de8..2bd3845fd 100644 --- a/test/union/union.js +++ b/test/union/union.js @@ -1,2 +1,3 @@ const union = (a, b) => Array.from(new Set([...a, ...b])); + module.exports = union; \ No newline at end of file diff --git a/test/unionBy/unionBy.js b/test/unionBy/unionBy.js index 09ae1f579..49506e32a 100644 --- a/test/unionBy/unionBy.js +++ b/test/unionBy/unionBy.js @@ -1,5 +1,6 @@ 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)))])); + 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/unionWith/unionWith.js b/test/unionWith/unionWith.js index c498e8d28..a2ac685b4 100644 --- a/test/unionWith/unionWith.js +++ b/test/unionWith/unionWith.js @@ -1,3 +1,4 @@ const unionWith = (a, b, comp) => -Array.from(new Set([...a, ...b.filter(x => a.findIndex(y => comp(x, y)) === -1)])); + 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/uniqueElements/uniqueElements.js b/test/uniqueElements/uniqueElements.js index ef789d0fd..bf626d44b 100644 --- a/test/uniqueElements/uniqueElements.js +++ b/test/uniqueElements/uniqueElements.js @@ -1,2 +1,3 @@ const uniqueElements = arr => [...new Set(arr)]; + module.exports = uniqueElements; \ No newline at end of file diff --git a/test/uniqueElementsBy/uniqueElementsBy.js b/test/uniqueElementsBy/uniqueElementsBy.js index 60634739e..1005aa169 100644 --- a/test/uniqueElementsBy/uniqueElementsBy.js +++ b/test/uniqueElementsBy/uniqueElementsBy.js @@ -1,6 +1,7 @@ const uniqueElementsBy = (arr, fn) => -arr.reduce((acc, v) => { -if (!acc.some(x => fn(v, x))) acc.push(v); -return acc; -}, []); + arr.reduce((acc, v) => { + if (!acc.some(x => fn(v, x))) acc.push(v); + return acc; + }, []); + module.exports = uniqueElementsBy; \ No newline at end of file diff --git a/test/uniqueElementsByRight/uniqueElementsByRight.js b/test/uniqueElementsByRight/uniqueElementsByRight.js index 3b6975a4b..79764d861 100644 --- a/test/uniqueElementsByRight/uniqueElementsByRight.js +++ b/test/uniqueElementsByRight/uniqueElementsByRight.js @@ -1,6 +1,7 @@ const uniqueElementsByRight = (arr, fn) => -arr.reduceRight((acc, v) => { -if (!acc.some(x => fn(v, x))) acc.push(v); -return acc; -}, []); + arr.reduceRight((acc, v) => { + if (!acc.some(x => fn(v, x))) acc.push(v); + return acc; + }, []); + module.exports = uniqueElementsByRight; \ No newline at end of file diff --git a/test/untildify/untildify.js b/test/untildify/untildify.js index aeef31c50..dbbf08975 100644 --- a/test/untildify/untildify.js +++ b/test/untildify/untildify.js @@ -1,2 +1,3 @@ const untildify = str => str.replace(/^~($|\/|\\)/, `${require('os').homedir()}$1`); + module.exports = untildify; \ No newline at end of file diff --git a/test/unzip/unzip.js b/test/unzip/unzip.js index 69c0a0312..cc0661a2e 100644 --- a/test/unzip/unzip.js +++ b/test/unzip/unzip.js @@ -1,8 +1,9 @@ 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 => []) -); + 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/unzipWith/unzipWith.js b/test/unzipWith/unzipWith.js index 6acbabf87..4b9b595d0 100644 --- a/test/unzipWith/unzipWith.js +++ b/test/unzipWith/unzipWith.js @@ -1,10 +1,11 @@ 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)); + 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/validateNumber/validateNumber.js b/test/validateNumber/validateNumber.js index 9d96fb7fe..3cbd62d91 100644 --- a/test/validateNumber/validateNumber.js +++ b/test/validateNumber/validateNumber.js @@ -1,2 +1,3 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n; + module.exports = validateNumber; \ No newline at end of file diff --git a/test/when/when.js b/test/when/when.js index 7613aed9b..555ddefd2 100644 --- a/test/when/when.js +++ b/test/when/when.js @@ -1,2 +1,3 @@ const when = (pred, whenTrue) => x => (pred(x) ? whenTrue(x) : x); + module.exports = when; \ No newline at end of file diff --git a/test/without/without.js b/test/without/without.js index c05181cbf..e21464463 100644 --- a/test/without/without.js +++ b/test/without/without.js @@ -1,2 +1,3 @@ const without = (arr, ...args) => arr.filter(v => !args.includes(v)); + module.exports = without; \ No newline at end of file diff --git a/test/words/words.js b/test/words/words.js index 676be35c7..89c98dd0a 100644 --- a/test/words/words.js +++ b/test/words/words.js @@ -1,2 +1,3 @@ const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean); + module.exports = words; \ No newline at end of file diff --git a/test/xProd/xProd.js b/test/xProd/xProd.js index fc4123ef5..2cf81762f 100644 --- a/test/xProd/xProd.js +++ b/test/xProd/xProd.js @@ -1,2 +1,3 @@ const xProd = (a, b) => a.reduce((acc, x) => acc.concat(b.map(y => [x, y])), []); + module.exports = xProd; \ No newline at end of file diff --git a/test/yesNo/yesNo.js b/test/yesNo/yesNo.js index 83bbe99ae..560d22a24 100644 --- a/test/yesNo/yesNo.js +++ b/test/yesNo/yesNo.js @@ -1,3 +1,4 @@ const yesNo = (val, def = false) => -/^(y|yes)$/i.test(val) ? true : /^(n|no)$/i.test(val) ? false : def; + /^(y|yes)$/i.test(val) ? true : /^(n|no)$/i.test(val) ? false : def; + module.exports = yesNo; \ No newline at end of file diff --git a/test/zip/zip.js b/test/zip/zip.js index 54a162bce..bb22b7e36 100644 --- a/test/zip/zip.js +++ b/test/zip/zip.js @@ -1,7 +1,8 @@ const zip = (...arrays) => { -const maxLength = Math.max(...arrays.map(x => x.length)); -return Array.from({ length: maxLength }).map((_, i) => { -return Array.from({ length: arrays.length }, (_, k) => arrays[k][i]); -}); + const maxLength = Math.max(...arrays.map(x => x.length)); + 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 diff --git a/test/zipObject/zipObject.js b/test/zipObject/zipObject.js index c44e95eda..bc6fa882e 100644 --- a/test/zipObject/zipObject.js +++ b/test/zipObject/zipObject.js @@ -1,3 +1,4 @@ const zipObject = (props, values) => -props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); + props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); + module.exports = zipObject; \ No newline at end of file diff --git a/test/zipWith/zipWith.js b/test/zipWith/zipWith.js index ca6af080c..c142ff1f8 100644 --- a/test/zipWith/zipWith.js +++ b/test/zipWith/zipWith.js @@ -1,8 +1,9 @@ const zipWith = (...array) => { -const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined; -return Array.from( -{ length: Math.max(...array.map(a => a.length)) }, -(_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])) -); + const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined; + return Array.from( + { length: Math.max(...array.map(a => a.length)) }, + (_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])) + ); }; + module.exports = zipWith; \ No newline at end of file