From 477716189ac4a56557884ed524e3a9f695d7445e Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 10 Oct 2018 20:27:39 +0300 Subject: [PATCH 1/5] Merged module and rollup In reference to #816 --- scripts/module.js | 135 +++++++++++++++++++++++++++++----------------- scripts/rollup.js | 56 ------------------- 2 files changed, 85 insertions(+), 106 deletions(-) delete mode 100644 scripts/rollup.js diff --git a/scripts/module.js b/scripts/module.js index 87ab15fa4..be0d98c02 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -3,10 +3,13 @@ */ // Load modules const fs = require('fs-extra'); -const cp = require('child_process'); const path = require('path'); const chalk = require('chalk'); const util = require('./util'); +const { rollup } = require('rollup'); +const babel = require('rollup-plugin-babel'); +const minify = require('rollup-plugin-babel-minify'); +// Check Travis builds - needs some extra work if (util.isTravisCI() && util.isNotTravisCronOrAPI()) { console.log( `${chalk.green('NOBUILD')} Module build terminated, not a cron job or a custom build!` @@ -15,60 +18,92 @@ if (util.isTravisCI() && util.isNotTravisCronOrAPI()) { } // Set variables for paths const SNIPPETS_PATH = './snippets'; +const SNIPPETS_ARCHIVE_PATH = './snippets_archive'; const TEMP_PATH = './temp'; const IMPORTS = './imports.js'; +const MODULE_NAME = '_30s'; +const DIST = './dist'; // Regex for selecting code blocks const codeRE = /```\s*js([\s\S]*?)```/; -// Start the timer of the script -console.time('Packager'); -// Load tag data from the database and snippets from their folder -try { - const tagDatabase = fs.readFileSync('tag_database', 'utf8'); - const snippets = fs.readdirSync(SNIPPETS_PATH); - // Create `temp` folder if it doesn't already exist. - if (!fs.existsSync(TEMP_PATH)) { - fs.mkdirSync(TEMP_PATH); - } - // Write `imports.js` - fs.writeFileSync(IMPORTS, ''); - // Read all snippets and store them appropriately - for (const snippet of snippets) { - const snippetData = fs.readFileSync(path.join(SNIPPETS_PATH, snippet), 'utf8'); - const snippetName = snippet.replace('.md', ''); - // Check if a snippet is Node-only - const isNodeSnippet = tagDatabase - .slice(tagDatabase.indexOf(snippetName) + snippetName.length + 1) - .split('\n')[0] - .includes('node'); - // Read `imports.js` and write the data - const importData = fs.readFileSync(IMPORTS, 'utf8'); - fs.writeFileSync( - IMPORTS, - importData + `\nexport { ${snippetName} } from './temp/${snippetName}.js'` - ); - // Find the code in each snippet - const code = snippetData.match(codeRE)[1].replace('\n', ''); - // Store the data to be written - const toWrite = isNodeSnippet - ? `${code +// Read snippets, build packages +(async () => { + // Start the timer of the script + console.time('Packager'); + try { + const tagDatabase = fs.readFileSync('tag_database', 'utf8'); + const nodeSnippets = tagDatabase.split('\n').filter(v => v.search(/:.*node/g) !== -1).map(v => v.slice(0,v.indexOf(':'))); + const snippets = fs.readdirSync(SNIPPETS_PATH); + const archivedSnippets = fs.readdirSync(SNIPPETS_ARCHIVE_PATH); + // Create `temp` and `dist` folders if they don't already exist. + if (!fs.existsSync(TEMP_PATH)) fs.mkdirSync(TEMP_PATH); + if (!fs.existsSync(DIST)) fs.mkdirSync(DIST); + // Write `imports.js` + fs.writeFileSync(IMPORTS, ''); + + snippets.forEach(snippet => { + const snippetData = fs.readFileSync(path.join(SNIPPETS_PATH, snippet), 'utf8'); + const snippetName = snippet.replace('.md', ''); + const code = snippetData.match(codeRE)[1].replace('\n', ''); + const toWrite = nodeSnippets.includes(snippetName) + ? `${code .replace(`const ${snippetName}`, `export const ${snippetName}`) // Prevents errors from being thrown in browser environment .replace('require(', 'typeof require !== "undefined" && require(')}` - : `export ${code}`; - // Write data to the proper file - fs.writeFileSync(`${TEMP_PATH}/${snippetName}.js`, toWrite); + : `export ${code}`; + // Write data to file and append to the imports file + fs.writeFileSync(`${TEMP_PATH}/${snippetName}.js`, toWrite); + fs.appendFileSync(IMPORTS, `\nexport { ${snippetName} } from './temp/${snippetName}.js'`); + }) + + // Write to the proper files and start the `rollup` script + const es5 = babel({ + presets: ['@babel/preset-env'] + }); + const min = minify({ comments: false }); + const bundle = await rollup({ input: IMPORTS }); + const bundleES5 = await rollup({ input: IMPORTS, plugins: [es5] }); + const bundleES5Min = await rollup({ + input: IMPORTS, + plugins: [es5, min] + }); + // UMD ES2018 + await bundle.write({ + file: `${DIST}/${MODULE_NAME}.js`, + name: MODULE_NAME, + format: 'umd' + }); + + // ESM ES2018 + await bundle.write({ + file: `${DIST}/${MODULE_NAME}.esm.js`, + name: MODULE_NAME, + format: 'es' + }); + + // UMD ES5 + await bundleES5.write({ + file: `${DIST}/${MODULE_NAME}.es5.js`, + name: MODULE_NAME, + format: 'umd' + }); + + // UMD ES5 min + await bundleES5Min.write({ + file: `${DIST}/${MODULE_NAME}.es5.min.js`, + name: MODULE_NAME, + format: 'umd' + }); + + // Clean up temporary data + fs.removeSync(TEMP_PATH); + fs.unlink(IMPORTS); + // Log a success message + console.log(`${chalk.green('SUCCESS!')} Snippet module built!`); + // Log the time taken + console.timeEnd('Packager'); + } catch (err) { + // Handle errors (hopefully not!) + console.log(`${chalk.red('ERROR!')} During module creation: ${err}`); + process.exit(1); } - // Write to the proper files and start the `rollup` script - cp.execSync('node ./scripts/rollup.js'); - // Clean up temporary data - fs.removeSync(TEMP_PATH); - fs.unlink(IMPORTS); - // Log a success message - console.log(`${chalk.green('SUCCESS!')} Snippet module built!`); - // Log the time taken - console.timeEnd('Packager'); -} catch (err) { - // Handle errors (hopefully not!) - console.log(`${chalk.red('ERROR!')} During module creation: ${err}`); - process.exit(1); -} +})(); \ No newline at end of file diff --git a/scripts/rollup.js b/scripts/rollup.js deleted file mode 100644 index f7a349165..000000000 --- a/scripts/rollup.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - Part of the process for building the `_30s` module. -*/ -// Load modules -const fs = require('fs-extra'); -const { rollup } = require('rollup'); -const babel = require('rollup-plugin-babel'); -const minify = require('rollup-plugin-babel-minify'); -// Set variables for paths -const INPUT_FILE = './imports.js'; -const MODULE_NAME = '_30s'; -const DIST = './dist'; -// Create `dist` folder if not existing -if (!fs.existsSync(DIST)) fs.mkdirSync(DIST); -// Setup babel and minification -const es5 = babel({ - presets: ['@babel/preset-env'] -}); -const min = minify({ comments: false }); -// Create the bundles -(async () => { - const bundle = await rollup({ input: INPUT_FILE }); - const bundleES5 = await rollup({ input: INPUT_FILE, plugins: [es5] }); - const bundleES5Min = await rollup({ - input: INPUT_FILE, - plugins: [es5, min] - }); - - // UMD ES2018 - await bundle.write({ - file: `${DIST}/${MODULE_NAME}.js`, - name: MODULE_NAME, - format: 'umd' - }); - - // ESM ES2018 - await bundle.write({ - file: `${DIST}/${MODULE_NAME}.esm.js`, - name: MODULE_NAME, - format: 'es' - }); - - // UMD ES5 - await bundleES5.write({ - file: `${DIST}/${MODULE_NAME}.es5.js`, - name: MODULE_NAME, - format: 'umd' - }); - - // UMD ES5 min - await bundleES5Min.write({ - file: `${DIST}/${MODULE_NAME}.es5.min.js`, - name: MODULE_NAME, - format: 'umd' - }); -})(); From de5c24210a9b28bb2ebe54893c36a6a9036e1680 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 10 Oct 2018 20:54:04 +0300 Subject: [PATCH 2/5] Update module.js to cut down I/O operations --- scripts/module.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/module.js b/scripts/module.js index be0d98c02..4eeaf3b1c 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -33,6 +33,9 @@ const codeRE = /```\s*js([\s\S]*?)```/; const tagDatabase = fs.readFileSync('tag_database', 'utf8'); const nodeSnippets = tagDatabase.split('\n').filter(v => v.search(/:.*node/g) !== -1).map(v => v.slice(0,v.indexOf(':'))); const snippets = fs.readdirSync(SNIPPETS_PATH); + const snippetExports = `module.exports = {${snippets.map(v => v.replace('.md', '')).join(',')}}`; + let requires = []; + let importData = ''; const archivedSnippets = fs.readdirSync(SNIPPETS_ARCHIVE_PATH); // Create `temp` and `dist` folders if they don't already exist. if (!fs.existsSync(TEMP_PATH)) fs.mkdirSync(TEMP_PATH); @@ -43,17 +46,16 @@ const codeRE = /```\s*js([\s\S]*?)```/; snippets.forEach(snippet => { const snippetData = fs.readFileSync(path.join(SNIPPETS_PATH, snippet), 'utf8'); const snippetName = snippet.replace('.md', ''); - const code = snippetData.match(codeRE)[1].replace('\n', ''); - const toWrite = nodeSnippets.includes(snippetName) - ? `${code - .replace(`const ${snippetName}`, `export const ${snippetName}`) - // Prevents errors from being thrown in browser environment - .replace('require(', 'typeof require !== "undefined" && require(')}` - : `export ${code}`; - // Write data to file and append to the imports file - fs.writeFileSync(`${TEMP_PATH}/${snippetName}.js`, toWrite); - fs.appendFileSync(IMPORTS, `\nexport { ${snippetName} } from './temp/${snippetName}.js'`); - }) + let code = snippetData.match(codeRE)[1].replace('\n', ''); + if (nodeSnippets.includes(snippetName)) { + requires.push(code.match(/const.*=.*require\(([^\)]*)\);/g)); + code = code.replace(/const.*=.*require\(([^\)]*)\);/g,''); + } + importData += code; + }); + // Write the data to the imports file + requires = [...new Set(requires.filter(Boolean).map(v => v[0].replace('require(', 'typeof require !== "undefined" && require(')))].join('\n'); + fs.writeFileSync(IMPORTS, `${requires}\n\n${importData}\n\n${snippetExports}`) // Write to the proper files and start the `rollup` script const es5 = babel({ From f4981115f57bab96faa8f7548bf4cfd2719493f0 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 10 Oct 2018 21:03:07 +0300 Subject: [PATCH 3/5] Removed temp folder from the module builder --- scripts/module.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/module.js b/scripts/module.js index 4eeaf3b1c..81704885b 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -19,7 +19,6 @@ if (util.isTravisCI() && util.isNotTravisCronOrAPI()) { // Set variables for paths const SNIPPETS_PATH = './snippets'; const SNIPPETS_ARCHIVE_PATH = './snippets_archive'; -const TEMP_PATH = './temp'; const IMPORTS = './imports.js'; const MODULE_NAME = '_30s'; const DIST = './dist'; @@ -38,7 +37,6 @@ const codeRE = /```\s*js([\s\S]*?)```/; let importData = ''; const archivedSnippets = fs.readdirSync(SNIPPETS_ARCHIVE_PATH); // Create `temp` and `dist` folders if they don't already exist. - if (!fs.existsSync(TEMP_PATH)) fs.mkdirSync(TEMP_PATH); if (!fs.existsSync(DIST)) fs.mkdirSync(DIST); // Write `imports.js` fs.writeFileSync(IMPORTS, ''); @@ -97,7 +95,6 @@ const codeRE = /```\s*js([\s\S]*?)```/; }); // Clean up temporary data - fs.removeSync(TEMP_PATH); fs.unlink(IMPORTS); // Log a success message console.log(`${chalk.green('SUCCESS!')} Snippet module built!`); From 099b3d5aa62cb2492910f2c556184038e87fd966 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 10 Oct 2018 22:30:10 +0300 Subject: [PATCH 4/5] Updated packager for test builds --- scripts/module.js | 48 +- scripts/util.js | 6 +- test/_30s.js | 1484 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1517 insertions(+), 21 deletions(-) create mode 100644 test/_30s.js diff --git a/scripts/module.js b/scripts/module.js index 81704885b..e13e71001 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -9,17 +9,11 @@ const util = require('./util'); const { rollup } = require('rollup'); const babel = require('rollup-plugin-babel'); const minify = require('rollup-plugin-babel-minify'); -// Check Travis builds - needs some extra work -if (util.isTravisCI() && util.isNotTravisCronOrAPI()) { - console.log( - `${chalk.green('NOBUILD')} Module build terminated, not a cron job or a custom build!` - ); - process.exit(0); -} // Set variables for paths const SNIPPETS_PATH = './snippets'; const SNIPPETS_ARCHIVE_PATH = './snippets_archive'; const IMPORTS = './imports.js'; +const TEST_PACKAGE = './test/_30s.js'; const MODULE_NAME = '_30s'; const DIST = './dist'; // Regex for selecting code blocks @@ -35,11 +29,13 @@ const codeRE = /```\s*js([\s\S]*?)```/; const snippetExports = `module.exports = {${snippets.map(v => v.replace('.md', '')).join(',')}}`; let requires = []; let importData = ''; - const archivedSnippets = fs.readdirSync(SNIPPETS_ARCHIVE_PATH); + const archivedSnippets = fs.readdirSync(SNIPPETS_ARCHIVE_PATH).filter(v => v !== 'README.md'); + const testExports = `module.exports = {${[...snippets,...archivedSnippets].map(v => v.replace('.md', '')).join(',')}}`; // Create `temp` and `dist` folders if they don't already exist. if (!fs.existsSync(DIST)) fs.mkdirSync(DIST); // Write `imports.js` fs.writeFileSync(IMPORTS, ''); + fs.writeFileSync(TEST_PACKAGE, ''); snippets.forEach(snippet => { const snippetData = fs.readFileSync(path.join(SNIPPETS_PATH, snippet), 'utf8'); @@ -53,41 +49,55 @@ const codeRE = /```\s*js([\s\S]*?)```/; }); // Write the data to the imports file requires = [...new Set(requires.filter(Boolean).map(v => v[0].replace('require(', 'typeof require !== "undefined" && require(')))].join('\n'); - fs.writeFileSync(IMPORTS, `${requires}\n\n${importData}\n\n${snippetExports}`) - + fs.writeFileSync(IMPORTS, `${requires}\n\n${importData}\n\n${snippetExports}`); + + archivedSnippets.forEach(snippet => { + const snippetData = fs.readFileSync(path.join(SNIPPETS_ARCHIVE_PATH, snippet), 'utf8'); + let code = snippetData.match(codeRE)[1].replace('\n', ''); + importData += code; + }); + fs.writeFileSync(TEST_PACKAGE, `${requires}\n\n${importData}\n\n${testExports}`); + + // Check Travis builds - Will skip builds on Travis if not CRON/API + if (!util.isTravisCI() && util.isNotTravisCronOrAPI()) { + fs.unlink(IMPORTS); + console.log( + `${chalk.green('NOBUILD')} Module build terminated, not a cron job or a custom build!` + ); + console.timeEnd('Packager'); + process.exit(0); + } + // Write to the proper files and start the `rollup` script const es5 = babel({ presets: ['@babel/preset-env'] }); const min = minify({ comments: false }); const bundle = await rollup({ input: IMPORTS }); - const bundleES5 = await rollup({ input: IMPORTS, plugins: [es5] }); - const bundleES5Min = await rollup({ - input: IMPORTS, - plugins: [es5, min] - }); // UMD ES2018 await bundle.write({ file: `${DIST}/${MODULE_NAME}.js`, name: MODULE_NAME, format: 'umd' }); - // ESM ES2018 await bundle.write({ file: `${DIST}/${MODULE_NAME}.esm.js`, name: MODULE_NAME, format: 'es' - }); - + }); // UMD ES5 + const bundleES5 = await rollup({ input: IMPORTS, plugins: [es5] }); await bundleES5.write({ file: `${DIST}/${MODULE_NAME}.es5.js`, name: MODULE_NAME, format: 'umd' }); - // UMD ES5 min + const bundleES5Min = await rollup({ + input: IMPORTS, + plugins: [es5, min] + }); await bundleES5Min.write({ file: `${DIST}/${MODULE_NAME}.es5.min.js`, name: MODULE_NAME, diff --git a/scripts/util.js b/scripts/util.js index 538758603..def8209ff 100644 --- a/scripts/util.js +++ b/scripts/util.js @@ -102,8 +102,9 @@ const capitalize = (str, lowerRest = false) => str.slice(0, 1).toUpperCase() + (lowerRest ? str.slice(1).toLowerCase() : str.slice(1)); // Checks if current environment is Travis CI const isTravisCI = () => 'TRAVIS' in process.env && 'CI' in process.env; -const isNotTravisCronOrAPI = () => - process.env['TRAVIS_EVENT_TYPE'] !== 'cron' && process.env['TRAVIS_EVENT_TYPE'] !== 'api'; +const isTravisCronOrAPI = () => + process.env['TRAVIS_EVENT_TYPE'] === 'cron' && process.env['TRAVIS_EVENT_TYPE'] === 'api'; +const isNotTravisCronOrAPI = () => !isTravisCronOrAPI(); // Creates a hash for a value using the SHA-256 algorithm. const hashData = val => crypto @@ -164,6 +165,7 @@ module.exports = { shuffle, getCodeBlocks, getTextualContent, + isTravisCronOrAPI, isNotTravisCronOrAPI, prepTaggedData }; diff --git a/test/_30s.js b/test/_30s.js new file mode 100644 index 000000000..f27af434f --- /dev/null +++ b/test/_30s.js @@ -0,0 +1,1484 @@ +const crypto = typeof require !== "undefined" && require('crypto'); +const fs = typeof require !== "undefined" && require('fs'); + +const all = (arr, fn = Boolean) => arr.every(fn); +const allEqual = arr => arr.every(val => val === arr[0]); +const any = (arr, fn = Boolean) => arr.some(fn); +const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon; +const arrayToCSV = (arr, delimiter = ',') => + arr.map(v => v.map(x => `"${x}"`).join(delimiter)).join('\n'); +const arrayToHtmlList = (arr, listID) => + (el => ( + (el = document.querySelector('#' + listID)), + (el.innerHTML += arr.map(item => `
  • ${item}
  • `).join('')) + ))(); +const ary = (fn, n) => (...args) => fn(...args.slice(0, n)); + const atob = str => Buffer.from(str, 'base64').toString('binary'); +const attempt = (fn, ...args) => { + try { + return fn(...args); + } catch (e) { + return e instanceof Error ? e : new Error(e); + } +}; +const average = (...nums) => nums.reduce((acc, val) => acc + val, 0) / nums.length; +const averageBy = (arr, fn) => + arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0) / + arr.length; +const bifurcate = (arr, filter) => + arr.reduce((acc, val, i) => (acc[filter[i] ? 0 : 1].push(val), acc), [[], []]); +const bifurcateBy = (arr, fn) => + arr.reduce((acc, val, i) => (acc[fn(val, i) ? 0 : 1].push(val), acc), [[], []]); +const bind = (fn, context, ...boundArgs) => (...args) => fn.apply(context, [...boundArgs, ...args]); +const bindAll = (obj, ...fns) => + fns.forEach( + fn => ( + (f = obj[fn]), + (obj[fn] = function() { + return f.apply(obj); + }) + ) + ); +const bindKey = (context, fn, ...boundArgs) => (...args) => + context[fn].apply(context, [...boundArgs, ...args]); +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); +}; +const bottomVisible = () => + document.documentElement.clientHeight + window.scrollY >= + (document.documentElement.scrollHeight || document.documentElement.clientHeight); + const btoa = str => Buffer.from(str, 'binary').toString('base64'); +const byteSize = str => new Blob([str]).size; +const call = (key, ...args) => context => context[key](...args); +const capitalize = ([first, ...rest], lowerRest = false) => + first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join('')); +const capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCase()); +const castArray = val => (Array.isArray(val) ? val : [val]); +const chainAsync = fns => { + let curr = 0; + const next = () => fns[curr++](next); + next(); +}; +const chunk = (arr, size) => + Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => + arr.slice(i * size, i * size + size) + ); +const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); +const cloneRegExp = regExp => new RegExp(regExp.source, regExp.flags); +const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_)); +const coalesceFactory = valid => (...args) => args.find(valid); +const collectInto = fn => (...args) => fn(args); +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` +}); +const compact = arr => arr.filter(Boolean); +const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); +const composeRight = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); +const converge = (converger, fns) => (...args) => converger(...fns.map(fn => fn.apply(null, args))); +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 countBy = (arr, fn) => + arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => { + acc[val] = (acc[val] || 0) + 1; + return acc; + }, {}); +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; +}; +const countOccurrences = (arr, val) => arr.reduce((a, v) => (v === val ? a + 1 : a), 0); +const createElement = str => { + const el = document.createElement('div'); + el.innerHTML = str; + return el.firstElementChild; +}; +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); + } +}); +const CSVToArray = (data, delimiter = ',', omitFirstRow = false) => + data + .slice(omitFirstRow ? data.indexOf('\n') + 1 : 0) + .split('\n') + .map(v => v.split(delimiter)); +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 currentURL = () => window.location.href; +const curry = (fn, arity = fn.length, ...args) => + arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args); +const dayOfYear = date => + Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24); +const debounce = (fn, ms = 0) => { + let timeoutId; + return function(...args) { + clearTimeout(timeoutId); + timeoutId = setTimeout(() => fn.apply(this, args), ms); + }; +}; +const decapitalize = ([first, ...rest], upperRest = false) => + first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); +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; +}; +const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); +const deepFreeze = obj => + Object.keys(obj).forEach( + prop => + !obj[prop] instanceof Object || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop]) + ) || Object.freeze(obj); +const defaults = (obj, ...defs) => Object.assign({}, obj, ...defs.reverse(), obj); +const defer = (fn, ...args) => setTimeout(fn, 1, ...args); +const degreesToRads = deg => (deg * Math.PI) / 180.0; +const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args); +const detectDeviceType = () => + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) + ? 'Mobile' + : 'Desktop'; +const difference = (a, b) => { + const s = new Set(b); + return a.filter(x => !s.has(x)); +}; +const differenceBy = (a, b, fn) => { + const s = new Set(b.map(v => fn(v))); + return a.filter(x => !s.has(fn(x))); +}; +const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1); +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); +const digitize = n => [...`${n}`].map(i => parseInt(i)); +const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); +const drop = (arr, n = 1) => arr.slice(n); +const dropRight = (arr, n = 1) => arr.slice(0, -n); +const dropRightWhile = (arr, func) => { + while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1); + return arr; +}; +const dropWhile = (arr, func) => { + while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1); + return arr; +}; +const elementContains = (parent, child) => parent !== child && parent.contains(child); +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 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 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])); +}; +const escapeHTML = str => + str.replace( + /[&<>'"]/g, + tag => + ({ + '&': '&', + '<': '<', + '>': '>', + "'": ''', + '"': '"' + }[tag] || tag) + ); +const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1); +const extendHex = shortHex => + '#' + + shortHex + .slice(shortHex.startsWith('#') ? 1 : 0) + .split('') + .map(x => x + x) + .join(''); +const factorial = n => + n < 0 + ? (() => { + throw new TypeError('Negative numbers are not allowed!'); + })() + : n <= 1 + ? 1 + : n * factorial(n - 1); +const fibonacci = n => + Array.from({ length: n }).reduce( + (acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), + [] + ); +const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i)); +const filterNonUniqueBy = (arr, fn) => + arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j))); +const findKey = (obj, fn) => Object.keys(obj).find(key => fn(obj[key], key, obj)); +const findLast = (arr, fn) => arr.filter(fn).pop(); +const findLastIndex = (arr, fn) => + arr + .map((val, i) => [i, val]) + .filter(([i, val]) => fn(val, i, arr)) + .pop()[0]; +const findLastKey = (obj, fn) => + Object.keys(obj) + .reverse() + .find(key => fn(obj[key], key, obj)); +const flatten = (arr, depth = 1) => + arr.reduce((a, v) => a.concat(depth > 1 && Array.isArray(v) ? flatten(v, depth - 1) : v), []); +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; + }, {}); +const flip = fn => (first, ...rest) => fn(...rest, first); +const forEachRight = (arr, callback) => + arr + .slice(0) + .reverse() + .forEach(callback); +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(([key, val]) => `${val} ${key}${val !== 1 ? 's' : ''}`) + .join(', '); +}; +const forOwn = (obj, fn) => Object.keys(obj).forEach(key => fn(obj[key], key, obj)); +const forOwnRight = (obj, fn) => + Object.keys(obj) + .reverse() + .forEach(key => fn(obj[key], key, obj)); +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(); +const functionName = fn => (console.debug(fn.name), fn); +const functions = (obj, inherited = false) => + (inherited + ? [...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))] + : Object.keys(obj) + ).filter(key => typeof obj[key] === 'function'); +const gcd = (...arr) => { + const _gcd = (x, y) => (!y ? x : gcd(y, x % y)); + return [...arr].reduce((a, b) => _gcd(a, b)); +}; +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 + ); +const get = (from, ...selectors) => + [...selectors].map(s => + s + .replace(/\[([^\[\]]*)\]/g, '.$1.') + .split('.') + .filter(t => t !== '') + .reduce((prev, cur) => prev && prev[cur], from) + ); +const getColonTimeFromDate = date => date.toTimeString().slice(0, 8); +const getDaysDiffBetweenDates = (dateInitial, dateFinal) => + (dateFinal - dateInitial) / (1000 * 3600 * 24); + const getImages = (el, includeDuplicates = false) => { + const images = [...el.getElementsByTagName('img')].map(img => img.getAttribute('src')); + return includeDuplicates ? images : [...new Set(images)]; +}; +const getMeridiemSuffixOfInteger = num => + num === 0 || num === 24 + ? 12 + 'am' + : num === 12 + ? 12 + 'pm' + : num < 12 + ? (num % 12) + 'am' + : (num % 12) + 'pm'; +const getScrollPosition = (el = window) => ({ + x: el.pageXOffset !== undefined ? el.pageXOffset : el.scrollLeft, + y: el.pageYOffset !== undefined ? el.pageYOffset : el.scrollTop +}); +const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; +const getType = v => + v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); +const getURLParameters = url => + (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce( + (a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), + {} + ); +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; + }, {}); +const hammingDistance = (num1, num2) => ((num1 ^ num2).toString(2).match(/1/g) || '').length; +const hasClass = (el, className) => el.classList.contains(className); +const hasFlags = (...flags) => + flags.every(flag => process.argv.includes(/^-{1,2}/.test(flag) ? flag : '--' + flag)); +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(''); + }); + +const hashNode = val => + new Promise(resolve => + setTimeout( + () => + resolve( + crypto + .createHash('sha256') + .update(val) + .digest('hex') + ), + 0 + ) + ); +const head = arr => arr[0]; +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}` : '') + + ')' + ); +}; +const hide = els => els.forEach(e => (e.style.display = 'none')); +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 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 httpsRedirect = () => { + if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]); +}; +const hz = (fn, iterations = 100) => { + const before = performance.now(); + for (let i = 0; i < iterations; i++) fn(); + return (1000 * iterations) / (performance.now() - before); +}; +const indentString = (str, count, indent = ' ') => str.replace(/^/gm, indent.repeat(count)); +const indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []); +const initial = arr => arr.slice(0, -1); +const initialize2DArray = (w, h, val = null) => + Array.from({ length: h }).map(() => Array.from({ length: w }).fill(val)); +const initializeArrayWithRange = (end, start = 0, step = 1) => + Array.from({ length: Math.ceil((end - start + 1) / step) }, (v, i) => i * step + start); +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 + ); +const initializeArrayWithValues = (n, val = 0) => Array(n).fill(val); +const initializeNDArray = (val, ...args) => + args.length === 0 + ? val + : Array.from({ length: args[0] }).map(() => initializeNDArray(val, ...args.slice(1))); +const inRange = (n, start, end = null) => { + if (end && start > end) [end, start] = [start, end]; + return end == null ? n >= 0 && n < start : n >= start && n < end; +}; +const insertAfter = (el, htmlString) => el.insertAdjacentHTML('afterend', htmlString); +const insertBefore = (el, htmlString) => el.insertAdjacentHTML('beforebegin', htmlString); +const intersection = (a, b) => { + const s = new Set(b); + return a.filter(x => s.has(x)); +}; +const intersectionBy = (a, b, fn) => { + const s = new Set(b.map(fn)); + return a.filter(x => s.has(fn(x))); +}; +const intersectionWith = (a, b, comp) => a.filter(x => b.findIndex(y => comp(x, y)) !== -1); +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; + }, {}); +const is = (type, val) => ![, null].includes(val) && val.constructor === type; +const isAbsoluteURL = str => /^[a-z][a-z0-9+.-]*:/.test(str); +const isAfterDate = (dateA, dateB) => dateA > dateB; +const isAnagram = (str1, str2) => { + const normalize = str => + str + .toLowerCase() + .replace(/[^a-z0-9]/gi, '') + .split('') + .sort() + .join(''); + return normalize(str1) === normalize(str2); +}; +const isArrayLike = obj => obj != null && typeof obj[Symbol.iterator] === 'function'; +const isBeforeDate = (dateA, dateB) => dateA < dateB; +const isBoolean = val => typeof val === 'boolean'; +const isBrowser = () => ![typeof window, typeof document].includes('undefined'); +const isBrowserTabFocused = () => !document.hidden; +const isDivisible = (dividend, divisor) => dividend % divisor === 0; + const isDuplexStream = val => + val !== null && + typeof val === 'object' && + typeof val.pipe === 'function' && + typeof val._read === 'function' && + typeof val._readableState === 'object' && + typeof val._write === 'function' && + typeof val._writableState === 'object'; +const isEmpty = val => val == null || !(Object.keys(val) || val).length; +const isEven = num => num % 2 === 0; +const isFunction = val => typeof val === 'function'; +const isLowerCase = str => str === str.toLowerCase(); +const isNil = val => val === undefined || val === null; +const isNull = val => val === null; +const isNumber = val => typeof val === 'number'; +const isObject = obj => obj === Object(obj); +const isObjectLike = val => val !== null && typeof val === 'object'; +const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object; +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 isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null; +const isPromiseLike = obj => + obj !== null && + (typeof obj === 'object' || typeof obj === 'function') && + typeof obj.then === 'function'; + const isReadableStream = val => + val !== null && + typeof val === 'object' && + typeof val.pipe === 'function' && + typeof val._read === 'function' && + typeof val._readableState === 'object'; +const isSameDate = (dateA, dateB) => dateA.toISOString() === dateB.toISOString(); +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; + } +}; + const isStream = val => val !== null && typeof val === 'object' && typeof val.pipe === 'function'; + const isString = val => typeof val === 'string'; +const isSymbol = val => typeof val === 'symbol'; +const isTravisCI = () => 'TRAVIS' in process.env && 'CI' in process.env; +const isUndefined = val => val === undefined; +const isUpperCase = str => str === str.toUpperCase(); +const isValidJSON = obj => { + try { + JSON.parse(obj); + return true; + } catch (e) { + return false; + } +}; + const isWritableStream = val => + val !== null && + typeof val === 'object' && + typeof val.pipe === 'function' && + typeof val._write === 'function' && + typeof val._writableState === 'object'; +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, + '' + ); + 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'); + +const JSONToFile = (obj, filename) => + fs.writeFile(`${filename}.json`, JSON.stringify(obj, null, 2)); +const last = arr => arr[arr.length - 1]; +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 longestItem = (val, ...vals) => + [val, ...vals].reduce((a, x) => (x.length > a.length ? x : a)); +const lowercaseKeys = obj => + Object.keys(obj).reduce((acc, key) => { + acc[key.toLowerCase()] = obj[key]; + return acc; + }, {}); +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; +}; +const mapKeys = (obj, fn) => + Object.keys(obj).reduce((acc, k) => { + acc[fn(obj[k], k, obj)] = obj[k]; + return acc; + }, {}); +const mapObject = (arr, fn) => + (a => ( + (a = [arr, arr.map(fn)]), a[0].reduce((acc, val, ind) => ((acc[val] = a[1][ind]), acc), {}) + ))(); +const mapString = (str, fn) => + str + .split('') + .map((c, i) => fn(c, i, str)) + .join(''); +const mapValues = (obj, fn) => + Object.keys(obj).reduce((acc, k) => { + acc[k] = fn(obj[k], k, obj); + return acc; + }, {}); +const mask = (cc, num = 4, mask = '*') => `${cc}`.slice(-num).padStart(`${cc}`.length, mask); +const matches = (obj, source) => + Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); +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] + ); +const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); +const maxDate = (...dates) => new Date(Math.max.apply(null, ...dates)); +const maxN = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n); +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 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 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; + }, {}), + {} + ); +const minBy = (arr, fn) => Math.min(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); +const minDate = (...dates) => new Date(Math.min.apply(null, ...dates)); +const minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n); +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 negate = func => (...args) => !func(...args); +const nest = (items, id = null, link = 'parent_id') => + items + .filter(item => item[link] === id) + .map(item => ({ ...item, children: nest(items, item.id) })); +const nodeListToArray = nodeList => [...nodeList]; +const none = (arr, fn = Boolean) => !arr.some(fn); +const nthArg = n => (...args) => args.slice(n)[0]; +const nthElement = (arr, n = 0) => (n === -1 ? arr.slice(n) : arr.slice(n, n + 1))[0]; +const objectFromPairs = arr => arr.reduce((a, [key, val]) => ((a[key] = val), a), {}); +const objectToPairs = obj => Object.keys(obj).map(k => [k, obj[k]]); +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 off = (el, evt, fn, opts = false) => el.removeEventListener(evt, fn, opts); +const offset = (arr, offset) => [...arr.slice(offset), ...arr.slice(0, offset)]; +const omit = (obj, arr) => + Object.keys(obj) + .filter(k => !arr.includes(k)) + .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); +const omitBy = (obj, fn) => + Object.keys(obj) + .filter(k => !fn(obj[k], k)) + .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); +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 once = fn => { + let called = false; + return function(...args) { + if (called) return; + called = true; + return fn.apply(this, args); + }; +}; +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); + }); +}; +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) + ); +const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args)); +const overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val))); +const pad = (str, length, char = ' ') => + str.padStart((str.length + length) / 2, char).padEnd(length, char); +const palindrome = str => { + const s = str.toLowerCase().replace(/[\W_]/g, ''); + return s === [...s].reverse().join(''); +}; +const parseCookie = str => + str + .split(';') + .map(v => v.split('=')) + .reduce((acc, v) => { + acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); + return acc; + }, {}); +const partial = (fn, ...partials) => (...args) => fn(...partials, ...args); +const partialRight = (fn, ...partials) => (...args) => fn(...args, ...partials); +const partition = (arr, fn) => + arr.reduce( + (acc, val, i, arr) => { + acc[fn(val, i, arr) ? 0 : 1].push(val); + return acc; + }, + [[], []] + ); +const percentile = (arr, val) => + (100 * arr.reduce((acc, v) => acc + (v < val ? 1 : 0) + (v === val ? 0.5 : 0), 0)) / arr.length; +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]) + ), + [] + ); +}; +const pick = (obj, arr) => + arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); +const pickBy = (obj, fn) => + Object.keys(obj) + .filter(k => fn(obj[k], k)) + .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); +const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg)); +const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); +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 powerset = arr => arr.reduce((a, v) => a.concat(a.map(r => [v].concat(r))), [[]]); +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 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 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; +}; +const promisify = func => (...args) => + new Promise((resolve, reject) => + func(...args, (err, result) => (err ? reject(err) : resolve(result))) + ); +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)); +}; +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; +}; +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; +}; +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 radsToDegrees = rad => (rad * 180.0) / Math.PI; +const randomHexColorCode = () => { + let n = (Math.random() * 0xfffff * 1000000).toString(16); + return '#' + n.slice(0, 6); +}; +const randomIntArrayInRange = (min, max, n = 1) => + Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min); +const randomIntegerInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; +const randomNumberInRange = (min, max) => Math.random() * (max - min) + min; + +const readFileLines = filename => + fs + .readFileSync(filename) + .toString('UTF8') + .split('\n'); +const rearg = (fn, indexes) => (...args) => fn(...indexes.map(i => args[i])); +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 }; +}; +const redirect = (url, asLink = true) => + asLink ? (window.location.href = url) : window.location.replace(url); +const reducedFilter = (data, keys, fn) => + data.filter(fn).map(el => + keys.reduce((acc, key) => { + acc[key] = el[key]; + return acc; + }, {}) + ); +const reduceSuccessive = (arr, fn, acc) => + arr.reduce((res, val, i, arr) => (res.push(fn(res.slice(-1)[0], val, i, arr)), res), [acc]); +const reduceWhich = (arr, comparator = (a, b) => a - b) => + arr.reduce((a, b) => (comparator(a, b) >= 0 ? b : a)); +const reject = (pred, array) => array.filter((...args) => !pred(...args)); +const remove = (arr, func) => + Array.isArray(arr) + ? arr.filter(func).reduce((acc, val) => { + arr.splice(arr.indexOf(val), 1); + return acc.concat(val); + }, []) + : []; +const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); +const renameKeys = (keysMap, obj) => + Object.keys(obj).reduce( + (acc, key) => ({ + ...acc, + ...{ [keysMap[key] || key]: obj[key] } + }), + {} + ); +const reverseString = str => [...str].reverse().join(''); +const RGBToHex = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0'); +const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`); +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 runPromisesInSeries = ps => ps.reduce((p, next) => p.then(next), Promise.resolve()); +const sample = arr => arr[Math.floor(Math.random() * arr.length)]; +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); +}; +const scrollToTop = () => { + const c = document.documentElement.scrollTop || document.body.scrollTop; + if (c > 0) { + window.requestAnimationFrame(scrollToTop); + window.scrollTo(0, c - c / 8); + } +}; +const sdbm = str => { + let arr = str.split(''); + return arr.reduce( + (hashCode, currentVal) => + (hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode), + 0 + ); +}; +const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`; +const setStyle = (el, ruleName, val) => (el.style[ruleName] = val); +const shallowClone = obj => Object.assign({}, obj); +const shank = (arr, index = 0, delCount = 0, ...elements) => + arr + .slice(0, index) + .concat(elements) + .concat(arr.slice(index + delCount)); +const show = (...el) => [...el].forEach(e => (e.style.display = '')); +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; +}; +const similarity = (arr, values) => arr.filter(v => values.includes(v)); +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; +const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); +const smoothScroll = element => + document.querySelector(element).scrollIntoView({ + behavior: 'smooth' + }); +const sortCharactersInString = str => [...str].sort((a, b) => a.localeCompare(b)).join(''); +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 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 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 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 splitLines = str => str.split(/\r?\n/); +const spreadOver = fn => argsArr => fn(...argsArr); +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); +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 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)), + [] + ); +}; +const stripHTMLTags = str => str.replace(/<[^>]*>/g, ''); +const sum = (...arr) => [...arr].reduce((acc, val) => acc + val, 0); +const sumBy = (arr, fn) => + arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0); +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); +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 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 symmetricDifferenceWith = (arr, val, comp) => [ + ...arr.filter(a => val.findIndex(b => comp(a, b)) === -1), + ...val.filter(a => arr.findIndex(b => comp(a, b)) === -1) +]; +const tail = arr => (arr.length > 1 ? arr.slice(1) : arr); +const take = (arr, n = 1) => arr.slice(0, n); +const takeRight = (arr, n = 1) => arr.slice(arr.length - n, arr.length); + const takeRightWhile = (arr, func) => + arr.reduceRight((acc, el) => (func(el) ? acc : [el, ...acc]), []); +const takeWhile = (arr, func) => { + for (const [i, val] of arr.entries()) if (func(val)) return arr.slice(0, i); + return arr; +}; + 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(); + } + }, Math.max(wait - (Date.now() - lastTime), 0)); + } + }; +}; +const times = (n, fn, context = undefined) => { + let i = 0; + while (fn.call(context, i) !== false && ++i < n) {} +}; +const timeTaken = callback => { + console.time('timeTaken'); + const r = callback(); + console.timeEnd('timeTaken'); + return r; +}; +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); +}; +const toCurrency = (n, curr, LanguageFormat = undefined) => + Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n); +const toDecimalMark = num => num.toLocaleString('en-US'); +const toggleClass = (el, className) => el.classList.toggle(className); +const toHash = (object, key) => + Array.prototype.reduce.call( + object, + (acc, data, index) => ((acc[!key ? index : data[key]] = data), acc), + {} + ); +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('-'); +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`; +}; +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 toSafeInteger = num => + Math.round(Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER)); +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('_'); +const transform = (obj, fn, acc) => Object.keys(obj).reduce((a, k) => fn(a, obj[k], k, obj), acc); + const triggerEvent = (el, eventType, detail) => + el.dispatchEvent(new CustomEvent(eventType, { detail })); +const truncateString = (str, num) => + str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; +const truthCheckCollection = (collection, pre) => collection.every(obj => obj[pre]); +const unary = fn => val => fn(val); +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 unescapeHTML = str => + str.replace( + /&|<|>|'|"/g, + tag => + ({ + '&': '&', + '<': '<', + '>': '>', + ''': "'", + '"': '"' + }[tag] || tag) + ); +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; + }, {}); +const unfold = (fn, seed) => { + let result = [], + val = [null, seed]; + while ((val = fn(val[1]))) result.push(val[0]); + return result; +}; +const union = (a, b) => Array.from(new Set([...a, ...b])); +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 unionWith = (a, b, comp) => + Array.from(new Set([...a, ...b.filter(x => a.findIndex(y => comp(x, y)) === -1)])); +const uniqueElements = arr => [...new Set(arr)]; +const uniqueElementsBy = (arr, fn) => + arr.reduce((acc, v) => { + if (!acc.some(x => fn(v, x))) acc.push(v); + return acc; + }, []); +const uniqueElementsByRight = (arr, fn) => + arr.reduceRight((acc, v) => { + if (!acc.some(x => fn(v, x))) acc.push(v); + return acc; + }, []); +const uniqueSymmetricDifference = (a, b) => [ + ...new Set([...a.filter(v => !b.includes(v)), ...b.filter(v => !a.includes(v))]) +]; +const untildify = str => str.replace(/^~($|\/|\\)/, `${require('os').homedir()}$1`); +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 => []) + ); +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)); +const URLJoin = (...args) => + args + .join('/') + .replace(/[\/]+/g, '/') + .replace(/^(.+):\//, '$1://') + .replace(/^file:/, 'file:/') + .replace(/\/(\?|&|#[^!])/g, '$1') + .replace(/\?/g, '&') + .replace('&', '?'); +const UUIDGeneratorBrowser = () => + ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => + (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16) + ); + +const UUIDGeneratorNode = () => + ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => + (c ^ (crypto.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16) + ); +const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n; +const when = (pred, whenTrue) => x => (pred(x) ? whenTrue(x) : x); +const without = (arr, ...args) => arr.filter(v => !args.includes(v)); +const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean); +const xProd = (a, b) => a.reduce((acc, x) => acc.concat(b.map(y => [x, y])), []); +const yesNo = (val, def = false) => + /^(y|yes)$/i.test(val) ? true : /^(n|no)$/i.test(val) ? false : def; +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 zipObject = (props, values) => + props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); +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 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; +}; + 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; +}; + const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1); + const countVowels = str => (str.match(/[aeiou]/gi) || []).length; + 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 fibonacciCountUntilNum = num => + Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2)); + 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), + [] + ); +}; + const heronArea = (side_a, side_b, side_c) => { + const p = (side_a + side_b + side_c) / 2 + return Math.sqrt(p * (p-side_a) * (p-side_b) * (p-side_c)) + }; + 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; +}; + 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 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 isArmstrongNumber = digits => + (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)( + (digits + '').split('') + ); + const isSimilar = (pattern, str) => + [...str].reduce( + (matchIndex, char) => + char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() + ? matchIndex + 1 + : matchIndex, + 0 + ) === pattern.length; + const JSONToDate = arr => { + const dt = new Date(parseInt(arr.toString().substr(6))); + return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`; +}; + 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]; +}; + const pipeLog = data => console.log(data) || data; + 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) + ]; + const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi, repl); + 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 speechSynthesis = message => { + const msg = new SpeechSynthesisUtterance(message); + msg.voice = window.speechSynthesis.getVoices()[0]; + window.speechSynthesis.speak(msg); +}; + + +module.exports = {all,allEqual,any,approximatelyEqual,arrayToCSV,arrayToHtmlList,ary,atob,attempt,average,averageBy,bifurcate,bifurcateBy,bind,bindAll,bindKey,binomialCoefficient,bottomVisible,btoa,byteSize,call,capitalize,capitalizeEveryWord,castArray,chainAsync,chunk,clampNumber,cloneRegExp,coalesce,coalesceFactory,collectInto,colorize,compact,compose,composeRight,converge,copyToClipboard,countBy,counter,countOccurrences,createElement,createEventHub,CSVToArray,CSVToJSON,currentURL,curry,dayOfYear,debounce,decapitalize,deepClone,deepFlatten,deepFreeze,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,dig,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementContains,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterNonUnique,filterNonUniqueBy,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,formatDuration,forOwn,forOwnRight,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getImages,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,hz,indentString,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,initializeNDArray,inRange,insertAfter,insertBefore,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isAfterDate,isAnagram,isArrayLike,isBeforeDate,isBoolean,isBrowser,isBrowserTabFocused,isDivisible,isDuplexStream,isEmpty,isEven,isFunction,isLowerCase,isNil,isNull,isNumber,isObject,isObjectLike,isPlainObject,isPrime,isPrimitive,isPromiseLike,isReadableStream,isSameDate,isSorted,isStream,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,isWritableStream,join,JSONtoCSV,JSONToFile,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapObject,mapString,mapValues,mask,matches,matchesWith,maxBy,maxDate,maxN,median,memoize,merge,minBy,minDate,minN,mostPerformant,negate,nest,nodeListToArray,none,nthArg,nthElement,objectFromPairs,objectToPairs,observeMutations,off,offset,omit,omitBy,on,once,onUserInputChange,orderBy,over,overArgs,pad,palindrome,parseCookie,partial,partialRight,partition,percentile,permutations,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prefix,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,recordAnimationFrames,redirect,reducedFilter,reduceSuccessive,reduceWhich,reject,remove,removeNonASCII,renameKeys,reverseString,RGBToHex,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,setStyle,shallowClone,shank,show,shuffle,similarity,size,sleep,smoothScroll,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,stableSort,standardDeviation,stringPermutations,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,times,timeTaken,toCamelCase,toCurrency,toDecimalMark,toggleClass,toHash,toKebabCase,tomorrow,toOrdinalSuffix,toSafeInteger,toSnakeCase,transform,triggerEvent,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,uniqueElementsBy,uniqueElementsByRight,uniqueSymmetricDifference,untildify,unzip,unzipWith,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,validateNumber,when,without,words,xProd,yesNo,zip,zipObject,zipWith,binarySearch,cleanObj,collatz,countVowels,factors,fibonacciCountUntilNum,fibonacciUntilNum,heronArea,howManyTimes,httpDelete,httpPut,isArmstrongNumber,isSimilar,JSONToDate,levenshteinDistance,pipeLog,quickSort,removeVowels,solveRPN,speechSynthesis} \ No newline at end of file From 3fd1697daae0d6b52fce51e85857c124a9da97e3 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 10 Oct 2018 23:36:17 +0300 Subject: [PATCH 5/5] Updated the test system --- scripts/tdd.js | 87 +++++-------------- test/{CSVToArray => }/CSVToArray.test.js | 2 +- test/CSVToArray/CSVToArray.js | 6 -- test/{CSVToJSON => }/CSVToJSON.test.js | 2 +- test/CSVToJSON/CSVToJSON.js | 11 --- test/{JSONToDate => }/JSONToDate.test.js | 2 +- test/JSONToDate/JSONToDate.js | 5 -- test/{JSONToFile => }/JSONToFile.test.js | 2 +- test/JSONToFile/JSONToFile.js | 4 - test/{JSONtoCSV => }/JSONtoCSV.test.js | 2 +- test/JSONtoCSV/JSONtoCSV.js | 11 --- test/{RGBToHex => }/RGBToHex.test.js | 2 +- test/RGBToHex/RGBToHex.js | 2 - test/{URLJoin => }/URLJoin.test.js | 2 +- test/URLJoin/URLJoin.js | 10 --- .../UUIDGeneratorBrowser.test.js | 2 +- .../UUIDGeneratorBrowser.js | 5 -- .../UUIDGeneratorNode.test.js | 2 +- test/UUIDGeneratorNode/UUIDGeneratorNode.js | 6 -- test/{all => }/all.test.js | 2 +- test/all/all.js | 2 - test/{allEqual => }/allEqual.test.js | 2 +- test/allEqual/allEqual.js | 2 - test/{any => }/any.test.js | 2 +- test/any/any.js | 2 - .../approximatelyEqual.test.js | 2 +- test/approximatelyEqual/approximatelyEqual.js | 2 - test/{arrayToCSV => }/arrayToCSV.test.js | 2 +- test/arrayToCSV/arrayToCSV.js | 3 - .../arrayToHtmlList.test.js | 2 +- test/arrayToHtmlList/arrayToHtmlList.js | 6 -- test/{ary => }/ary.test.js | 2 +- test/ary/ary.js | 2 - test/{atob => }/atob.test.js | 2 +- test/atob/atob.js | 2 - test/{attempt => }/attempt.test.js | 2 +- test/attempt/attempt.js | 8 -- test/{average => }/average.test.js | 2 +- test/average/average.js | 2 - test/{averageBy => }/averageBy.test.js | 2 +- test/averageBy/averageBy.js | 4 - test/{bifurcate => }/bifurcate.test.js | 2 +- test/bifurcate/bifurcate.js | 3 - test/{bifurcateBy => }/bifurcateBy.test.js | 2 +- test/bifurcateBy/bifurcateBy.js | 3 - test/{binarySearch => }/binarySearch.test.js | 2 +- test/binarySearch/binarySearch.js | 8 -- test/{bind => }/bind.test.js | 2 +- test/bind/bind.js | 2 - test/{bindAll => }/bindAll.test.js | 2 +- test/bindAll/bindAll.js | 10 --- test/{bindKey => }/bindKey.test.js | 2 +- test/bindKey/bindKey.js | 3 - .../binomialCoefficient.test.js | 2 +- .../binomialCoefficient.js | 11 --- .../{bottomVisible => }/bottomVisible.test.js | 2 +- test/bottomVisible/bottomVisible.js | 4 - test/{btoa => }/btoa.test.js | 2 +- test/btoa/btoa.js | 2 - test/{byteSize => }/byteSize.test.js | 0 test/byteSize/byteSize.js | 2 - test/{call => }/call.test.js | 2 +- test/call/call.js | 2 - test/{capitalize => }/capitalize.test.js | 2 +- test/capitalize/capitalize.js | 3 - .../capitalizeEveryWord.test.js | 2 +- .../capitalizeEveryWord.js | 2 - test/{castArray => }/castArray.test.js | 2 +- test/castArray/castArray.js | 2 - test/{chainAsync => }/chainAsync.test.js | 2 +- test/chainAsync/chainAsync.js | 6 -- test/{chunk => }/chunk.test.js | 2 +- test/chunk/chunk.js | 5 -- test/{clampNumber => }/clampNumber.test.js | 2 +- test/clampNumber/clampNumber.js | 2 - test/{cleanObj => }/cleanObj.test.js | 2 +- test/cleanObj/cleanObj.js | 11 --- test/{cloneRegExp => }/cloneRegExp.test.js | 2 +- test/cloneRegExp/cloneRegExp.js | 2 - test/{coalesce => }/coalesce.test.js | 2 +- test/coalesce/coalesce.js | 2 - .../coalesceFactory.test.js | 2 +- test/coalesceFactory/coalesceFactory.js | 2 - test/{collatz => }/collatz.test.js | 2 +- test/collatz/collatz.js | 2 - test/{collectInto => }/collectInto.test.js | 2 +- test/collectInto/collectInto.js | 2 - test/{colorize => }/colorize.test.js | 2 +- test/colorize/colorize.js | 19 ---- test/{compact => }/compact.test.js | 2 +- test/compact/compact.js | 2 - test/{compose => }/compose.test.js | 2 +- test/compose/compose.js | 2 - test/{composeRight => }/composeRight.test.js | 2 +- test/composeRight/composeRight.js | 2 - test/{converge => }/converge.test.js | 2 +- test/converge/converge.js | 2 - .../copyToClipboard.test.js | 2 +- test/copyToClipboard/copyToClipboard.js | 18 ---- test/{countBy => }/countBy.test.js | 2 +- test/countBy/countBy.js | 6 -- .../countOccurrences.test.js | 2 +- test/countOccurrences/countOccurrences.js | 2 - test/{countVowels => }/countVowels.test.js | 2 +- test/countVowels/countVowels.js | 2 - test/{counter => }/counter.test.js | 2 +- test/counter/counter.js | 12 --- .../{createElement => }/createElement.test.js | 2 +- test/createElement/createElement.js | 6 -- .../createEventHub.test.js | 2 +- test/createEventHub/createEventHub.js | 15 ---- test/{currentURL => }/currentURL.test.js | 2 +- test/currentURL/currentURL.js | 2 - test/{curry => }/curry.test.js | 2 +- test/curry/curry.js | 3 - test/{dayOfYear => }/dayOfYear.test.js | 2 +- test/dayOfYear/dayOfYear.js | 3 - test/{debounce => }/debounce.test.js | 2 +- test/debounce/debounce.js | 8 -- test/{decapitalize => }/decapitalize.test.js | 2 +- test/decapitalize/decapitalize.js | 3 - test/{deepClone => }/deepClone.test.js | 2 +- test/deepClone/deepClone.js | 8 -- test/{deepFlatten => }/deepFlatten.test.js | 2 +- test/deepFlatten/deepFlatten.js | 2 - test/{deepFreeze => }/deepFreeze.test.js | 2 +- test/deepFreeze/deepFreeze.js | 6 -- test/{defaults => }/defaults.test.js | 2 +- test/defaults/defaults.js | 2 - test/{defer => }/defer.test.js | 2 +- test/defer/defer.js | 2 - .../{degreesToRads => }/degreesToRads.test.js | 2 +- test/degreesToRads/degreesToRads.js | 2 - test/{delay => }/delay.test.js | 2 +- test/delay/delay.js | 2 - .../detectDeviceType.test.js | 2 +- test/detectDeviceType/detectDeviceType.js | 5 -- test/{difference => }/difference.test.js | 2 +- test/difference/difference.js | 5 -- test/{differenceBy => }/differenceBy.test.js | 2 +- test/differenceBy/differenceBy.js | 5 -- .../differenceWith.test.js | 2 +- test/differenceWith/differenceWith.js | 2 - test/{dig => }/dig.test.js | 2 +- test/dig/dig.js | 8 -- test/{digitize => }/digitize.test.js | 2 +- test/digitize/digitize.js | 2 - test/{distance => }/distance.test.js | 2 +- test/distance/distance.js | 2 - test/{drop => }/drop.test.js | 2 +- test/drop/drop.js | 2 - test/{dropRight => }/dropRight.test.js | 2 +- test/dropRight/dropRight.js | 2 - .../dropRightWhile.test.js | 2 +- test/dropRightWhile/dropRightWhile.js | 5 -- test/{dropWhile => }/dropWhile.test.js | 2 +- test/dropWhile/dropWhile.js | 5 -- .../elementContains.test.js | 2 +- test/elementContains/elementContains.js | 2 - .../elementIsVisibleInViewport.test.js | 2 +- .../elementIsVisibleInViewport.js | 9 -- test/{elo => }/elo.test.js | 2 +- test/elo/elo.js | 18 ---- test/{equals => }/equals.test.js | 2 +- test/equals/equals.js | 11 --- test/{escapeHTML => }/escapeHTML.test.js | 2 +- test/escapeHTML/escapeHTML.js | 13 --- test/{escapeRegExp => }/escapeRegExp.test.js | 2 +- test/escapeRegExp/escapeRegExp.js | 2 - test/{everyNth => }/everyNth.test.js | 2 +- test/everyNth/everyNth.js | 2 - test/{extendHex => }/extendHex.test.js | 2 +- test/extendHex/extendHex.js | 8 -- test/{factorial => }/factorial.test.js | 2 +- test/factorial/factorial.js | 9 -- test/{factors => }/factors.test.js | 2 +- test/factors/factors.js | 20 ----- test/{fibonacci => }/fibonacci.test.js | 2 +- test/fibonacci/fibonacci.js | 6 -- .../fibonacciCountUntilNum.test.js | 2 +- .../fibonacciCountUntilNum.js | 3 - .../fibonacciUntilNum.test.js | 2 +- test/fibonacciUntilNum/fibonacciUntilNum.js | 8 -- .../filterNonUnique.test.js | 2 +- test/filterNonUnique/filterNonUnique.js | 2 - .../filterNonUniqueBy.test.js | 2 +- test/filterNonUniqueBy/filterNonUniqueBy.js | 3 - test/{findKey => }/findKey.test.js | 2 +- test/findKey/findKey.js | 2 - test/{findLast => }/findLast.test.js | 2 +- test/findLast/findLast.js | 2 - .../{findLastIndex => }/findLastIndex.test.js | 2 +- test/findLastIndex/findLastIndex.js | 6 -- test/{findLastKey => }/findLastKey.test.js | 2 +- test/findLastKey/findLastKey.js | 5 -- test/{flatten => }/flatten.test.js | 2 +- test/flatten/flatten.js | 3 - .../{flattenObject => }/flattenObject.test.js | 2 +- test/flattenObject/flattenObject.js | 8 -- test/{flip => }/flip.test.js | 2 +- test/flip/flip.js | 2 - test/{forEachRight => }/forEachRight.test.js | 2 +- test/forEachRight/forEachRight.js | 6 -- test/{forOwn => }/forOwn.test.js | 2 +- test/forOwn/forOwn.js | 2 - test/{forOwnRight => }/forOwnRight.test.js | 2 +- test/forOwnRight/forOwnRight.js | 5 -- .../formatDuration.test.js | 2 +- test/formatDuration/formatDuration.js | 15 ---- .../{fromCamelCase => }/fromCamelCase.test.js | 2 +- test/fromCamelCase/fromCamelCase.js | 6 -- test/{functionName => }/functionName.test.js | 0 test/functionName/functionName.js | 2 - test/{functions => }/functions.test.js | 2 +- test/functions/functions.js | 6 -- test/{gcd => }/gcd.test.js | 2 +- test/gcd/gcd.js | 5 -- .../geometricProgression.test.js | 2 +- .../geometricProgression.js | 5 -- test/{get => }/get.test.js | 2 +- test/get/get.js | 9 -- .../getColonTimeFromDate.test.js | 2 +- .../getColonTimeFromDate.js | 2 - .../getDaysDiffBetweenDates.test.js | 2 +- .../getDaysDiffBetweenDates.js | 3 - test/{getImages => }/getImages.test.js | 4 +- test/getImages/getImages.js | 5 -- .../getMeridiemSuffixOfInteger.test.js | 2 +- .../getMeridiemSuffixOfInteger.js | 9 -- .../getScrollPosition.test.js | 2 +- test/getScrollPosition/getScrollPosition.js | 5 -- test/{getStyle => }/getStyle.test.js | 2 +- test/getStyle/getStyle.js | 2 - test/{getType => }/getType.test.js | 2 +- test/getType/getType.js | 3 - .../getURLParameters.test.js | 2 +- test/getURLParameters/getURLParameters.js | 6 -- test/{groupBy => }/groupBy.test.js | 2 +- test/groupBy/groupBy.js | 6 -- .../hammingDistance.test.js | 2 +- test/hammingDistance/hammingDistance.js | 2 - test/{hasClass => }/hasClass.test.js | 2 +- test/hasClass/hasClass.js | 2 - test/{hasFlags => }/hasFlags.test.js | 2 +- test/hasFlags/hasFlags.js | 3 - test/{hashBrowser => }/hashBrowser.test.js | 2 +- test/hashBrowser/hashBrowser.js | 9 -- test/{hashNode => }/hashNode.test.js | 2 +- test/hashNode/hashNode.js | 15 ---- test/{head => }/head.test.js | 2 +- test/head/head.js | 2 - test/{heronArea => }/heronArea.test.js | 2 +- test/heronArea/heronArea.js | 5 -- test/{hexToRGB => }/hexToRGB.test.js | 2 +- test/hexToRGB/hexToRGB.js | 20 ----- test/{hide => }/hide.test.js | 2 +- test/hide/hide.js | 2 - test/{howManyTimes => }/howManyTimes.test.js | 2 +- test/howManyTimes/howManyTimes.js | 11 --- test/{httpDelete => }/httpDelete.test.js | 2 +- test/httpDelete/httpDelete.js | 8 -- test/{httpGet => }/httpGet.test.js | 2 +- test/httpGet/httpGet.js | 8 -- test/{httpPost => }/httpPost.test.js | 2 +- test/httpPost/httpPost.js | 9 -- test/{httpPut => }/httpPut.test.js | 2 +- test/httpPut/httpPut.js | 9 -- .../{httpsRedirect => }/httpsRedirect.test.js | 2 +- test/httpsRedirect/httpsRedirect.js | 4 - test/{hz => }/hz.test.js | 2 +- test/hz/hz.js | 6 -- test/{inRange => }/inRange.test.js | 2 +- test/inRange/inRange.js | 5 -- test/{indentString => }/indentString.test.js | 2 +- test/indentString/indentString.js | 2 - test/{indexOfAll => }/indexOfAll.test.js | 2 +- test/indexOfAll/indexOfAll.js | 2 - test/{initial => }/initial.test.js | 2 +- test/initial/initial.js | 2 - .../initialize2DArray.test.js | 2 +- test/initialize2DArray/initialize2DArray.js | 3 - .../initializeArrayWithRange.test.js | 2 +- .../initializeArrayWithRange.js | 3 - .../initializeArrayWithRangeRight.test.js | 2 +- .../initializeArrayWithRangeRight.js | 5 -- .../initializeArrayWithValues.test.js | 2 +- .../initializeArrayWithValues.js | 2 - .../initializeNDArray.test.js | 2 +- test/initializeNDArray/initializeNDArray.js | 5 -- test/{insertAfter => }/insertAfter.test.js | 2 +- test/insertAfter/insertAfter.js | 2 - test/{insertBefore => }/insertBefore.test.js | 2 +- test/insertBefore/insertBefore.js | 2 - test/{intersection => }/intersection.test.js | 2 +- test/intersection/intersection.js | 5 -- .../intersectionBy.test.js | 2 +- test/intersectionBy/intersectionBy.js | 5 -- .../intersectionWith.test.js | 2 +- test/intersectionWith/intersectionWith.js | 2 - .../invertKeyValues.test.js | 2 +- test/invertKeyValues/invertKeyValues.js | 8 -- test/{is => }/is.test.js | 2 +- test/is/is.js | 2 - .../{isAbsoluteURL => }/isAbsoluteURL.test.js | 2 +- test/isAbsoluteURL/isAbsoluteURL.js | 2 - test/{isAfterDate => }/isAfterDate.test.js | 2 +- test/isAfterDate/isAfterDate.js | 2 - test/{isAnagram => }/isAnagram.test.js | 2 +- test/isAnagram/isAnagram.js | 11 --- .../isArmstrongNumber.test.js | 2 +- test/isArmstrongNumber/isArmstrongNumber.js | 5 -- test/isArray/isArray.js | 2 - test/isArray/isArray.test.js | 12 --- test/isArrayBuffer/isArrayBuffer.js | 2 - test/isArrayBuffer/isArrayBuffer.test.js | 6 -- test/{isArrayLike => }/isArrayLike.test.js | 2 +- test/isArrayLike/isArrayLike.js | 2 - test/{isBeforeDate => }/isBeforeDate.test.js | 2 +- test/isBeforeDate/isBeforeDate.js | 2 - test/{isBoolean => }/isBoolean.test.js | 2 +- test/isBoolean/isBoolean.js | 2 - test/{isBrowser => }/isBrowser.test.js | 2 +- test/isBrowser/isBrowser.js | 2 - .../isBrowserTabFocused.test.js | 2 +- .../isBrowserTabFocused.js | 2 - test/{isDivisible => }/isDivisible.test.js | 2 +- test/isDivisible/isDivisible.js | 2 - .../isDuplexStream.test.js | 11 ++- test/isDuplexStream/isDuplexStream.js | 9 -- test/{isEmpty => }/isEmpty.test.js | 2 +- test/isEmpty/isEmpty.js | 2 - test/{isEven => }/isEven.test.js | 2 +- test/isEven/isEven.js | 2 - test/{isFunction => }/isFunction.test.js | 2 +- test/isFunction/isFunction.js | 2 - test/{isLowerCase => }/isLowerCase.test.js | 2 +- test/isLowerCase/isLowerCase.js | 2 - test/isMap/isMap.js | 2 - test/isMap/isMap.test.js | 6 -- test/{isNil => }/isNil.test.js | 2 +- test/isNil/isNil.js | 2 - test/{isNull => }/isNull.test.js | 2 +- test/isNull/isNull.js | 2 - test/{isNumber => }/isNumber.test.js | 2 +- test/isNumber/isNumber.js | 2 - test/{isObject => }/isObject.test.js | 2 +- test/isObject/isObject.js | 2 - test/{isObjectLike => }/isObjectLike.test.js | 2 +- test/isObjectLike/isObjectLike.js | 2 - .../{isPlainObject => }/isPlainObject.test.js | 2 +- test/isPlainObject/isPlainObject.js | 2 - test/{isPrime => }/isPrime.test.js | 2 +- test/isPrime/isPrime.js | 6 -- test/{isPrimitive => }/isPrimitive.test.js | 2 +- test/isPrimitive/isPrimitive.js | 2 - .../{isPromiseLike => }/isPromiseLike.test.js | 2 +- test/isPromiseLike/isPromiseLike.js | 5 -- .../isReadableStream.test.js | 7 +- test/isReadableStream/isReadableStream.js | 7 -- test/isRegExp/isRegExp.js | 2 - test/isRegExp/isRegExp.test.js | 6 -- test/{isSameDate => }/isSameDate.test.js | 2 +- test/isSameDate/isSameDate.js | 2 - test/isSet/isSet.js | 2 - test/isSet/isSet.test.js | 6 -- test/{isSimilar => }/isSimilar.test.js | 2 +- test/isSimilar/isSimilar.js | 9 -- test/{isSorted => }/isSorted.test.js | 2 +- test/isSorted/isSorted.js | 9 -- test/{isStream => }/isStream.test.js | 7 +- test/isStream/isStream.js | 2 - test/{isString => }/isString.test.js | 2 +- test/isString/isString.js | 2 - test/{isSymbol => }/isSymbol.test.js | 2 +- test/isSymbol/isSymbol.js | 2 - test/{isTravisCI => }/isTravisCI.test.js | 2 +- test/isTravisCI/isTravisCI.js | 2 - test/isTypedArray/isTypedArray.js | 2 - test/isTypedArray/isTypedArray.test.js | 6 -- test/{isUndefined => }/isUndefined.test.js | 2 +- test/isUndefined/isUndefined.js | 2 - test/{isUpperCase => }/isUpperCase.test.js | 2 +- test/isUpperCase/isUpperCase.js | 2 - test/{isValidJSON => }/isValidJSON.test.js | 2 +- test/isValidJSON/isValidJSON.js | 9 -- test/isWeakMap/isWeakMap.js | 2 - test/isWeakMap/isWeakMap.test.js | 6 -- test/isWeakSet/isWeakSet.js | 2 - test/isWeakSet/isWeakSet.test.js | 6 -- .../isWritableStream.test.js | 7 +- test/isWritableStream/isWritableStream.js | 7 -- test/{join => }/join.test.js | 2 +- test/join/join.js | 11 --- test/{last => }/last.test.js | 2 +- test/last/last.js | 2 - test/{lcm => }/lcm.test.js | 2 +- test/lcm/lcm.js | 6 -- .../levenshteinDistance.test.js | 2 +- .../levenshteinDistance.js | 25 ------ test/{longestItem => }/longestItem.test.js | 2 +- test/longestItem/longestItem.js | 3 - .../{lowercaseKeys => }/lowercaseKeys.test.js | 2 +- test/lowercaseKeys/lowercaseKeys.js | 6 -- test/{luhnCheck => }/luhnCheck.test.js | 2 +- test/luhnCheck/luhnCheck.js | 11 --- test/{mapKeys => }/mapKeys.test.js | 2 +- test/mapKeys/mapKeys.js | 6 -- test/{mapObject => }/mapObject.test.js | 2 +- test/mapObject/mapObject.js | 5 -- test/{mapString => }/mapString.test.js | 2 +- test/mapString/mapString.js | 6 -- test/{mapValues => }/mapValues.test.js | 2 +- test/mapValues/mapValues.js | 6 -- test/{mask => }/mask.test.js | 2 +- test/mask/mask.js | 2 - test/{matches => }/matches.test.js | 2 +- test/matches/matches.js | 3 - test/{matchesWith => }/matchesWith.test.js | 2 +- test/matchesWith/matchesWith.js | 8 -- test/{maxBy => }/maxBy.test.js | 2 +- test/maxBy/maxBy.js | 2 - test/{maxDate => }/maxDate.test.js | 2 +- test/maxDate/maxDate.js | 2 - test/{maxN => }/maxN.test.js | 2 +- test/maxN/maxN.js | 2 - test/{median => }/median.test.js | 2 +- test/median/median.js | 6 -- test/{memoize => }/memoize.test.js | 2 +- test/memoize/memoize.js | 9 -- test/{merge => }/merge.test.js | 2 +- test/merge/merge.js | 10 --- test/{minBy => }/minBy.test.js | 2 +- test/minBy/minBy.js | 2 - test/{minDate => }/minDate.test.js | 2 +- test/minDate/minDate.js | 2 - test/{minN => }/minN.test.js | 2 +- test/minN/minN.js | 2 - .../mostPerformant.test.js | 2 +- test/mostPerformant/mostPerformant.js | 9 -- test/{negate => }/negate.test.js | 2 +- test/negate/negate.js | 2 - test/{nest => }/nest.test.js | 2 +- test/nest/nest.js | 5 -- .../nodeListToArray.test.js | 2 +- test/nodeListToArray/nodeListToArray.js | 2 - test/{none => }/none.test.js | 2 +- test/none/none.js | 2 - test/{nthArg => }/nthArg.test.js | 2 +- test/nthArg/nthArg.js | 2 - test/{nthElement => }/nthElement.test.js | 2 +- test/nthElement/nthElement.js | 2 - .../objectFromPairs.test.js | 2 +- test/objectFromPairs/objectFromPairs.js | 2 - .../{objectToPairs => }/objectToPairs.test.js | 2 +- test/objectToPairs/objectToPairs.js | 2 - .../observeMutations.test.js | 2 +- test/observeMutations/observeMutations.js | 19 ---- test/{off => }/off.test.js | 2 +- test/off/off.js | 2 - test/{offset => }/offset.test.js | 2 +- test/offset/offset.js | 2 - test/{omit => }/omit.test.js | 2 +- test/omit/omit.js | 5 -- test/{omitBy => }/omitBy.test.js | 2 +- test/omitBy/omitBy.js | 5 -- test/{on => }/on.test.js | 2 +- test/on/on.js | 6 -- .../onUserInputChange.test.js | 2 +- test/onUserInputChange/onUserInputChange.js | 15 ---- test/{once => }/once.test.js | 2 +- test/once/once.js | 9 -- test/{orderBy => }/orderBy.test.js | 2 +- test/orderBy/orderBy.js | 11 --- test/{over => }/over.test.js | 2 +- test/over/over.js | 2 - test/{overArgs => }/overArgs.test.js | 2 +- test/overArgs/overArgs.js | 2 - test/{pad => }/pad.test.js | 2 +- test/pad/pad.js | 3 - test/{palindrome => }/palindrome.test.js | 2 +- test/palindrome/palindrome.js | 5 -- test/{parseCookie => }/parseCookie.test.js | 2 +- test/parseCookie/parseCookie.js | 9 -- test/{partial => }/partial.test.js | 2 +- test/partial/partial.js | 2 - test/{partialRight => }/partialRight.test.js | 2 +- test/partialRight/partialRight.js | 2 - test/{partition => }/partition.test.js | 2 +- test/partition/partition.js | 9 -- test/{percentile => }/percentile.test.js | 2 +- test/percentile/percentile.js | 3 - test/{permutations => }/permutations.test.js | 2 +- test/permutations/permutations.js | 11 --- test/{pick => }/pick.test.js | 2 +- test/pick/pick.js | 3 - test/{pickBy => }/pickBy.test.js | 2 +- test/pickBy/pickBy.js | 5 -- .../pipeAsyncFunctions.test.js | 2 +- test/pipeAsyncFunctions/pipeAsyncFunctions.js | 2 - .../{pipeFunctions => }/pipeFunctions.test.js | 2 +- test/pipeFunctions/pipeFunctions.js | 2 - test/{pipeLog => }/pipeLog.test.js | 2 +- test/pipeLog/pipeLog.js | 2 - test/{pluralize => }/pluralize.test.js | 2 +- test/pluralize/pluralize.js | 7 -- test/{powerset => }/powerset.test.js | 2 +- test/powerset/powerset.js | 2 - test/{prefix => }/prefix.test.js | 2 +- test/prefix/prefix.js | 9 -- test/{prettyBytes => }/prettyBytes.test.js | 2 +- test/prettyBytes/prettyBytes.js | 8 -- test/{primes => }/primes.test.js | 2 +- test/primes/primes.js | 8 -- test/{promisify => }/promisify.test.js | 2 +- test/promisify/promisify.js | 5 -- test/{pull => }/pull.test.js | 2 +- test/pull/pull.js | 7 -- test/{pullAtIndex => }/pullAtIndex.test.js | 2 +- test/pullAtIndex/pullAtIndex.js | 10 --- test/{pullAtValue => }/pullAtValue.test.js | 2 +- test/pullAtValue/pullAtValue.js | 9 -- test/{pullBy => }/pullBy.test.js | 2 +- test/pullBy/pullBy.js | 10 --- test/{quickSort => }/quickSort.test.js | 2 +- test/quickSort/quickSort.js | 9 -- .../{radsToDegrees => }/radsToDegrees.test.js | 2 +- test/radsToDegrees/radsToDegrees.js | 2 - .../randomHexColorCode.test.js | 2 +- test/randomHexColorCode/randomHexColorCode.js | 5 -- .../randomIntArrayInRange.test.js | 2 +- .../randomIntArrayInRange.js | 3 - .../randomIntegerInRange.test.js | 2 +- .../randomIntegerInRange.js | 2 - .../randomNumberInRange.test.js | 2 +- .../randomNumberInRange.js | 2 - .../{readFileLines => }/readFileLines.test.js | 2 +- test/readFileLines/readFileLines.js | 7 -- test/{rearg => }/rearg.test.js | 2 +- test/rearg/rearg.js | 2 - .../recordAnimationFrames.test.js | 2 +- .../recordAnimationFrames.js | 21 ----- test/{redirect => }/redirect.test.js | 2 +- test/redirect/redirect.js | 3 - .../reduceSuccessive.test.js | 2 +- test/reduceSuccessive/reduceSuccessive.js | 3 - test/{reduceWhich => }/reduceWhich.test.js | 2 +- test/reduceWhich/reduceWhich.js | 3 - .../{reducedFilter => }/reducedFilter.test.js | 2 +- test/reducedFilter/reducedFilter.js | 8 -- test/{reject => }/reject.test.js | 2 +- test/reject/reject.js | 2 - test/{remove => }/remove.test.js | 2 +- test/remove/remove.js | 8 -- .../removeNonASCII.test.js | 2 +- test/removeNonASCII/removeNonASCII.js | 2 - test/{removeVowels => }/removeVowels.test.js | 2 +- test/removeVowels/removeVowels.js | 2 - test/{renameKeys => }/renameKeys.test.js | 2 +- test/renameKeys/renameKeys.js | 9 -- .../{reverseString => }/reverseString.test.js | 2 +- test/reverseString/reverseString.js | 2 - test/{round => }/round.test.js | 2 +- test/round/round.js | 2 - test/{runAsync => }/runAsync.test.js | 2 +- test/runAsync/runAsync.js | 16 ---- .../runPromisesInSeries.test.js | 2 +- .../runPromisesInSeries.js | 2 - test/{sample => }/sample.test.js | 2 +- test/sample/sample.js | 2 - test/{sampleSize => }/sampleSize.test.js | 2 +- test/sampleSize/sampleSize.js | 9 -- test/{scrollToTop => }/scrollToTop.test.js | 2 +- test/scrollToTop/scrollToTop.js | 8 -- test/{sdbm => }/sdbm.test.js | 2 +- test/sdbm/sdbm.js | 9 -- .../serializeCookie.test.js | 2 +- test/serializeCookie/serializeCookie.js | 2 - test/{setStyle => }/setStyle.test.js | 2 +- test/setStyle/setStyle.js | 2 - test/{shallowClone => }/shallowClone.test.js | 2 +- test/shallowClone/shallowClone.js | 2 - test/{shank => }/shank.test.js | 2 +- test/shank/shank.js | 6 -- test/{show => }/show.test.js | 2 +- test/show/show.js | 2 - test/{shuffle => }/shuffle.test.js | 2 +- test/shuffle/shuffle.js | 9 -- test/{similarity => }/similarity.test.js | 2 +- test/similarity/similarity.js | 2 - test/{size => }/size.test.js | 2 +- test/size/size.js | 9 -- test/{sleep => }/sleep.test.js | 2 +- test/sleep/sleep.js | 2 - test/{smoothScroll => }/smoothScroll.test.js | 2 +- test/smoothScroll/smoothScroll.js | 5 -- test/{solveRPN => }/solveRPN.test.js | 2 +- test/solveRPN/solveRPN.js | 29 ------- .../sortCharactersInString.test.js | 2 +- .../sortCharactersInString.js | 2 - test/{sortedIndex => }/sortedIndex.test.js | 2 +- test/sortedIndex/sortedIndex.js | 6 -- .../{sortedIndexBy => }/sortedIndexBy.test.js | 2 +- test/sortedIndexBy/sortedIndexBy.js | 7 -- .../sortedLastIndex.test.js | 2 +- test/sortedLastIndex/sortedLastIndex.js | 6 -- .../sortedLastIndexBy.test.js | 2 +- test/sortedLastIndexBy/sortedLastIndexBy.js | 10 --- .../speechSynthesis.test.js | 2 +- test/speechSynthesis/speechSynthesis.js | 6 -- test/{splitLines => }/splitLines.test.js | 2 +- test/splitLines/splitLines.js | 2 - test/{spreadOver => }/spreadOver.test.js | 2 +- test/spreadOver/spreadOver.js | 2 - test/{stableSort => }/stableSort.test.js | 2 +- test/stableSort/stableSort.js | 6 -- .../standardDeviation.test.js | 2 +- test/standardDeviation/standardDeviation.js | 8 -- .../stringPermutations.test.js | 2 +- test/stringPermutations/stringPermutations.js | 11 --- .../{stripHTMLTags => }/stripHTMLTags.test.js | 2 +- test/stripHTMLTags/stripHTMLTags.js | 2 - test/{sum => }/sum.test.js | 2 +- test/sum/sum.js | 2 - test/{sumBy => }/sumBy.test.js | 2 +- test/sumBy/sumBy.js | 3 - test/{sumPower => }/sumPower.test.js | 2 +- test/sumPower/sumPower.js | 6 -- .../symmetricDifference.test.js | 2 +- .../symmetricDifference.js | 6 -- .../symmetricDifferenceBy.test.js | 2 +- .../symmetricDifferenceBy.js | 6 -- .../symmetricDifferenceWith.test.js | 2 +- .../symmetricDifferenceWith.js | 5 -- test/{tail => }/tail.test.js | 2 +- test/tail/tail.js | 2 - test/{take => }/take.test.js | 2 +- test/take/take.js | 2 - test/{takeRight => }/takeRight.test.js | 2 +- test/takeRight/takeRight.js | 2 - .../takeRightWhile.test.js | 2 +- test/takeRightWhile/takeRightWhile.js | 3 - test/{takeWhile => }/takeWhile.test.js | 2 +- test/takeWhile/takeWhile.js | 5 -- test/{throttle => }/throttle.test.js | 2 +- test/throttle/throttle.js | 21 ----- test/{timeTaken => }/timeTaken.test.js | 2 +- test/timeTaken/timeTaken.js | 7 -- test/{times => }/times.test.js | 2 +- test/times/times.js | 5 -- test/{toCamelCase => }/toCamelCase.test.js | 2 +- test/toCamelCase/toCamelCase.js | 10 --- test/{toCurrency => }/toCurrency.test.js | 2 +- test/toCurrency/toCurrency.js | 3 - .../{toDecimalMark => }/toDecimalMark.test.js | 2 +- test/toDecimalMark/toDecimalMark.js | 2 - test/{toHash => }/toHash.test.js | 2 +- test/toHash/toHash.js | 7 -- test/{toKebabCase => }/toKebabCase.test.js | 2 +- test/toKebabCase/toKebabCase.js | 7 -- .../toOrdinalSuffix.test.js | 2 +- test/toOrdinalSuffix/toOrdinalSuffix.js | 11 --- .../{toSafeInteger => }/toSafeInteger.test.js | 2 +- test/toSafeInteger/toSafeInteger.js | 3 - test/{toSnakeCase => }/toSnakeCase.test.js | 2 +- test/toSnakeCase/toSnakeCase.js | 7 -- test/{toggleClass => }/toggleClass.test.js | 2 +- test/toggleClass/toggleClass.js | 2 - test/{tomorrow => }/tomorrow.test.js | 2 +- test/tomorrow/tomorrow.js | 9 -- test/{transform => }/transform.test.js | 2 +- test/transform/transform.js | 2 - test/{triggerEvent => }/triggerEvent.test.js | 2 +- test/triggerEvent/triggerEvent.js | 3 - .../truncateString.test.js | 2 +- test/truncateString/truncateString.js | 3 - .../truthCheckCollection.test.js | 2 +- .../truthCheckCollection.js | 2 - test/{unary => }/unary.test.js | 2 +- test/unary/unary.js | 2 - test/{uncurry => }/uncurry.test.js | 2 +- test/uncurry/uncurry.js | 6 -- test/{unescapeHTML => }/unescapeHTML.test.js | 2 +- test/unescapeHTML/unescapeHTML.js | 13 --- .../unflattenObject.test.js | 2 +- test/unflattenObject/unflattenObject.js | 17 ---- test/{unfold => }/unfold.test.js | 2 +- test/unfold/unfold.js | 7 -- test/{union => }/union.test.js | 2 +- test/union/union.js | 2 - test/{unionBy => }/unionBy.test.js | 2 +- test/unionBy/unionBy.js | 5 -- test/{unionWith => }/unionWith.test.js | 2 +- test/unionWith/unionWith.js | 3 - .../uniqueElements.test.js | 2 +- test/uniqueElements/uniqueElements.js | 2 - .../uniqueElementsBy.test.js | 2 +- test/uniqueElementsBy/uniqueElementsBy.js | 6 -- .../uniqueElementsByRight.test.js | 2 +- .../uniqueElementsByRight.js | 6 -- .../uniqueSymmetricDifference.test.js | 2 +- .../uniqueSymmetricDifference.js | 4 - test/{untildify => }/untildify.test.js | 2 +- test/untildify/untildify.js | 2 - test/{unzip => }/unzip.test.js | 2 +- test/unzip/unzip.js | 8 -- test/{unzipWith => }/unzipWith.test.js | 2 +- test/unzipWith/unzipWith.js | 10 --- .../validateNumber.test.js | 2 +- test/validateNumber/validateNumber.js | 2 - test/{when => }/when.test.js | 2 +- test/when/when.js | 2 - test/{without => }/without.test.js | 2 +- test/without/without.js | 2 - test/{words => }/words.test.js | 2 +- test/words/words.js | 2 - test/{xProd => }/xProd.test.js | 2 +- test/xProd/xProd.js | 2 - test/{yesNo => }/yesNo.test.js | 2 +- test/yesNo/yesNo.js | 3 - test/{zip => }/zip.test.js | 2 +- test/zip/zip.js | 7 -- test/{zipObject => }/zipObject.test.js | 2 +- test/zipObject/zipObject.js | 3 - test/{zipWith => }/zipWith.test.js | 2 +- test/zipWith/zipWith.js | 8 -- 725 files changed, 386 insertions(+), 2333 deletions(-) rename test/{CSVToArray => }/CSVToArray.test.js (93%) delete mode 100644 test/CSVToArray/CSVToArray.js rename test/{CSVToJSON => }/CSVToJSON.test.js (91%) delete mode 100644 test/CSVToJSON/CSVToJSON.js rename test/{JSONToDate => }/JSONToDate.test.js (72%) delete mode 100644 test/JSONToDate/JSONToDate.js rename test/{JSONToFile => }/JSONToFile.test.js (72%) delete mode 100644 test/JSONToFile/JSONToFile.js rename test/{JSONtoCSV => }/JSONtoCSV.test.js (92%) delete mode 100644 test/JSONtoCSV/JSONtoCSV.js rename test/{RGBToHex => }/RGBToHex.test.js (85%) delete mode 100644 test/RGBToHex/RGBToHex.js rename test/{URLJoin => }/URLJoin.test.js (92%) delete mode 100644 test/URLJoin/URLJoin.js rename test/{UUIDGeneratorBrowser => }/UUIDGeneratorBrowser.test.js (68%) delete mode 100644 test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js rename test/{UUIDGeneratorNode => }/UUIDGeneratorNode.test.js (87%) delete mode 100644 test/UUIDGeneratorNode/UUIDGeneratorNode.js rename test/{all => }/all.test.js (96%) delete mode 100644 test/all/all.js rename test/{allEqual => }/allEqual.test.js (95%) delete mode 100644 test/allEqual/allEqual.js rename test/{any => }/any.test.js (94%) delete mode 100644 test/any/any.js rename test/{approximatelyEqual => }/approximatelyEqual.test.js (89%) delete mode 100644 test/approximatelyEqual/approximatelyEqual.js rename test/{arrayToCSV => }/arrayToCSV.test.js (89%) delete mode 100644 test/arrayToCSV/arrayToCSV.js rename test/{arrayToHtmlList => }/arrayToHtmlList.test.js (70%) delete mode 100644 test/arrayToHtmlList/arrayToHtmlList.js rename test/{ary => }/ary.test.js (89%) delete mode 100644 test/ary/ary.js rename test/{atob => }/atob.test.js (88%) delete mode 100644 test/atob/atob.js rename test/{attempt => }/attempt.test.js (88%) delete mode 100644 test/attempt/attempt.js rename test/{average => }/average.test.js (97%) delete mode 100644 test/average/average.js rename test/{averageBy => }/averageBy.test.js (90%) delete mode 100644 test/averageBy/averageBy.js rename test/{bifurcate => }/bifurcate.test.js (87%) delete mode 100644 test/bifurcate/bifurcate.js rename test/{bifurcateBy => }/bifurcateBy.test.js (86%) delete mode 100644 test/bifurcateBy/bifurcateBy.js rename test/{binarySearch => }/binarySearch.test.js (91%) delete mode 100644 test/binarySearch/binarySearch.js rename test/{bind => }/bind.test.js (91%) delete mode 100644 test/bind/bind.js rename test/{bindAll => }/bindAll.test.js (89%) delete mode 100644 test/bindAll/bindAll.js rename test/{bindKey => }/bindKey.test.js (90%) delete mode 100644 test/bindKey/bindKey.js rename test/{binomialCoefficient => }/binomialCoefficient.test.js (90%) delete mode 100644 test/binomialCoefficient/binomialCoefficient.js rename test/{bottomVisible => }/bottomVisible.test.js (71%) delete mode 100644 test/bottomVisible/bottomVisible.js rename test/{btoa => }/btoa.test.js (85%) delete mode 100644 test/btoa/btoa.js rename test/{byteSize => }/byteSize.test.js (100%) delete mode 100644 test/byteSize/byteSize.js rename test/{call => }/call.test.js (86%) delete mode 100644 test/call/call.js rename test/{capitalize => }/capitalize.test.js (91%) delete mode 100644 test/capitalize/capitalize.js rename test/{capitalizeEveryWord => }/capitalizeEveryWord.test.js (88%) delete mode 100644 test/capitalizeEveryWord/capitalizeEveryWord.js rename test/{castArray => }/castArray.test.js (92%) delete mode 100644 test/castArray/castArray.js rename test/{chainAsync => }/chainAsync.test.js (88%) delete mode 100644 test/chainAsync/chainAsync.js rename test/{chunk => }/chunk.test.js (96%) delete mode 100644 test/chunk/chunk.js rename test/{clampNumber => }/clampNumber.test.js (84%) delete mode 100644 test/clampNumber/clampNumber.js rename test/{cleanObj => }/cleanObj.test.js (89%) delete mode 100644 test/cleanObj/cleanObj.js rename test/{cloneRegExp => }/cloneRegExp.test.js (83%) delete mode 100644 test/cloneRegExp/cloneRegExp.js rename test/{coalesce => }/coalesce.test.js (85%) delete mode 100644 test/coalesce/coalesce.js rename test/{coalesceFactory => }/coalesceFactory.test.js (86%) delete mode 100644 test/coalesceFactory/coalesceFactory.js rename test/{collatz => }/collatz.test.js (91%) delete mode 100644 test/collatz/collatz.js rename test/{collectInto => }/collectInto.test.js (90%) delete mode 100644 test/collectInto/collectInto.js rename test/{colorize => }/colorize.test.js (74%) delete mode 100644 test/colorize/colorize.js rename test/{compact => }/compact.test.js (88%) delete mode 100644 test/compact/compact.js rename test/{compose => }/compose.test.js (89%) delete mode 100644 test/compose/compose.js rename test/{composeRight => }/composeRight.test.js (86%) delete mode 100644 test/composeRight/composeRight.js rename test/{converge => }/converge.test.js (92%) delete mode 100644 test/converge/converge.js rename test/{copyToClipboard => }/copyToClipboard.test.js (70%) delete mode 100644 test/copyToClipboard/copyToClipboard.js rename test/{countBy => }/countBy.test.js (89%) delete mode 100644 test/countBy/countBy.js rename test/{countOccurrences => }/countOccurrences.test.js (81%) delete mode 100644 test/countOccurrences/countOccurrences.js rename test/{countVowels => }/countVowels.test.js (72%) delete mode 100644 test/countVowels/countVowels.js rename test/{counter => }/counter.test.js (74%) delete mode 100644 test/counter/counter.js rename test/{createElement => }/createElement.test.js (71%) delete mode 100644 test/createElement/createElement.js rename test/{createEventHub => }/createEventHub.test.js (71%) delete mode 100644 test/createEventHub/createEventHub.js rename test/{currentURL => }/currentURL.test.js (72%) delete mode 100644 test/currentURL/currentURL.js rename test/{curry => }/curry.test.js (88%) delete mode 100644 test/curry/curry.js rename test/{dayOfYear => }/dayOfYear.test.js (73%) delete mode 100644 test/dayOfYear/dayOfYear.js rename test/{debounce => }/debounce.test.js (83%) delete mode 100644 test/debounce/debounce.js rename test/{decapitalize => }/decapitalize.test.js (87%) delete mode 100644 test/decapitalize/decapitalize.js rename test/{deepClone => }/deepClone.test.js (92%) delete mode 100644 test/deepClone/deepClone.js rename test/{deepFlatten => }/deepFlatten.test.js (83%) delete mode 100644 test/deepFlatten/deepFlatten.js rename test/{deepFreeze => }/deepFreeze.test.js (93%) delete mode 100644 test/deepFreeze/deepFreeze.js rename test/{defaults => }/defaults.test.js (86%) delete mode 100644 test/defaults/defaults.js rename test/{defer => }/defer.test.js (75%) delete mode 100644 test/defer/defer.js rename test/{degreesToRads => }/degreesToRads.test.js (85%) delete mode 100644 test/degreesToRads/degreesToRads.js rename test/{delay => }/delay.test.js (88%) delete mode 100644 test/delay/delay.js rename test/{detectDeviceType => }/detectDeviceType.test.js (70%) delete mode 100644 test/detectDeviceType/detectDeviceType.js rename test/{difference => }/difference.test.js (83%) delete mode 100644 test/difference/difference.js rename test/{differenceBy => }/differenceBy.test.js (89%) delete mode 100644 test/differenceBy/differenceBy.js rename test/{differenceWith => }/differenceWith.test.js (85%) delete mode 100644 test/differenceWith/differenceWith.js rename test/{dig => }/dig.test.js (94%) delete mode 100644 test/dig/dig.js rename test/{digitize => }/digitize.test.js (84%) delete mode 100644 test/digitize/digitize.js rename test/{distance => }/distance.test.js (85%) delete mode 100644 test/distance/distance.js rename test/{drop => }/drop.test.js (92%) delete mode 100644 test/drop/drop.js rename test/{dropRight => }/dropRight.test.js (91%) delete mode 100644 test/dropRight/dropRight.js rename test/{dropRightWhile => }/dropRightWhile.test.js (84%) delete mode 100644 test/dropRightWhile/dropRightWhile.js rename test/{dropWhile => }/dropWhile.test.js (86%) delete mode 100644 test/dropWhile/dropWhile.js rename test/{elementContains => }/elementContains.test.js (70%) delete mode 100644 test/elementContains/elementContains.js rename test/{elementIsVisibleInViewport => }/elementIsVisibleInViewport.test.js (66%) delete mode 100644 test/elementIsVisibleInViewport/elementIsVisibleInViewport.js rename test/{elo => }/elo.test.js (92%) delete mode 100644 test/elo/elo.js rename test/{equals => }/equals.test.js (95%) delete mode 100644 test/equals/equals.js rename test/{escapeHTML => }/escapeHTML.test.js (86%) delete mode 100644 test/escapeHTML/escapeHTML.js rename test/{escapeRegExp => }/escapeRegExp.test.js (83%) delete mode 100644 test/escapeRegExp/escapeRegExp.js rename test/{everyNth => }/everyNth.test.js (84%) delete mode 100644 test/everyNth/everyNth.js rename test/{extendHex => }/extendHex.test.js (88%) delete mode 100644 test/extendHex/extendHex.js rename test/{factorial => }/factorial.test.js (92%) delete mode 100644 test/factorial/factorial.js rename test/{factors => }/factors.test.js (74%) delete mode 100644 test/factors/factors.js rename test/{fibonacci => }/fibonacci.test.js (84%) delete mode 100644 test/fibonacci/fibonacci.js rename test/{fibonacciCountUntilNum => }/fibonacciCountUntilNum.test.js (68%) delete mode 100644 test/fibonacciCountUntilNum/fibonacciCountUntilNum.js rename test/{fibonacciUntilNum => }/fibonacciUntilNum.test.js (69%) delete mode 100644 test/fibonacciUntilNum/fibonacciUntilNum.js rename test/{filterNonUnique => }/filterNonUnique.test.js (82%) delete mode 100644 test/filterNonUnique/filterNonUnique.js rename test/{filterNonUniqueBy => }/filterNonUniqueBy.test.js (93%) delete mode 100644 test/filterNonUniqueBy/filterNonUniqueBy.js rename test/{findKey => }/findKey.test.js (90%) delete mode 100644 test/findKey/findKey.js rename test/{findLast => }/findLast.test.js (85%) delete mode 100644 test/findLast/findLast.js rename test/{findLastIndex => }/findLastIndex.test.js (83%) delete mode 100644 test/findLastIndex/findLastIndex.js rename test/{findLastKey => }/findLastKey.test.js (89%) delete mode 100644 test/findLastKey/findLastKey.js rename test/{flatten => }/flatten.test.js (89%) delete mode 100644 test/flatten/flatten.js rename test/{flattenObject => }/flattenObject.test.js (88%) delete mode 100644 test/flattenObject/flattenObject.js rename test/{flip => }/flip.test.js (89%) delete mode 100644 test/flip/flip.js rename test/{forEachRight => }/forEachRight.test.js (84%) delete mode 100644 test/forEachRight/forEachRight.js rename test/{forOwn => }/forOwn.test.js (88%) delete mode 100644 test/forOwn/forOwn.js rename test/{forOwnRight => }/forOwnRight.test.js (86%) delete mode 100644 test/forOwnRight/forOwnRight.js rename test/{formatDuration => }/formatDuration.test.js (89%) delete mode 100644 test/formatDuration/formatDuration.js rename test/{fromCamelCase => }/fromCamelCase.test.js (91%) delete mode 100644 test/fromCamelCase/fromCamelCase.js rename test/{functionName => }/functionName.test.js (100%) delete mode 100644 test/functionName/functionName.js rename test/{functions => }/functions.test.js (90%) delete mode 100644 test/functions/functions.js rename test/{gcd => }/gcd.test.js (91%) delete mode 100644 test/gcd/gcd.js rename test/{geometricProgression => }/geometricProgression.test.js (90%) delete mode 100644 test/geometricProgression/geometricProgression.js rename test/{get => }/get.test.js (89%) delete mode 100644 test/get/get.js rename test/{getColonTimeFromDate => }/getColonTimeFromDate.test.js (68%) delete mode 100644 test/getColonTimeFromDate/getColonTimeFromDate.js rename test/{getDaysDiffBetweenDates => }/getDaysDiffBetweenDates.test.js (81%) delete mode 100644 test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js rename test/{getImages => }/getImages.test.js (93%) delete mode 100644 test/getImages/getImages.js rename test/{getMeridiemSuffixOfInteger => }/getMeridiemSuffixOfInteger.test.js (66%) delete mode 100644 test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js rename test/{getScrollPosition => }/getScrollPosition.test.js (69%) delete mode 100644 test/getScrollPosition/getScrollPosition.js rename test/{getStyle => }/getStyle.test.js (74%) delete mode 100644 test/getStyle/getStyle.js rename test/{getType => }/getType.test.js (84%) delete mode 100644 test/getType/getType.js rename test/{getURLParameters => }/getURLParameters.test.js (85%) delete mode 100644 test/getURLParameters/getURLParameters.js rename test/{groupBy => }/groupBy.test.js (91%) delete mode 100644 test/groupBy/groupBy.js rename test/{hammingDistance => }/hammingDistance.test.js (80%) delete mode 100644 test/hammingDistance/hammingDistance.js rename test/{hasClass => }/hasClass.test.js (74%) delete mode 100644 test/hasClass/hasClass.js rename test/{hasFlags => }/hasFlags.test.js (74%) delete mode 100644 test/hasFlags/hasFlags.js rename test/{hashBrowser => }/hashBrowser.test.js (72%) delete mode 100644 test/hashBrowser/hashBrowser.js rename test/{hashNode => }/hashNode.test.js (89%) delete mode 100644 test/hashNode/hashNode.js rename test/{head => }/head.test.js (96%) delete mode 100644 test/head/head.js rename test/{heronArea => }/heronArea.test.js (73%) delete mode 100644 test/heronArea/heronArea.js rename test/{hexToRGB => }/hexToRGB.test.js (92%) delete mode 100644 test/hexToRGB/hexToRGB.js rename test/{hide => }/hide.test.js (75%) delete mode 100644 test/hide/hide.js rename test/{howManyTimes => }/howManyTimes.test.js (71%) delete mode 100644 test/howManyTimes/howManyTimes.js rename test/{httpDelete => }/httpDelete.test.js (72%) delete mode 100644 test/httpDelete/httpDelete.js rename test/{httpGet => }/httpGet.test.js (74%) delete mode 100644 test/httpGet/httpGet.js rename test/{httpPost => }/httpPost.test.js (74%) delete mode 100644 test/httpPost/httpPost.js rename test/{httpPut => }/httpPut.test.js (74%) delete mode 100644 test/httpPut/httpPut.js rename test/{httpsRedirect => }/httpsRedirect.test.js (71%) delete mode 100644 test/httpsRedirect/httpsRedirect.js rename test/{hz => }/hz.test.js (76%) delete mode 100644 test/hz/hz.js rename test/{inRange => }/inRange.test.js (93%) delete mode 100644 test/inRange/inRange.js rename test/{indentString => }/indentString.test.js (87%) delete mode 100644 test/indentString/indentString.js rename test/{indexOfAll => }/indexOfAll.test.js (88%) delete mode 100644 test/indexOfAll/indexOfAll.js rename test/{initial => }/initial.test.js (85%) delete mode 100644 test/initial/initial.js rename test/{initialize2DArray => }/initialize2DArray.test.js (82%) delete mode 100644 test/initialize2DArray/initialize2DArray.js rename test/{initializeArrayWithRange => }/initializeArrayWithRange.test.js (89%) delete mode 100644 test/initializeArrayWithRange/initializeArrayWithRange.js rename test/{initializeArrayWithRangeRight => }/initializeArrayWithRangeRight.test.js (66%) delete mode 100644 test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js rename test/{initializeArrayWithValues => }/initializeArrayWithValues.test.js (79%) delete mode 100644 test/initializeArrayWithValues/initializeArrayWithValues.js rename test/{initializeNDArray => }/initializeNDArray.test.js (69%) delete mode 100644 test/initializeNDArray/initializeNDArray.js rename test/{insertAfter => }/insertAfter.test.js (72%) delete mode 100644 test/insertAfter/insertAfter.js rename test/{insertBefore => }/insertBefore.test.js (71%) delete mode 100644 test/insertBefore/insertBefore.js rename test/{intersection => }/intersection.test.js (83%) delete mode 100644 test/intersection/intersection.js rename test/{intersectionBy => }/intersectionBy.test.js (86%) delete mode 100644 test/intersectionBy/intersectionBy.js rename test/{intersectionWith => }/intersectionWith.test.js (87%) delete mode 100644 test/intersectionWith/intersectionWith.js rename test/{invertKeyValues => }/invertKeyValues.test.js (91%) delete mode 100644 test/invertKeyValues/invertKeyValues.js rename test/{is => }/is.test.js (97%) delete mode 100644 test/is/is.js rename test/{isAbsoluteURL => }/isAbsoluteURL.test.js (89%) delete mode 100644 test/isAbsoluteURL/isAbsoluteURL.js rename test/{isAfterDate => }/isAfterDate.test.js (89%) delete mode 100644 test/isAfterDate/isAfterDate.js rename test/{isAnagram => }/isAnagram.test.js (92%) delete mode 100644 test/isAnagram/isAnagram.js rename test/{isArmstrongNumber => }/isArmstrongNumber.test.js (69%) delete mode 100644 test/isArmstrongNumber/isArmstrongNumber.js delete mode 100644 test/isArray/isArray.js delete mode 100644 test/isArray/isArray.test.js delete mode 100644 test/isArrayBuffer/isArrayBuffer.js delete mode 100644 test/isArrayBuffer/isArrayBuffer.test.js rename test/{isArrayLike => }/isArrayLike.test.js (88%) delete mode 100644 test/isArrayLike/isArrayLike.js rename test/{isBeforeDate => }/isBeforeDate.test.js (89%) delete mode 100644 test/isBeforeDate/isBeforeDate.js rename test/{isBoolean => }/isBoolean.test.js (87%) delete mode 100644 test/isBoolean/isBoolean.js rename test/{isBrowser => }/isBrowser.test.js (73%) delete mode 100644 test/isBrowser/isBrowser.js rename test/{isBrowserTabFocused => }/isBrowserTabFocused.test.js (69%) delete mode 100644 test/isBrowserTabFocused/isBrowserTabFocused.js rename test/{isDivisible => }/isDivisible.test.js (81%) delete mode 100644 test/isDivisible/isDivisible.js rename test/{isDuplexStream => }/isDuplexStream.test.js (52%) delete mode 100644 test/isDuplexStream/isDuplexStream.js rename test/{isEmpty => }/isEmpty.test.js (96%) delete mode 100644 test/isEmpty/isEmpty.js rename test/{isEven => }/isEven.test.js (87%) delete mode 100644 test/isEven/isEven.js rename test/{isFunction => }/isFunction.test.js (86%) delete mode 100644 test/isFunction/isFunction.js rename test/{isLowerCase => }/isLowerCase.test.js (89%) delete mode 100644 test/isLowerCase/isLowerCase.js delete mode 100644 test/isMap/isMap.js delete mode 100644 test/isMap/isMap.test.js rename test/{isNil => }/isNil.test.js (90%) delete mode 100644 test/isNil/isNil.js rename test/{isNull => }/isNull.test.js (87%) delete mode 100644 test/isNull/isNull.js rename test/{isNumber => }/isNumber.test.js (87%) delete mode 100644 test/isNumber/isNumber.js rename test/{isObject => }/isObject.test.js (91%) delete mode 100644 test/isObject/isObject.js rename test/{isObjectLike => }/isObjectLike.test.js (90%) delete mode 100644 test/isObjectLike/isObjectLike.js rename test/{isPlainObject => }/isPlainObject.test.js (87%) delete mode 100644 test/isPlainObject/isPlainObject.js rename test/{isPrime => }/isPrime.test.js (83%) delete mode 100644 test/isPrime/isPrime.js rename test/{isPrimitive => }/isPrimitive.test.js (96%) delete mode 100644 test/isPrimitive/isPrimitive.js rename test/{isPromiseLike => }/isPromiseLike.test.js (88%) delete mode 100644 test/isPromiseLike/isPromiseLike.js rename test/{isReadableStream => }/isReadableStream.test.js (68%) delete mode 100644 test/isReadableStream/isReadableStream.js delete mode 100644 test/isRegExp/isRegExp.js delete mode 100644 test/isRegExp/isRegExp.test.js rename test/{isSameDate => }/isSameDate.test.js (89%) delete mode 100644 test/isSameDate/isSameDate.js delete mode 100644 test/isSet/isSet.js delete mode 100644 test/isSet/isSet.test.js rename test/{isSimilar => }/isSimilar.test.js (73%) delete mode 100644 test/isSimilar/isSimilar.js rename test/{isSorted => }/isSorted.test.js (96%) delete mode 100644 test/isSorted/isSorted.js rename test/{isStream => }/isStream.test.js (70%) delete mode 100644 test/isStream/isStream.js rename test/{isString => }/isString.test.js (92%) delete mode 100644 test/isString/isString.js rename test/{isSymbol => }/isSymbol.test.js (84%) delete mode 100644 test/isSymbol/isSymbol.js rename test/{isTravisCI => }/isTravisCI.test.js (88%) delete mode 100644 test/isTravisCI/isTravisCI.js delete mode 100644 test/isTypedArray/isTypedArray.js delete mode 100644 test/isTypedArray/isTypedArray.test.js rename test/{isUndefined => }/isUndefined.test.js (81%) delete mode 100644 test/isUndefined/isUndefined.js rename test/{isUpperCase => }/isUpperCase.test.js (88%) delete mode 100644 test/isUpperCase/isUpperCase.js rename test/{isValidJSON => }/isValidJSON.test.js (90%) delete mode 100644 test/isValidJSON/isValidJSON.js delete mode 100644 test/isWeakMap/isWeakMap.js delete mode 100644 test/isWeakMap/isWeakMap.test.js delete mode 100644 test/isWeakSet/isWeakSet.js delete mode 100644 test/isWeakSet/isWeakSet.test.js rename test/{isWritableStream => }/isWritableStream.test.js (68%) delete mode 100644 test/isWritableStream/isWritableStream.js rename test/{join => }/join.test.js (94%) delete mode 100644 test/join/join.js rename test/{last => }/last.test.js (96%) delete mode 100644 test/last/last.js rename test/{lcm => }/lcm.test.js (90%) delete mode 100644 test/lcm/lcm.js rename test/{levenshteinDistance => }/levenshteinDistance.test.js (69%) delete mode 100644 test/levenshteinDistance/levenshteinDistance.js rename test/{longestItem => }/longestItem.test.js (95%) delete mode 100644 test/longestItem/longestItem.js rename test/{lowercaseKeys => }/lowercaseKeys.test.js (89%) delete mode 100644 test/lowercaseKeys/lowercaseKeys.js rename test/{luhnCheck => }/luhnCheck.test.js (90%) delete mode 100644 test/luhnCheck/luhnCheck.js rename test/{mapKeys => }/mapKeys.test.js (85%) delete mode 100644 test/mapKeys/mapKeys.js rename test/{mapObject => }/mapObject.test.js (93%) delete mode 100644 test/mapObject/mapObject.js rename test/{mapString => }/mapString.test.js (93%) delete mode 100644 test/mapString/mapString.js rename test/{mapValues => }/mapValues.test.js (87%) delete mode 100644 test/mapValues/mapValues.js rename test/{mask => }/mask.test.js (93%) delete mode 100644 test/mask/mask.js rename test/{matches => }/matches.test.js (92%) delete mode 100644 test/matches/matches.js rename test/{matchesWith => }/matchesWith.test.js (89%) delete mode 100644 test/matchesWith/matchesWith.js rename test/{maxBy => }/maxBy.test.js (91%) delete mode 100644 test/maxBy/maxBy.js rename test/{maxDate => }/maxDate.test.js (89%) delete mode 100644 test/maxDate/maxDate.js rename test/{maxN => }/maxN.test.js (90%) delete mode 100644 test/maxN/maxN.js rename test/{median => }/median.test.js (89%) delete mode 100644 test/median/median.js rename test/{memoize => }/memoize.test.js (91%) delete mode 100644 test/memoize/memoize.js rename test/{merge => }/merge.test.js (91%) delete mode 100644 test/merge/merge.js rename test/{minBy => }/minBy.test.js (91%) delete mode 100644 test/minBy/minBy.js rename test/{minDate => }/minDate.test.js (89%) delete mode 100644 test/minDate/minDate.js rename test/{minN => }/minN.test.js (90%) delete mode 100644 test/minN/minN.js rename test/{mostPerformant => }/mostPerformant.test.js (71%) delete mode 100644 test/mostPerformant/mostPerformant.js rename test/{negate => }/negate.test.js (86%) delete mode 100644 test/negate/negate.js rename test/{nest => }/nest.test.js (75%) delete mode 100644 test/nest/nest.js rename test/{nodeListToArray => }/nodeListToArray.test.js (70%) delete mode 100644 test/nodeListToArray/nodeListToArray.js rename test/{none => }/none.test.js (93%) delete mode 100644 test/none/none.js rename test/{nthArg => }/nthArg.test.js (91%) delete mode 100644 test/nthArg/nthArg.js rename test/{nthElement => }/nthElement.test.js (88%) delete mode 100644 test/nthElement/nthElement.js rename test/{objectFromPairs => }/objectFromPairs.test.js (83%) delete mode 100644 test/objectFromPairs/objectFromPairs.js rename test/{objectToPairs => }/objectToPairs.test.js (84%) delete mode 100644 test/objectToPairs/objectToPairs.js rename test/{observeMutations => }/observeMutations.test.js (70%) delete mode 100644 test/observeMutations/observeMutations.js rename test/{off => }/off.test.js (75%) delete mode 100644 test/off/off.js rename test/{offset => }/offset.test.js (95%) delete mode 100644 test/offset/offset.js rename test/{omit => }/omit.test.js (88%) delete mode 100644 test/omit/omit.js rename test/{omitBy => }/omitBy.test.js (88%) delete mode 100644 test/omitBy/omitBy.js rename test/{on => }/on.test.js (76%) delete mode 100644 test/on/on.js rename test/{onUserInputChange => }/onUserInputChange.test.js (69%) delete mode 100644 test/onUserInputChange/onUserInputChange.js rename test/{once => }/once.test.js (75%) delete mode 100644 test/once/once.js rename test/{orderBy => }/orderBy.test.js (94%) delete mode 100644 test/orderBy/orderBy.js rename test/{over => }/over.test.js (88%) delete mode 100644 test/over/over.js rename test/{overArgs => }/overArgs.test.js (89%) delete mode 100644 test/overArgs/overArgs.js rename test/{pad => }/pad.test.js (93%) delete mode 100644 test/pad/pad.js rename test/{palindrome => }/palindrome.test.js (87%) delete mode 100644 test/palindrome/palindrome.js rename test/{parseCookie => }/parseCookie.test.js (84%) delete mode 100644 test/parseCookie/parseCookie.js rename test/{partial => }/partial.test.js (88%) delete mode 100644 test/partial/partial.js rename test/{partialRight => }/partialRight.test.js (86%) delete mode 100644 test/partialRight/partialRight.js rename test/{partition => }/partition.test.js (91%) delete mode 100644 test/partition/partition.js rename test/{percentile => }/percentile.test.js (87%) delete mode 100644 test/percentile/percentile.js rename test/{permutations => }/permutations.test.js (86%) delete mode 100644 test/permutations/permutations.js rename test/{pick => }/pick.test.js (88%) delete mode 100644 test/pick/pick.js rename test/{pickBy => }/pickBy.test.js (89%) delete mode 100644 test/pickBy/pickBy.js rename test/{pipeAsyncFunctions => }/pipeAsyncFunctions.test.js (86%) delete mode 100644 test/pipeAsyncFunctions/pipeAsyncFunctions.js rename test/{pipeFunctions => }/pipeFunctions.test.js (86%) delete mode 100644 test/pipeFunctions/pipeFunctions.js rename test/{pipeLog => }/pipeLog.test.js (74%) delete mode 100644 test/pipeLog/pipeLog.js rename test/{pluralize => }/pluralize.test.js (94%) delete mode 100644 test/pluralize/pluralize.js rename test/{powerset => }/powerset.test.js (85%) delete mode 100644 test/powerset/powerset.js rename test/{prefix => }/prefix.test.js (75%) delete mode 100644 test/prefix/prefix.js rename test/{prettyBytes => }/prettyBytes.test.js (91%) delete mode 100644 test/prettyBytes/prettyBytes.js rename test/{primes => }/primes.test.js (86%) delete mode 100644 test/primes/primes.js rename test/{promisify => }/promisify.test.js (89%) delete mode 100644 test/promisify/promisify.js rename test/{pull => }/pull.test.js (88%) delete mode 100644 test/pull/pull.js rename test/{pullAtIndex => }/pullAtIndex.test.js (88%) delete mode 100644 test/pullAtIndex/pullAtIndex.js rename test/{pullAtValue => }/pullAtValue.test.js (88%) delete mode 100644 test/pullAtValue/pullAtValue.js rename test/{pullBy => }/pullBy.test.js (88%) delete mode 100644 test/pullBy/pullBy.js rename test/{quickSort => }/quickSort.test.js (96%) delete mode 100644 test/quickSort/quickSort.js rename test/{radsToDegrees => }/radsToDegrees.test.js (81%) delete mode 100644 test/radsToDegrees/radsToDegrees.js rename test/{randomHexColorCode => }/randomHexColorCode.test.js (89%) delete mode 100644 test/randomHexColorCode/randomHexColorCode.js rename test/{randomIntArrayInRange => }/randomIntArrayInRange.test.js (91%) delete mode 100644 test/randomIntArrayInRange/randomIntArrayInRange.js rename test/{randomIntegerInRange => }/randomIntegerInRange.test.js (90%) delete mode 100644 test/randomIntegerInRange/randomIntegerInRange.js rename test/{randomNumberInRange => }/randomNumberInRange.test.js (90%) delete mode 100644 test/randomNumberInRange/randomNumberInRange.js rename test/{readFileLines => }/readFileLines.test.js (71%) delete mode 100644 test/readFileLines/readFileLines.js rename test/{rearg => }/rearg.test.js (89%) delete mode 100644 test/rearg/rearg.js rename test/{recordAnimationFrames => }/recordAnimationFrames.test.js (68%) delete mode 100644 test/recordAnimationFrames/recordAnimationFrames.js rename test/{redirect => }/redirect.test.js (74%) delete mode 100644 test/redirect/redirect.js rename test/{reduceSuccessive => }/reduceSuccessive.test.js (85%) delete mode 100644 test/reduceSuccessive/reduceSuccessive.js rename test/{reduceWhich => }/reduceWhich.test.js (92%) delete mode 100644 test/reduceWhich/reduceWhich.js rename test/{reducedFilter => }/reducedFilter.test.js (89%) delete mode 100644 test/reducedFilter/reducedFilter.js rename test/{reject => }/reject.test.js (91%) delete mode 100644 test/reject/reject.js rename test/{remove => }/remove.test.js (87%) delete mode 100644 test/remove/remove.js rename test/{removeNonASCII => }/removeNonASCII.test.js (83%) delete mode 100644 test/removeNonASCII/removeNonASCII.js rename test/{removeVowels => }/removeVowels.test.js (71%) delete mode 100644 test/removeVowels/removeVowels.js rename test/{renameKeys => }/renameKeys.test.js (89%) delete mode 100644 test/renameKeys/renameKeys.js rename test/{reverseString => }/reverseString.test.js (80%) delete mode 100644 test/reverseString/reverseString.js rename test/{round => }/round.test.js (96%) delete mode 100644 test/round/round.js rename test/{runAsync => }/runAsync.test.js (74%) delete mode 100644 test/runAsync/runAsync.js rename test/{runPromisesInSeries => }/runPromisesInSeries.test.js (84%) delete mode 100644 test/runPromisesInSeries/runPromisesInSeries.js rename test/{sample => }/sample.test.js (91%) delete mode 100644 test/sample/sample.js rename test/{sampleSize => }/sampleSize.test.js (93%) delete mode 100644 test/sampleSize/sampleSize.js rename test/{scrollToTop => }/scrollToTop.test.js (72%) delete mode 100644 test/scrollToTop/scrollToTop.js rename test/{sdbm => }/sdbm.test.js (85%) delete mode 100644 test/sdbm/sdbm.js rename test/{serializeCookie => }/serializeCookie.test.js (80%) delete mode 100644 test/serializeCookie/serializeCookie.js rename test/{setStyle => }/setStyle.test.js (74%) delete mode 100644 test/setStyle/setStyle.js rename test/{shallowClone => }/shallowClone.test.js (87%) delete mode 100644 test/shallowClone/shallowClone.js rename test/{shank => }/shank.test.js (93%) delete mode 100644 test/shank/shank.js rename test/{show => }/show.test.js (75%) delete mode 100644 test/show/show.js rename test/{shuffle => }/shuffle.test.js (92%) delete mode 100644 test/shuffle/shuffle.js rename test/{similarity => }/similarity.test.js (84%) delete mode 100644 test/similarity/similarity.js rename test/{size => }/size.test.js (89%) delete mode 100644 test/size/size.js rename test/{sleep => }/sleep.test.js (86%) delete mode 100644 test/sleep/sleep.js rename test/{smoothScroll => }/smoothScroll.test.js (71%) delete mode 100644 test/smoothScroll/smoothScroll.js rename test/{solveRPN => }/solveRPN.test.js (74%) delete mode 100644 test/solveRPN/solveRPN.js rename test/{sortCharactersInString => }/sortCharactersInString.test.js (79%) delete mode 100644 test/sortCharactersInString/sortCharactersInString.js rename test/{sortedIndex => }/sortedIndex.test.js (90%) delete mode 100644 test/sortedIndex/sortedIndex.js rename test/{sortedIndexBy => }/sortedIndexBy.test.js (85%) delete mode 100644 test/sortedIndexBy/sortedIndexBy.js rename test/{sortedLastIndex => }/sortedLastIndex.test.js (84%) delete mode 100644 test/sortedLastIndex/sortedLastIndex.js rename test/{sortedLastIndexBy => }/sortedLastIndexBy.test.js (84%) delete mode 100644 test/sortedLastIndexBy/sortedLastIndexBy.js rename test/{speechSynthesis => }/speechSynthesis.test.js (70%) delete mode 100644 test/speechSynthesis/speechSynthesis.js rename test/{splitLines => }/splitLines.test.js (87%) delete mode 100644 test/splitLines/splitLines.js rename test/{spreadOver => }/spreadOver.test.js (88%) delete mode 100644 test/spreadOver/spreadOver.js rename test/{stableSort => }/stableSort.test.js (86%) delete mode 100644 test/stableSort/stableSort.js rename test/{standardDeviation => }/standardDeviation.test.js (88%) delete mode 100644 test/standardDeviation/standardDeviation.js rename test/{stringPermutations => }/stringPermutations.test.js (88%) delete mode 100644 test/stringPermutations/stringPermutations.js rename test/{stripHTMLTags => }/stripHTMLTags.test.js (84%) delete mode 100644 test/stripHTMLTags/stripHTMLTags.js rename test/{sum => }/sum.test.js (85%) delete mode 100644 test/sum/sum.js rename test/{sumBy => }/sumBy.test.js (75%) delete mode 100644 test/sumBy/sumBy.js rename test/{sumPower => }/sumPower.test.js (92%) delete mode 100644 test/sumPower/sumPower.js rename test/{symmetricDifference => }/symmetricDifference.test.js (86%) delete mode 100644 test/symmetricDifference/symmetricDifference.js rename test/{symmetricDifferenceBy => }/symmetricDifferenceBy.test.js (84%) delete mode 100644 test/symmetricDifferenceBy/symmetricDifferenceBy.js rename test/{symmetricDifferenceWith => }/symmetricDifferenceWith.test.js (85%) delete mode 100644 test/symmetricDifferenceWith/symmetricDifferenceWith.js rename test/{tail => }/tail.test.js (87%) delete mode 100644 test/tail/tail.js rename test/{take => }/take.test.js (90%) delete mode 100644 test/take/take.js rename test/{takeRight => }/takeRight.test.js (89%) delete mode 100644 test/takeRight/takeRight.js rename test/{takeRightWhile => }/takeRightWhile.test.js (83%) delete mode 100644 test/takeRightWhile/takeRightWhile.js rename test/{takeWhile => }/takeWhile.test.js (85%) delete mode 100644 test/takeWhile/takeWhile.js rename test/{throttle => }/throttle.test.js (74%) delete mode 100644 test/throttle/throttle.js rename test/{timeTaken => }/timeTaken.test.js (73%) delete mode 100644 test/timeTaken/timeTaken.js rename test/{times => }/times.test.js (87%) delete mode 100644 test/times/times.js rename test/{toCamelCase => }/toCamelCase.test.js (97%) delete mode 100644 test/toCamelCase/toCamelCase.js rename test/{toCurrency => }/toCurrency.test.js (93%) delete mode 100644 test/toCurrency/toCurrency.js rename test/{toDecimalMark => }/toDecimalMark.test.js (84%) delete mode 100644 test/toDecimalMark/toDecimalMark.js rename test/{toHash => }/toHash.test.js (75%) delete mode 100644 test/toHash/toHash.js rename test/{toKebabCase => }/toKebabCase.test.js (97%) delete mode 100644 test/toKebabCase/toKebabCase.js rename test/{toOrdinalSuffix => }/toOrdinalSuffix.test.js (90%) delete mode 100644 test/toOrdinalSuffix/toOrdinalSuffix.js rename test/{toSafeInteger => }/toSafeInteger.test.js (96%) delete mode 100644 test/toSafeInteger/toSafeInteger.js rename test/{toSnakeCase => }/toSnakeCase.test.js (97%) delete mode 100644 test/toSnakeCase/toSnakeCase.js rename test/{toggleClass => }/toggleClass.test.js (72%) delete mode 100644 test/toggleClass/toggleClass.js rename test/{tomorrow => }/tomorrow.test.js (92%) delete mode 100644 test/tomorrow/tomorrow.js rename test/{transform => }/transform.test.js (89%) delete mode 100644 test/transform/transform.js rename test/{triggerEvent => }/triggerEvent.test.js (71%) delete mode 100644 test/triggerEvent/triggerEvent.js rename test/{truncateString => }/truncateString.test.js (82%) delete mode 100644 test/truncateString/truncateString.js rename test/{truthCheckCollection => }/truthCheckCollection.test.js (84%) delete mode 100644 test/truthCheckCollection/truthCheckCollection.js rename test/{unary => }/unary.test.js (86%) delete mode 100644 test/unary/unary.js rename test/{uncurry => }/uncurry.test.js (92%) delete mode 100644 test/uncurry/uncurry.js rename test/{unescapeHTML => }/unescapeHTML.test.js (85%) delete mode 100644 test/unescapeHTML/unescapeHTML.js rename test/{unflattenObject => }/unflattenObject.test.js (83%) delete mode 100644 test/unflattenObject/unflattenObject.js rename test/{unfold => }/unfold.test.js (88%) delete mode 100644 test/unfold/unfold.js rename test/{union => }/union.test.js (97%) delete mode 100644 test/union/union.js rename test/{unionBy => }/unionBy.test.js (85%) delete mode 100644 test/unionBy/unionBy.js rename test/{unionWith => }/unionWith.test.js (87%) delete mode 100644 test/unionWith/unionWith.js rename test/{uniqueElements => }/uniqueElements.test.js (97%) delete mode 100644 test/uniqueElements/uniqueElements.js rename test/{uniqueElementsBy => }/uniqueElementsBy.test.js (94%) delete mode 100644 test/uniqueElementsBy/uniqueElementsBy.js rename test/{uniqueElementsByRight => }/uniqueElementsByRight.test.js (93%) delete mode 100644 test/uniqueElementsByRight/uniqueElementsByRight.js rename test/{uniqueSymmetricDifference => }/uniqueSymmetricDifference.test.js (85%) delete mode 100644 test/uniqueSymmetricDifference/uniqueSymmetricDifference.js rename test/{untildify => }/untildify.test.js (91%) delete mode 100644 test/untildify/untildify.js rename test/{unzip => }/unzip.test.js (92%) delete mode 100644 test/unzip/unzip.js rename test/{unzipWith => }/unzipWith.test.js (89%) delete mode 100644 test/unzipWith/unzipWith.js rename test/{validateNumber => }/validateNumber.test.js (96%) delete mode 100644 test/validateNumber/validateNumber.js rename test/{when => }/when.test.js (90%) delete mode 100644 test/when/when.js rename test/{without => }/without.test.js (96%) delete mode 100644 test/without/without.js rename test/{words => }/words.test.js (96%) delete mode 100644 test/words/words.js rename test/{xProd => }/xProd.test.js (88%) delete mode 100644 test/xProd/xProd.js rename test/{yesNo => }/yesNo.test.js (96%) delete mode 100644 test/yesNo/yesNo.js rename test/{zip => }/zip.test.js (96%) delete mode 100644 test/zip/zip.js rename test/{zipObject => }/zipObject.test.js (96%) delete mode 100644 test/zipObject/zipObject.js rename test/{zipWith => }/zipWith.test.js (74%) delete mode 100644 test/zipWith/zipWith.js diff --git a/scripts/tdd.js b/scripts/tdd.js index 64b18f078..46cf22799 100644 --- a/scripts/tdd.js +++ b/scripts/tdd.js @@ -14,79 +14,38 @@ if (util.isTravisCI() && util.isNotTravisCronOrAPI()) { process.exit(0); } // Declare paths -const SNIPPETS_ACTIVE = './snippets'; -const SNIPPETS_ARCHIVE = './snippets_archive'; +const SNIPPETS_PATH = './snippets'; +const SNIPPETS_ARCHIVE_PATH = './snippets_archive'; const TEST_PATH = './test'; -// Array of snippet names -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)); - -snippetFiles.push(...snippetFilesActive); -snippetFiles.push(...snippetFilesArchive); - console.time('Tester'); -snippetFiles - .map(fileName => { - // Check if fileName for snippet exist in test/ dir, if doesnt create - fs.ensureDirSync(path.join(TEST_PATH, fileName)); - - // return fileName for later use - return fileName; +try { + // Read snippets, archive and tests, find which tests are not defined + const snippets = fs.readdirSync(SNIPPETS_PATH).map(v => v.replace('.md', '')); + const archivedSnippets = fs.readdirSync(SNIPPETS_ARCHIVE_PATH).filter(v => v !== 'README.md').map(v => v.replace('.md', '')); + const definedTests = fs.readdirSync(TEST_PATH).map(v => v.replace('.test.js', '')).filter(v => v !== '_30s.js' && v !== 'testlog'); + const undefinedTests = [...snippets, ...archivedSnippets].filter(v => !definedTests.includes(v)); + const orphanedTests = [...definedTests.filter(v => ![...snippets, ...archivedSnippets].includes(v))]; + orphanedTests.forEach(snippet => { + console.log(`${chalk.yellow('WARNING!')} Orphaned test: ${snippet}`); }) - .map(fileName => { - const activeOrArchive = snippetFilesActive.includes(fileName) - ? SNIPPETS_ACTIVE - : SNIPPETS_ARCHIVE; - // Grab snippetData - const fileData = fs.readFileSync(path.join(activeOrArchive, `${fileName}.md`), 'utf8'); - // Grab snippet Code blocks - 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//')); - // Grab snippet function based on code markers - const fileFunction = fileCode - .split('\n') - .map(line => line) - .filter((_, i) => blockMarkers[0] < i && i < blockMarkers[1]); - - // Export template for snippetName.js - const exportFile = `${fileFunction.join('\n')}\nmodule.exports = ${fileName};\n`; - - // Export template for snippetName.test.js which generates a example test & other information + // Create files for undefined tests + undefinedTests.forEach(snippet => { const exportTest = [ `const expect = require('expect');`, - `const ${fileName} = require('./${fileName}.js');`, - `\ntest('${fileName} is a Function', () => {`, - ` expect(${fileName}).toBeInstanceOf(Function);`, + `const {${snippet}} = require('._30s.js');`, + `\ntest('${snippet} is a Function', () => {`, + ` expect(${snippet}).toBeInstanceOf(Function);`, `});\n` ].join('\n'); - - // Write/Update exportFile which is snippetName.js in respective dir - fs.writeFileSync(path.join(TEST_PATH, fileName, `${fileName}.js`), exportFile); - - if (!fs.existsSync(path.join(TEST_PATH, fileName, `${fileName}.test.js`))) { - // if snippetName.test.js doesn't exist inrespective dir exportTest - fs.writeFileSync(`${TEST_PATH}/${fileName}/${fileName}.test.js`, exportTest); - } - - // return fileName for later use - return fileName; + fs.writeFileSync(path.join(TEST_PATH, `${snippet}.test.js`), exportTest); }); -try { + // Run tests fs.writeFileSync(path.join(TEST_PATH, 'testlog'), `Test log for: ${new Date().toString()}\n`); childProcess.execSync('npm test'); -} catch (e) { - fs.appendFileSync(path.join(TEST_PATH, 'testlog')); + console.log(`${chalk.green('SUCCESS!')} All tests ran successfully!`); +} catch (err) { + console.log(`${chalk.red('ERROR!')} During test runs: ${err}`); + process.exit(1); } -console.timeEnd('Tester'); +console.timeEnd('Tester'); \ No newline at end of file diff --git a/test/CSVToArray/CSVToArray.test.js b/test/CSVToArray.test.js similarity index 93% rename from test/CSVToArray/CSVToArray.test.js rename to test/CSVToArray.test.js index 868ad679e..b938fa4ea 100644 --- a/test/CSVToArray/CSVToArray.test.js +++ b/test/CSVToArray.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const CSVToArray = require('./CSVToArray.js'); +const {CSVToArray} = require('./_30s.js'); test('CSVToArray is a Function', () => { expect(CSVToArray).toBeInstanceOf(Function); diff --git a/test/CSVToArray/CSVToArray.js b/test/CSVToArray/CSVToArray.js deleted file mode 100644 index da9287894..000000000 --- a/test/CSVToArray/CSVToArray.js +++ /dev/null @@ -1,6 +0,0 @@ -const CSVToArray = (data, delimiter = ',', omitFirstRow = false) => - data - .slice(omitFirstRow ? data.indexOf('\n') + 1 : 0) - .split('\n') - .map(v => v.split(delimiter)); -module.exports = CSVToArray; diff --git a/test/CSVToJSON/CSVToJSON.test.js b/test/CSVToJSON.test.js similarity index 91% rename from test/CSVToJSON/CSVToJSON.test.js rename to test/CSVToJSON.test.js index 16c115bf2..b89986287 100644 --- a/test/CSVToJSON/CSVToJSON.test.js +++ b/test/CSVToJSON.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const CSVToJSON = require('./CSVToJSON.js'); +const {CSVToJSON} = require('./_30s.js'); test('CSVToJSON is a Function', () => { expect(CSVToJSON).toBeInstanceOf(Function); diff --git a/test/CSVToJSON/CSVToJSON.js b/test/CSVToJSON/CSVToJSON.js deleted file mode 100644 index d9504142c..000000000 --- a/test/CSVToJSON/CSVToJSON.js +++ /dev/null @@ -1,11 +0,0 @@ -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), {}); - }); -}; -module.exports = CSVToJSON; diff --git a/test/JSONToDate/JSONToDate.test.js b/test/JSONToDate.test.js similarity index 72% rename from test/JSONToDate/JSONToDate.test.js rename to test/JSONToDate.test.js index 8a9ca3412..d1c041a98 100644 --- a/test/JSONToDate/JSONToDate.test.js +++ b/test/JSONToDate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const JSONToDate = require('./JSONToDate.js'); +const {JSONToDate} = require('./_30s.js'); test('JSONToDate is a Function', () => { expect(JSONToDate).toBeInstanceOf(Function); diff --git a/test/JSONToDate/JSONToDate.js b/test/JSONToDate/JSONToDate.js deleted file mode 100644 index 3111603c9..000000000 --- a/test/JSONToDate/JSONToDate.js +++ /dev/null @@ -1,5 +0,0 @@ -const JSONToDate = arr => { - const dt = new Date(parseInt(arr.toString().substr(6))); - return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`; -}; -module.exports = JSONToDate; diff --git a/test/JSONToFile/JSONToFile.test.js b/test/JSONToFile.test.js similarity index 72% rename from test/JSONToFile/JSONToFile.test.js rename to test/JSONToFile.test.js index 325eface8..165e47b4a 100644 --- a/test/JSONToFile/JSONToFile.test.js +++ b/test/JSONToFile.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const JSONToFile = require('./JSONToFile.js'); +const {JSONToFile} = require('./_30s.js'); test('JSONToFile is a Function', () => { expect(JSONToFile).toBeInstanceOf(Function); diff --git a/test/JSONToFile/JSONToFile.js b/test/JSONToFile/JSONToFile.js deleted file mode 100644 index 1111c55b2..000000000 --- a/test/JSONToFile/JSONToFile.js +++ /dev/null @@ -1,4 +0,0 @@ -const fs = require('fs'); -const JSONToFile = (obj, filename) => - fs.writeFile(`${filename}.json`, JSON.stringify(obj, null, 2)); -module.exports = JSONToFile; diff --git a/test/JSONtoCSV/JSONtoCSV.test.js b/test/JSONtoCSV.test.js similarity index 92% rename from test/JSONtoCSV/JSONtoCSV.test.js rename to test/JSONtoCSV.test.js index aed050f58..294fc23c2 100644 --- a/test/JSONtoCSV/JSONtoCSV.test.js +++ b/test/JSONtoCSV.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const JSONtoCSV = require('./JSONtoCSV.js'); +const {JSONtoCSV} = require('./_30s.js'); test('JSONtoCSV is a Function', () => { expect(JSONtoCSV).toBeInstanceOf(Function); diff --git a/test/JSONtoCSV/JSONtoCSV.js b/test/JSONtoCSV/JSONtoCSV.js deleted file mode 100644 index 81cf14b43..000000000 --- a/test/JSONtoCSV/JSONtoCSV.js +++ /dev/null @@ -1,11 +0,0 @@ -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'); -module.exports = JSONtoCSV; diff --git a/test/RGBToHex/RGBToHex.test.js b/test/RGBToHex.test.js similarity index 85% rename from test/RGBToHex/RGBToHex.test.js rename to test/RGBToHex.test.js index 70892c498..49f723ee2 100644 --- a/test/RGBToHex/RGBToHex.test.js +++ b/test/RGBToHex.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const RGBToHex = require('./RGBToHex.js'); +const {RGBToHex} = require('./_30s.js'); test('RGBToHex is a Function', () => { expect(RGBToHex).toBeInstanceOf(Function); diff --git a/test/RGBToHex/RGBToHex.js b/test/RGBToHex/RGBToHex.js deleted file mode 100644 index 9f829a0f9..000000000 --- a/test/RGBToHex/RGBToHex.js +++ /dev/null @@ -1,2 +0,0 @@ -const RGBToHex = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0'); -module.exports = RGBToHex; diff --git a/test/URLJoin/URLJoin.test.js b/test/URLJoin.test.js similarity index 92% rename from test/URLJoin/URLJoin.test.js rename to test/URLJoin.test.js index dbc0a511b..544bd65c0 100644 --- a/test/URLJoin/URLJoin.test.js +++ b/test/URLJoin.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const URLJoin = require('./URLJoin.js'); +const {URLJoin} = require('./_30s.js'); test('URLJoin is a Function', () => { expect(URLJoin).toBeInstanceOf(Function); diff --git a/test/URLJoin/URLJoin.js b/test/URLJoin/URLJoin.js deleted file mode 100644 index 52490a893..000000000 --- a/test/URLJoin/URLJoin.js +++ /dev/null @@ -1,10 +0,0 @@ -const URLJoin = (...args) => - args - .join('/') - .replace(/[\/]+/g, '/') - .replace(/^(.+):\//, '$1://') - .replace(/^file:/, 'file:/') - .replace(/\/(\?|&|#[^!])/g, '$1') - .replace(/\?/g, '&') - .replace('&', '?'); -module.exports = URLJoin; diff --git a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js b/test/UUIDGeneratorBrowser.test.js similarity index 68% rename from test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js rename to test/UUIDGeneratorBrowser.test.js index 60033da0e..f0b4bb4ef 100644 --- a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js +++ b/test/UUIDGeneratorBrowser.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const UUIDGeneratorBrowser = require('./UUIDGeneratorBrowser.js'); +const {UUIDGeneratorBrowser} = require('./_30s.js'); test('UUIDGeneratorBrowser is a Function', () => { expect(UUIDGeneratorBrowser).toBeInstanceOf(Function); diff --git a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js deleted file mode 100644 index 000ec1279..000000000 --- a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js +++ /dev/null @@ -1,5 +0,0 @@ -const UUIDGeneratorBrowser = () => - ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => - (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16) - ); -module.exports = UUIDGeneratorBrowser; diff --git a/test/UUIDGeneratorNode/UUIDGeneratorNode.test.js b/test/UUIDGeneratorNode.test.js similarity index 87% rename from test/UUIDGeneratorNode/UUIDGeneratorNode.test.js rename to test/UUIDGeneratorNode.test.js index 8c3aa4356..a98eabcc5 100644 --- a/test/UUIDGeneratorNode/UUIDGeneratorNode.test.js +++ b/test/UUIDGeneratorNode.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const UUIDGeneratorNode = require('./UUIDGeneratorNode.js'); +const {UUIDGeneratorNode} = require('./_30s.js'); test('UUIDGeneratorNode is a Function', () => { expect(UUIDGeneratorNode).toBeInstanceOf(Function); diff --git a/test/UUIDGeneratorNode/UUIDGeneratorNode.js b/test/UUIDGeneratorNode/UUIDGeneratorNode.js deleted file mode 100644 index 6e314792e..000000000 --- a/test/UUIDGeneratorNode/UUIDGeneratorNode.js +++ /dev/null @@ -1,6 +0,0 @@ -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) - ); -module.exports = UUIDGeneratorNode; diff --git a/test/all/all.test.js b/test/all.test.js similarity index 96% rename from test/all/all.test.js rename to test/all.test.js index 8e072acf6..f0fbf739d 100644 --- a/test/all/all.test.js +++ b/test/all.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const all = require('./all.js'); +const {all} = require('./_30s.js'); test('all is a Function', () => { expect(all).toBeInstanceOf(Function); diff --git a/test/all/all.js b/test/all/all.js deleted file mode 100644 index d07bb7f7a..000000000 --- a/test/all/all.js +++ /dev/null @@ -1,2 +0,0 @@ -const all = (arr, fn = Boolean) => arr.every(fn); -module.exports = all; diff --git a/test/allEqual/allEqual.test.js b/test/allEqual.test.js similarity index 95% rename from test/allEqual/allEqual.test.js rename to test/allEqual.test.js index 220b61cbf..ea1ac4629 100644 --- a/test/allEqual/allEqual.test.js +++ b/test/allEqual.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const allEqual = require('./allEqual.js'); +const {allEqual} = require('./_30s.js'); test('allEqual is a Function', () => { expect(allEqual).toBeInstanceOf(Function); diff --git a/test/allEqual/allEqual.js b/test/allEqual/allEqual.js deleted file mode 100644 index 79f392d3b..000000000 --- a/test/allEqual/allEqual.js +++ /dev/null @@ -1,2 +0,0 @@ -const allEqual = arr => arr.every(val => val === arr[0]); -module.exports = allEqual; diff --git a/test/any/any.test.js b/test/any.test.js similarity index 94% rename from test/any/any.test.js rename to test/any.test.js index 003b22654..89a38a29b 100644 --- a/test/any/any.test.js +++ b/test/any.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const any = require('./any.js'); +const {any} = require('./_30s.js'); test('any is a Function', () => { expect(any).toBeInstanceOf(Function); diff --git a/test/any/any.js b/test/any/any.js deleted file mode 100644 index 87a89d9e4..000000000 --- a/test/any/any.js +++ /dev/null @@ -1,2 +0,0 @@ -const any = (arr, fn = Boolean) => arr.some(fn); -module.exports = any; diff --git a/test/approximatelyEqual/approximatelyEqual.test.js b/test/approximatelyEqual.test.js similarity index 89% rename from test/approximatelyEqual/approximatelyEqual.test.js rename to test/approximatelyEqual.test.js index 462e9455f..c0bab6e2e 100644 --- a/test/approximatelyEqual/approximatelyEqual.test.js +++ b/test/approximatelyEqual.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const approximatelyEqual = require('./approximatelyEqual.js'); +const {approximatelyEqual} = require('./_30s.js'); test('approximatelyEqual is a Function', () => { expect(approximatelyEqual).toBeInstanceOf(Function); diff --git a/test/approximatelyEqual/approximatelyEqual.js b/test/approximatelyEqual/approximatelyEqual.js deleted file mode 100644 index d519097ed..000000000 --- a/test/approximatelyEqual/approximatelyEqual.js +++ /dev/null @@ -1,2 +0,0 @@ -const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon; -module.exports = approximatelyEqual; diff --git a/test/arrayToCSV/arrayToCSV.test.js b/test/arrayToCSV.test.js similarity index 89% rename from test/arrayToCSV/arrayToCSV.test.js rename to test/arrayToCSV.test.js index f45ce65b7..c9d36d114 100644 --- a/test/arrayToCSV/arrayToCSV.test.js +++ b/test/arrayToCSV.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const arrayToCSV = require('./arrayToCSV.js'); +const {arrayToCSV} = require('./_30s.js'); test('arrayToCSV is a Function', () => { expect(arrayToCSV).toBeInstanceOf(Function); diff --git a/test/arrayToCSV/arrayToCSV.js b/test/arrayToCSV/arrayToCSV.js deleted file mode 100644 index 561628034..000000000 --- a/test/arrayToCSV/arrayToCSV.js +++ /dev/null @@ -1,3 +0,0 @@ -const arrayToCSV = (arr, delimiter = ',') => - arr.map(v => v.map(x => `"${x}"`).join(delimiter)).join('\n'); -module.exports = arrayToCSV; diff --git a/test/arrayToHtmlList/arrayToHtmlList.test.js b/test/arrayToHtmlList.test.js similarity index 70% rename from test/arrayToHtmlList/arrayToHtmlList.test.js rename to test/arrayToHtmlList.test.js index 07a97dcf8..a751a7c87 100644 --- a/test/arrayToHtmlList/arrayToHtmlList.test.js +++ b/test/arrayToHtmlList.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const arrayToHtmlList = require('./arrayToHtmlList.js'); +const {arrayToHtmlList} = require('./_30s.js'); test('arrayToHtmlList is a Function', () => { expect(arrayToHtmlList).toBeInstanceOf(Function); diff --git a/test/arrayToHtmlList/arrayToHtmlList.js b/test/arrayToHtmlList/arrayToHtmlList.js deleted file mode 100644 index e669b1c81..000000000 --- a/test/arrayToHtmlList/arrayToHtmlList.js +++ /dev/null @@ -1,6 +0,0 @@ -const arrayToHtmlList = (arr, listID) => - (el => ( - (el = document.querySelector('#' + listID)), - (el.innerHTML += arr.map(item => `
  • ${item}
  • `).join('')) - ))(); -module.exports = arrayToHtmlList; diff --git a/test/ary/ary.test.js b/test/ary.test.js similarity index 89% rename from test/ary/ary.test.js rename to test/ary.test.js index e695ca124..dd9816d9e 100644 --- a/test/ary/ary.test.js +++ b/test/ary.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const ary = require('./ary.js'); +const {ary} = require('./_30s.js'); test('ary is a Function', () => { expect(ary).toBeInstanceOf(Function); diff --git a/test/ary/ary.js b/test/ary/ary.js deleted file mode 100644 index cde6753cd..000000000 --- a/test/ary/ary.js +++ /dev/null @@ -1,2 +0,0 @@ -const ary = (fn, n) => (...args) => fn(...args.slice(0, n)); -module.exports = ary; diff --git a/test/atob/atob.test.js b/test/atob.test.js similarity index 88% rename from test/atob/atob.test.js rename to test/atob.test.js index 43c4f1386..e33428f9c 100644 --- a/test/atob/atob.test.js +++ b/test/atob.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const atob = require('./atob.js'); +const {atob} = require('./_30s.js'); test('atob is a Function', () => { expect(atob).toBeInstanceOf(Function); diff --git a/test/atob/atob.js b/test/atob/atob.js deleted file mode 100644 index 6dc03b03b..000000000 --- a/test/atob/atob.js +++ /dev/null @@ -1,2 +0,0 @@ -const atob = str => Buffer.from(str, 'base64').toString('binary'); -module.exports = atob; diff --git a/test/attempt/attempt.test.js b/test/attempt.test.js similarity index 88% rename from test/attempt/attempt.test.js rename to test/attempt.test.js index 8d70bcba3..1dd0f1ce3 100644 --- a/test/attempt/attempt.test.js +++ b/test/attempt.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const attempt = require('./attempt.js'); +const {attempt} = require('./_30s.js'); test('attempt is a Function', () => { expect(attempt).toBeInstanceOf(Function); diff --git a/test/attempt/attempt.js b/test/attempt/attempt.js deleted file mode 100644 index e7ffd905f..000000000 --- a/test/attempt/attempt.js +++ /dev/null @@ -1,8 +0,0 @@ -const attempt = (fn, ...args) => { - try { - return fn(...args); - } catch (e) { - return e instanceof Error ? e : new Error(e); - } -}; -module.exports = attempt; diff --git a/test/average/average.test.js b/test/average.test.js similarity index 97% rename from test/average/average.test.js rename to test/average.test.js index ee2a971a0..47efaa0d8 100644 --- a/test/average/average.test.js +++ b/test/average.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const average = require('./average.js'); +const {average} = require('./_30s.js'); test('average is a Function', () => { expect(average).toBeInstanceOf(Function); diff --git a/test/average/average.js b/test/average/average.js deleted file mode 100644 index b1ddb1022..000000000 --- a/test/average/average.js +++ /dev/null @@ -1,2 +0,0 @@ -const average = (...nums) => nums.reduce((acc, val) => acc + val, 0) / nums.length; -module.exports = average; diff --git a/test/averageBy/averageBy.test.js b/test/averageBy.test.js similarity index 90% rename from test/averageBy/averageBy.test.js rename to test/averageBy.test.js index 044d407df..401413357 100644 --- a/test/averageBy/averageBy.test.js +++ b/test/averageBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const averageBy = require('./averageBy.js'); +const {averageBy} = require('./_30s.js'); test('averageBy is a Function', () => { expect(averageBy).toBeInstanceOf(Function); diff --git a/test/averageBy/averageBy.js b/test/averageBy/averageBy.js deleted file mode 100644 index dc9f07bc7..000000000 --- a/test/averageBy/averageBy.js +++ /dev/null @@ -1,4 +0,0 @@ -const averageBy = (arr, fn) => - arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0) / - arr.length; -module.exports = averageBy; diff --git a/test/bifurcate/bifurcate.test.js b/test/bifurcate.test.js similarity index 87% rename from test/bifurcate/bifurcate.test.js rename to test/bifurcate.test.js index 3f00f268e..ea615b714 100644 --- a/test/bifurcate/bifurcate.test.js +++ b/test/bifurcate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const bifurcate = require('./bifurcate.js'); +const {bifurcate} = require('./_30s.js'); test('bifurcate is a Function', () => { expect(bifurcate).toBeInstanceOf(Function); diff --git a/test/bifurcate/bifurcate.js b/test/bifurcate/bifurcate.js deleted file mode 100644 index ca677ab8c..000000000 --- a/test/bifurcate/bifurcate.js +++ /dev/null @@ -1,3 +0,0 @@ -const bifurcate = (arr, filter) => - arr.reduce((acc, val, i) => (acc[filter[i] ? 0 : 1].push(val), acc), [[], []]); -module.exports = bifurcate; diff --git a/test/bifurcateBy/bifurcateBy.test.js b/test/bifurcateBy.test.js similarity index 86% rename from test/bifurcateBy/bifurcateBy.test.js rename to test/bifurcateBy.test.js index 19206aaa9..561062f21 100644 --- a/test/bifurcateBy/bifurcateBy.test.js +++ b/test/bifurcateBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const bifurcateBy = require('./bifurcateBy.js'); +const {bifurcateBy} = require('./_30s.js'); test('bifurcateBy is a Function', () => { expect(bifurcateBy).toBeInstanceOf(Function); diff --git a/test/bifurcateBy/bifurcateBy.js b/test/bifurcateBy/bifurcateBy.js deleted file mode 100644 index 0bb0abff5..000000000 --- a/test/bifurcateBy/bifurcateBy.js +++ /dev/null @@ -1,3 +0,0 @@ -const bifurcateBy = (arr, fn) => - arr.reduce((acc, val, i) => (acc[fn(val, i) ? 0 : 1].push(val), acc), [[], []]); -module.exports = bifurcateBy; diff --git a/test/binarySearch/binarySearch.test.js b/test/binarySearch.test.js similarity index 91% rename from test/binarySearch/binarySearch.test.js rename to test/binarySearch.test.js index a00680bb6..c2213e791 100644 --- a/test/binarySearch/binarySearch.test.js +++ b/test/binarySearch.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const binarySearch = require('./binarySearch.js'); +const {binarySearch} = require('./_30s.js'); test('binarySearch is a Function', () => { expect(binarySearch).toBeInstanceOf(Function); diff --git a/test/binarySearch/binarySearch.js b/test/binarySearch/binarySearch.js deleted file mode 100644 index 9dc64a9a2..000000000 --- a/test/binarySearch/binarySearch.js +++ /dev/null @@ -1,8 +0,0 @@ -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; -}; -module.exports = binarySearch; diff --git a/test/bind/bind.test.js b/test/bind.test.js similarity index 91% rename from test/bind/bind.test.js rename to test/bind.test.js index 423b2b8d9..eee002b11 100644 --- a/test/bind/bind.test.js +++ b/test/bind.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const bind = require('./bind.js'); +const {bind} = require('./_30s.js'); test('bind is a Function', () => { expect(bind).toBeInstanceOf(Function); diff --git a/test/bind/bind.js b/test/bind/bind.js deleted file mode 100644 index e764a4cc2..000000000 --- a/test/bind/bind.js +++ /dev/null @@ -1,2 +0,0 @@ -const bind = (fn, context, ...boundArgs) => (...args) => fn.apply(context, [...boundArgs, ...args]); -module.exports = bind; diff --git a/test/bindAll/bindAll.test.js b/test/bindAll.test.js similarity index 89% rename from test/bindAll/bindAll.test.js rename to test/bindAll.test.js index dbbeda4a5..193225167 100644 --- a/test/bindAll/bindAll.test.js +++ b/test/bindAll.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const bindAll = require('./bindAll.js'); +const {bindAll} = require('./_30s.js'); test('bindAll is a Function', () => { expect(bindAll).toBeInstanceOf(Function); diff --git a/test/bindAll/bindAll.js b/test/bindAll/bindAll.js deleted file mode 100644 index c96fd973c..000000000 --- a/test/bindAll/bindAll.js +++ /dev/null @@ -1,10 +0,0 @@ -const bindAll = (obj, ...fns) => - fns.forEach( - fn => ( - (f = obj[fn]), - (obj[fn] = function() { - return f.apply(obj); - }) - ) - ); -module.exports = bindAll; diff --git a/test/bindKey/bindKey.test.js b/test/bindKey.test.js similarity index 90% rename from test/bindKey/bindKey.test.js rename to test/bindKey.test.js index cce1b4c98..cf1586955 100644 --- a/test/bindKey/bindKey.test.js +++ b/test/bindKey.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const bindKey = require('./bindKey.js'); +const {bindKey} = require('./_30s.js'); test('bindKey is a Function', () => { expect(bindKey).toBeInstanceOf(Function); diff --git a/test/bindKey/bindKey.js b/test/bindKey/bindKey.js deleted file mode 100644 index e9abf1eb6..000000000 --- a/test/bindKey/bindKey.js +++ /dev/null @@ -1,3 +0,0 @@ -const bindKey = (context, fn, ...boundArgs) => (...args) => - context[fn].apply(context, [...boundArgs, ...args]); -module.exports = bindKey; diff --git a/test/binomialCoefficient/binomialCoefficient.test.js b/test/binomialCoefficient.test.js similarity index 90% rename from test/binomialCoefficient/binomialCoefficient.test.js rename to test/binomialCoefficient.test.js index e4ca4f3ce..894c006bd 100644 --- a/test/binomialCoefficient/binomialCoefficient.test.js +++ b/test/binomialCoefficient.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const binomialCoefficient = require('./binomialCoefficient.js'); +const {binomialCoefficient} = require('./_30s.js'); test('binomialCoefficient is a Function', () => { expect(binomialCoefficient).toBeInstanceOf(Function); diff --git a/test/binomialCoefficient/binomialCoefficient.js b/test/binomialCoefficient/binomialCoefficient.js deleted file mode 100644 index cab25b72e..000000000 --- a/test/binomialCoefficient/binomialCoefficient.js +++ /dev/null @@ -1,11 +0,0 @@ -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); -}; -module.exports = binomialCoefficient; diff --git a/test/bottomVisible/bottomVisible.test.js b/test/bottomVisible.test.js similarity index 71% rename from test/bottomVisible/bottomVisible.test.js rename to test/bottomVisible.test.js index 6769b3cbd..591d985b0 100644 --- a/test/bottomVisible/bottomVisible.test.js +++ b/test/bottomVisible.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const bottomVisible = require('./bottomVisible.js'); +const {bottomVisible} = require('./_30s.js'); test('bottomVisible is a Function', () => { expect(bottomVisible).toBeInstanceOf(Function); diff --git a/test/bottomVisible/bottomVisible.js b/test/bottomVisible/bottomVisible.js deleted file mode 100644 index 3dc6e2fae..000000000 --- a/test/bottomVisible/bottomVisible.js +++ /dev/null @@ -1,4 +0,0 @@ -const bottomVisible = () => - document.documentElement.clientHeight + window.scrollY >= - (document.documentElement.scrollHeight || document.documentElement.clientHeight); -module.exports = bottomVisible; diff --git a/test/btoa/btoa.test.js b/test/btoa.test.js similarity index 85% rename from test/btoa/btoa.test.js rename to test/btoa.test.js index 36b740293..0ff0fd28e 100644 --- a/test/btoa/btoa.test.js +++ b/test/btoa.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const btoa = require('./btoa.js'); +const {btoa} = require('./_30s.js'); test('btoa is a Function', () => { expect(btoa).toBeInstanceOf(Function); diff --git a/test/btoa/btoa.js b/test/btoa/btoa.js deleted file mode 100644 index 7d2ae5545..000000000 --- a/test/btoa/btoa.js +++ /dev/null @@ -1,2 +0,0 @@ -const btoa = str => Buffer.from(str, 'binary').toString('base64'); -module.exports = btoa; diff --git a/test/byteSize/byteSize.test.js b/test/byteSize.test.js similarity index 100% rename from test/byteSize/byteSize.test.js rename to test/byteSize.test.js diff --git a/test/byteSize/byteSize.js b/test/byteSize/byteSize.js deleted file mode 100644 index 485e03833..000000000 --- a/test/byteSize/byteSize.js +++ /dev/null @@ -1,2 +0,0 @@ -const byteSize = str => new Blob([str]).size; -module.exports = byteSize; diff --git a/test/call/call.test.js b/test/call.test.js similarity index 86% rename from test/call/call.test.js rename to test/call.test.js index a90669ddf..710982b12 100644 --- a/test/call/call.test.js +++ b/test/call.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const call = require('./call.js'); +const {call} = require('./_30s.js'); test('call is a Function', () => { expect(call).toBeInstanceOf(Function); diff --git a/test/call/call.js b/test/call/call.js deleted file mode 100644 index 1a92c2273..000000000 --- a/test/call/call.js +++ /dev/null @@ -1,2 +0,0 @@ -const call = (key, ...args) => context => context[key](...args); -module.exports = call; diff --git a/test/capitalize/capitalize.test.js b/test/capitalize.test.js similarity index 91% rename from test/capitalize/capitalize.test.js rename to test/capitalize.test.js index 68fe363e7..d8120ccda 100644 --- a/test/capitalize/capitalize.test.js +++ b/test/capitalize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const capitalize = require('./capitalize.js'); +const {capitalize} = require('./_30s.js'); test('capitalize is a Function', () => { expect(capitalize).toBeInstanceOf(Function); diff --git a/test/capitalize/capitalize.js b/test/capitalize/capitalize.js deleted file mode 100644 index e773adfb7..000000000 --- a/test/capitalize/capitalize.js +++ /dev/null @@ -1,3 +0,0 @@ -const capitalize = ([first, ...rest], lowerRest = false) => - first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join('')); -module.exports = capitalize; diff --git a/test/capitalizeEveryWord/capitalizeEveryWord.test.js b/test/capitalizeEveryWord.test.js similarity index 88% rename from test/capitalizeEveryWord/capitalizeEveryWord.test.js rename to test/capitalizeEveryWord.test.js index a57e2619d..34eb92fd5 100644 --- a/test/capitalizeEveryWord/capitalizeEveryWord.test.js +++ b/test/capitalizeEveryWord.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const capitalizeEveryWord = require('./capitalizeEveryWord.js'); +const {capitalizeEveryWord} = require('./_30s.js'); test('capitalizeEveryWord is a Function', () => { expect(capitalizeEveryWord).toBeInstanceOf(Function); diff --git a/test/capitalizeEveryWord/capitalizeEveryWord.js b/test/capitalizeEveryWord/capitalizeEveryWord.js deleted file mode 100644 index 1f8cfa1cb..000000000 --- a/test/capitalizeEveryWord/capitalizeEveryWord.js +++ /dev/null @@ -1,2 +0,0 @@ -const capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCase()); -module.exports = capitalizeEveryWord; diff --git a/test/castArray/castArray.test.js b/test/castArray.test.js similarity index 92% rename from test/castArray/castArray.test.js rename to test/castArray.test.js index 8aa60ce18..ad741671c 100644 --- a/test/castArray/castArray.test.js +++ b/test/castArray.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const castArray = require('./castArray.js'); +const {castArray} = require('./_30s.js'); test('castArray is a Function', () => { expect(castArray).toBeInstanceOf(Function); diff --git a/test/castArray/castArray.js b/test/castArray/castArray.js deleted file mode 100644 index 13cc5f469..000000000 --- a/test/castArray/castArray.js +++ /dev/null @@ -1,2 +0,0 @@ -const castArray = val => (Array.isArray(val) ? val : [val]); -module.exports = castArray; diff --git a/test/chainAsync/chainAsync.test.js b/test/chainAsync.test.js similarity index 88% rename from test/chainAsync/chainAsync.test.js rename to test/chainAsync.test.js index 9d69ef316..ba640c625 100644 --- a/test/chainAsync/chainAsync.test.js +++ b/test/chainAsync.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const chainAsync = require('./chainAsync.js'); +const {chainAsync} = require('./_30s.js'); test('chainAsync is a Function', () => { expect(chainAsync).toBeInstanceOf(Function); diff --git a/test/chainAsync/chainAsync.js b/test/chainAsync/chainAsync.js deleted file mode 100644 index 447f56893..000000000 --- a/test/chainAsync/chainAsync.js +++ /dev/null @@ -1,6 +0,0 @@ -const chainAsync = fns => { - let curr = 0; - const next = () => fns[curr++](next); - next(); -}; -module.exports = chainAsync; diff --git a/test/chunk/chunk.test.js b/test/chunk.test.js similarity index 96% rename from test/chunk/chunk.test.js rename to test/chunk.test.js index 4025cf4ed..2acb7a405 100644 --- a/test/chunk/chunk.test.js +++ b/test/chunk.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const chunk = require('./chunk.js'); +const {chunk} = require('./_30s.js'); test('chunk is a Function', () => { expect(chunk).toBeInstanceOf(Function); diff --git a/test/chunk/chunk.js b/test/chunk/chunk.js deleted file mode 100644 index 20cc304aa..000000000 --- a/test/chunk/chunk.js +++ /dev/null @@ -1,5 +0,0 @@ -const chunk = (arr, size) => - Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => - arr.slice(i * size, i * size + size) - ); -module.exports = chunk; diff --git a/test/clampNumber/clampNumber.test.js b/test/clampNumber.test.js similarity index 84% rename from test/clampNumber/clampNumber.test.js rename to test/clampNumber.test.js index 828e82a05..a89dfc84a 100644 --- a/test/clampNumber/clampNumber.test.js +++ b/test/clampNumber.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const clampNumber = require('./clampNumber.js'); +const {clampNumber} = require('./_30s.js'); test('clampNumber is a Function', () => { expect(clampNumber).toBeInstanceOf(Function); diff --git a/test/clampNumber/clampNumber.js b/test/clampNumber/clampNumber.js deleted file mode 100644 index b448e319a..000000000 --- a/test/clampNumber/clampNumber.js +++ /dev/null @@ -1,2 +0,0 @@ -const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); -module.exports = clampNumber; diff --git a/test/cleanObj/cleanObj.test.js b/test/cleanObj.test.js similarity index 89% rename from test/cleanObj/cleanObj.test.js rename to test/cleanObj.test.js index 0a9c81c6d..ce1d5025f 100644 --- a/test/cleanObj/cleanObj.test.js +++ b/test/cleanObj.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const cleanObj = require('./cleanObj.js'); +const {cleanObj} = require('./_30s.js'); test('cleanObj is a Function', () => { expect(cleanObj).toBeInstanceOf(Function); diff --git a/test/cleanObj/cleanObj.js b/test/cleanObj/cleanObj.js deleted file mode 100644 index 5ab9f69e3..000000000 --- a/test/cleanObj/cleanObj.js +++ /dev/null @@ -1,11 +0,0 @@ -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; -}; -module.exports = cleanObj; diff --git a/test/cloneRegExp/cloneRegExp.test.js b/test/cloneRegExp.test.js similarity index 83% rename from test/cloneRegExp/cloneRegExp.test.js rename to test/cloneRegExp.test.js index d16147c7a..1ad340a22 100644 --- a/test/cloneRegExp/cloneRegExp.test.js +++ b/test/cloneRegExp.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const cloneRegExp = require('./cloneRegExp.js'); +const {cloneRegExp} = require('./_30s.js'); test('cloneRegExp is a Function', () => { expect(cloneRegExp).toBeInstanceOf(Function); diff --git a/test/cloneRegExp/cloneRegExp.js b/test/cloneRegExp/cloneRegExp.js deleted file mode 100644 index e78c57bbe..000000000 --- a/test/cloneRegExp/cloneRegExp.js +++ /dev/null @@ -1,2 +0,0 @@ -const cloneRegExp = regExp => new RegExp(regExp.source, regExp.flags); -module.exports = cloneRegExp; diff --git a/test/coalesce/coalesce.test.js b/test/coalesce.test.js similarity index 85% rename from test/coalesce/coalesce.test.js rename to test/coalesce.test.js index 05a6a93c0..d10b812e1 100644 --- a/test/coalesce/coalesce.test.js +++ b/test/coalesce.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const coalesce = require('./coalesce.js'); +const {coalesce} = require('./_30s.js'); test('coalesce is a Function', () => { expect(coalesce).toBeInstanceOf(Function); diff --git a/test/coalesce/coalesce.js b/test/coalesce/coalesce.js deleted file mode 100644 index 8b94084f2..000000000 --- a/test/coalesce/coalesce.js +++ /dev/null @@ -1,2 +0,0 @@ -const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_)); -module.exports = coalesce; diff --git a/test/coalesceFactory/coalesceFactory.test.js b/test/coalesceFactory.test.js similarity index 86% rename from test/coalesceFactory/coalesceFactory.test.js rename to test/coalesceFactory.test.js index a2836a57f..960cb1673 100644 --- a/test/coalesceFactory/coalesceFactory.test.js +++ b/test/coalesceFactory.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const coalesceFactory = require('./coalesceFactory.js'); +const {coalesceFactory} = require('./_30s.js'); test('coalesceFactory is a Function', () => { expect(coalesceFactory).toBeInstanceOf(Function); diff --git a/test/coalesceFactory/coalesceFactory.js b/test/coalesceFactory/coalesceFactory.js deleted file mode 100644 index 66fd5148e..000000000 --- a/test/coalesceFactory/coalesceFactory.js +++ /dev/null @@ -1,2 +0,0 @@ -const coalesceFactory = valid => (...args) => args.find(valid); -module.exports = coalesceFactory; diff --git a/test/collatz/collatz.test.js b/test/collatz.test.js similarity index 91% rename from test/collatz/collatz.test.js rename to test/collatz.test.js index 73ceb7886..6bbe6205a 100644 --- a/test/collatz/collatz.test.js +++ b/test/collatz.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const collatz = require('./collatz.js'); +const {collatz} = require('./_30s.js'); test('collatz is a Function', () => { expect(collatz).toBeInstanceOf(Function); diff --git a/test/collatz/collatz.js b/test/collatz/collatz.js deleted file mode 100644 index fb2c8205e..000000000 --- a/test/collatz/collatz.js +++ /dev/null @@ -1,2 +0,0 @@ -const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1); -module.exports = collatz; diff --git a/test/collectInto/collectInto.test.js b/test/collectInto.test.js similarity index 90% rename from test/collectInto/collectInto.test.js rename to test/collectInto.test.js index a672e4515..a99890db9 100644 --- a/test/collectInto/collectInto.test.js +++ b/test/collectInto.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const collectInto = require('./collectInto.js'); +const {collectInto} = require('./_30s.js'); test('collectInto is a Function', () => { expect(collectInto).toBeInstanceOf(Function); diff --git a/test/collectInto/collectInto.js b/test/collectInto/collectInto.js deleted file mode 100644 index e891c6938..000000000 --- a/test/collectInto/collectInto.js +++ /dev/null @@ -1,2 +0,0 @@ -const collectInto = fn => (...args) => fn(args); -module.exports = collectInto; diff --git a/test/colorize/colorize.test.js b/test/colorize.test.js similarity index 74% rename from test/colorize/colorize.test.js rename to test/colorize.test.js index 73658ae79..8e147ef2e 100644 --- a/test/colorize/colorize.test.js +++ b/test/colorize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const colorize = require('./colorize.js'); +const {colorize} = require('./_30s.js'); test('colorize is a Function', () => { expect(colorize).toBeInstanceOf(Function); diff --git a/test/colorize/colorize.js b/test/colorize/colorize.js deleted file mode 100644 index 032e6ab87..000000000 --- a/test/colorize/colorize.js +++ /dev/null @@ -1,19 +0,0 @@ -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` -}); -module.exports = colorize; diff --git a/test/compact/compact.test.js b/test/compact.test.js similarity index 88% rename from test/compact/compact.test.js rename to test/compact.test.js index 213bfa10c..e63c47b8e 100644 --- a/test/compact/compact.test.js +++ b/test/compact.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const compact = require('./compact.js'); +const {compact} = require('./_30s.js'); test('compact is a Function', () => { expect(compact).toBeInstanceOf(Function); diff --git a/test/compact/compact.js b/test/compact/compact.js deleted file mode 100644 index 636f804f2..000000000 --- a/test/compact/compact.js +++ /dev/null @@ -1,2 +0,0 @@ -const compact = arr => arr.filter(Boolean); -module.exports = compact; diff --git a/test/compose/compose.test.js b/test/compose.test.js similarity index 89% rename from test/compose/compose.test.js rename to test/compose.test.js index 33813a409..4d3119767 100644 --- a/test/compose/compose.test.js +++ b/test/compose.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const compose = require('./compose.js'); +const {compose} = require('./_30s.js'); test('compose is a Function', () => { expect(compose).toBeInstanceOf(Function); diff --git a/test/compose/compose.js b/test/compose/compose.js deleted file mode 100644 index 2d62bdd23..000000000 --- a/test/compose/compose.js +++ /dev/null @@ -1,2 +0,0 @@ -const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); -module.exports = compose; diff --git a/test/composeRight/composeRight.test.js b/test/composeRight.test.js similarity index 86% rename from test/composeRight/composeRight.test.js rename to test/composeRight.test.js index 02cddf187..92ec50047 100644 --- a/test/composeRight/composeRight.test.js +++ b/test/composeRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const composeRight = require('./composeRight.js'); +const {composeRight} = require('./_30s.js'); test('composeRight is a Function', () => { expect(composeRight).toBeInstanceOf(Function); diff --git a/test/composeRight/composeRight.js b/test/composeRight/composeRight.js deleted file mode 100644 index a0ac57749..000000000 --- a/test/composeRight/composeRight.js +++ /dev/null @@ -1,2 +0,0 @@ -const composeRight = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); -module.exports = composeRight; diff --git a/test/converge/converge.test.js b/test/converge.test.js similarity index 92% rename from test/converge/converge.test.js rename to test/converge.test.js index 19e2b57f0..f2d6a3810 100644 --- a/test/converge/converge.test.js +++ b/test/converge.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const converge = require('./converge.js'); +const {converge} = require('./_30s.js'); test('converge is a Function', () => { expect(converge).toBeInstanceOf(Function); diff --git a/test/converge/converge.js b/test/converge/converge.js deleted file mode 100644 index 8dd708846..000000000 --- a/test/converge/converge.js +++ /dev/null @@ -1,2 +0,0 @@ -const converge = (converger, fns) => (...args) => converger(...fns.map(fn => fn.apply(null, args))); -module.exports = converge; diff --git a/test/copyToClipboard/copyToClipboard.test.js b/test/copyToClipboard.test.js similarity index 70% rename from test/copyToClipboard/copyToClipboard.test.js rename to test/copyToClipboard.test.js index 60c18bbb9..27bbd402e 100644 --- a/test/copyToClipboard/copyToClipboard.test.js +++ b/test/copyToClipboard.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const copyToClipboard = require('./copyToClipboard.js'); +const {copyToClipboard} = require('./_30s.js'); test('copyToClipboard is a Function', () => { expect(copyToClipboard).toBeInstanceOf(Function); diff --git a/test/copyToClipboard/copyToClipboard.js b/test/copyToClipboard/copyToClipboard.js deleted file mode 100644 index d1117d729..000000000 --- a/test/copyToClipboard/copyToClipboard.js +++ /dev/null @@ -1,18 +0,0 @@ -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); - } -}; -module.exports = copyToClipboard; diff --git a/test/countBy/countBy.test.js b/test/countBy.test.js similarity index 89% rename from test/countBy/countBy.test.js rename to test/countBy.test.js index 1f0c6efee..265034da0 100644 --- a/test/countBy/countBy.test.js +++ b/test/countBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const countBy = require('./countBy.js'); +const {countBy} = require('./_30s.js'); test('countBy is a Function', () => { expect(countBy).toBeInstanceOf(Function); diff --git a/test/countBy/countBy.js b/test/countBy/countBy.js deleted file mode 100644 index e6b0cadf6..000000000 --- a/test/countBy/countBy.js +++ /dev/null @@ -1,6 +0,0 @@ -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; - }, {}); -module.exports = countBy; diff --git a/test/countOccurrences/countOccurrences.test.js b/test/countOccurrences.test.js similarity index 81% rename from test/countOccurrences/countOccurrences.test.js rename to test/countOccurrences.test.js index a78b8b539..5ac6c1e1d 100644 --- a/test/countOccurrences/countOccurrences.test.js +++ b/test/countOccurrences.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const countOccurrences = require('./countOccurrences.js'); +const {countOccurrences} = require('./_30s.js'); test('countOccurrences is a Function', () => { expect(countOccurrences).toBeInstanceOf(Function); diff --git a/test/countOccurrences/countOccurrences.js b/test/countOccurrences/countOccurrences.js deleted file mode 100644 index 2de3440fd..000000000 --- a/test/countOccurrences/countOccurrences.js +++ /dev/null @@ -1,2 +0,0 @@ -const countOccurrences = (arr, val) => arr.reduce((a, v) => (v === val ? a + 1 : a), 0); -module.exports = countOccurrences; diff --git a/test/countVowels/countVowels.test.js b/test/countVowels.test.js similarity index 72% rename from test/countVowels/countVowels.test.js rename to test/countVowels.test.js index 64a1b0936..1b543bb8e 100644 --- a/test/countVowels/countVowels.test.js +++ b/test/countVowels.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const countVowels = require('./countVowels.js'); +const {countVowels} = require('./_30s.js'); test('countVowels is a Function', () => { expect(countVowels).toBeInstanceOf(Function); diff --git a/test/countVowels/countVowels.js b/test/countVowels/countVowels.js deleted file mode 100644 index 29c954056..000000000 --- a/test/countVowels/countVowels.js +++ /dev/null @@ -1,2 +0,0 @@ -const countVowels = str => (str.match(/[aeiou]/gi) || []).length; -module.exports = countVowels; diff --git a/test/counter/counter.test.js b/test/counter.test.js similarity index 74% rename from test/counter/counter.test.js rename to test/counter.test.js index a80d9c0f8..b6cc1648c 100644 --- a/test/counter/counter.test.js +++ b/test/counter.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const counter = require('./counter.js'); +const {counter} = require('./_30s.js'); test('counter is a Function', () => { expect(counter).toBeInstanceOf(Function); diff --git a/test/counter/counter.js b/test/counter/counter.js deleted file mode 100644 index 514551a0e..000000000 --- a/test/counter/counter.js +++ /dev/null @@ -1,12 +0,0 @@ -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; -}; -module.exports = counter; diff --git a/test/createElement/createElement.test.js b/test/createElement.test.js similarity index 71% rename from test/createElement/createElement.test.js rename to test/createElement.test.js index 096080d8d..8c253138f 100644 --- a/test/createElement/createElement.test.js +++ b/test/createElement.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const createElement = require('./createElement.js'); +const {createElement} = require('./_30s.js'); test('createElement is a Function', () => { expect(createElement).toBeInstanceOf(Function); diff --git a/test/createElement/createElement.js b/test/createElement/createElement.js deleted file mode 100644 index 533dd8012..000000000 --- a/test/createElement/createElement.js +++ /dev/null @@ -1,6 +0,0 @@ -const createElement = str => { - const el = document.createElement('div'); - el.innerHTML = str; - return el.firstElementChild; -}; -module.exports = createElement; diff --git a/test/createEventHub/createEventHub.test.js b/test/createEventHub.test.js similarity index 71% rename from test/createEventHub/createEventHub.test.js rename to test/createEventHub.test.js index 701572373..ca6ed2088 100644 --- a/test/createEventHub/createEventHub.test.js +++ b/test/createEventHub.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const createEventHub = require('./createEventHub.js'); +const {createEventHub} = require('./_30s.js'); test('createEventHub is a Function', () => { expect(createEventHub).toBeInstanceOf(Function); diff --git a/test/createEventHub/createEventHub.js b/test/createEventHub/createEventHub.js deleted file mode 100644 index a1ebc9a19..000000000 --- a/test/createEventHub/createEventHub.js +++ /dev/null @@ -1,15 +0,0 @@ -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); - } -}); -module.exports = createEventHub; diff --git a/test/currentURL/currentURL.test.js b/test/currentURL.test.js similarity index 72% rename from test/currentURL/currentURL.test.js rename to test/currentURL.test.js index 779470bde..8aa22f088 100644 --- a/test/currentURL/currentURL.test.js +++ b/test/currentURL.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const currentURL = require('./currentURL.js'); +const {currentURL} = require('./_30s.js'); test('currentURL is a Function', () => { expect(currentURL).toBeInstanceOf(Function); diff --git a/test/currentURL/currentURL.js b/test/currentURL/currentURL.js deleted file mode 100644 index a703769dd..000000000 --- a/test/currentURL/currentURL.js +++ /dev/null @@ -1,2 +0,0 @@ -const currentURL = () => window.location.href; -module.exports = currentURL; diff --git a/test/curry/curry.test.js b/test/curry.test.js similarity index 88% rename from test/curry/curry.test.js rename to test/curry.test.js index 9ae220a35..9fedae9da 100644 --- a/test/curry/curry.test.js +++ b/test/curry.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const curry = require('./curry.js'); +const {curry} = require('./_30s.js'); test('curry is a Function', () => { expect(curry).toBeInstanceOf(Function); diff --git a/test/curry/curry.js b/test/curry/curry.js deleted file mode 100644 index f6a788d90..000000000 --- a/test/curry/curry.js +++ /dev/null @@ -1,3 +0,0 @@ -const curry = (fn, arity = fn.length, ...args) => - arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args); -module.exports = curry; diff --git a/test/dayOfYear/dayOfYear.test.js b/test/dayOfYear.test.js similarity index 73% rename from test/dayOfYear/dayOfYear.test.js rename to test/dayOfYear.test.js index 2df870a58..b353d0106 100644 --- a/test/dayOfYear/dayOfYear.test.js +++ b/test/dayOfYear.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const dayOfYear = require('./dayOfYear.js'); +const {dayOfYear} = require('./_30s.js'); test('dayOfYear is a Function', () => { expect(dayOfYear).toBeInstanceOf(Function); diff --git a/test/dayOfYear/dayOfYear.js b/test/dayOfYear/dayOfYear.js deleted file mode 100644 index 8c6042edf..000000000 --- a/test/dayOfYear/dayOfYear.js +++ /dev/null @@ -1,3 +0,0 @@ -const dayOfYear = date => - Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24); -module.exports = dayOfYear; diff --git a/test/debounce/debounce.test.js b/test/debounce.test.js similarity index 83% rename from test/debounce/debounce.test.js rename to test/debounce.test.js index e26209900..67aac32f3 100644 --- a/test/debounce/debounce.test.js +++ b/test/debounce.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const debounce = require('./debounce.js'); +const {debounce} = require('./_30s.js'); test('debounce is a Function', () => { expect(debounce).toBeInstanceOf(Function); diff --git a/test/debounce/debounce.js b/test/debounce/debounce.js deleted file mode 100644 index 313428d57..000000000 --- a/test/debounce/debounce.js +++ /dev/null @@ -1,8 +0,0 @@ -const debounce = (fn, ms = 0) => { - let timeoutId; - return function(...args) { - clearTimeout(timeoutId); - timeoutId = setTimeout(() => fn.apply(this, args), ms); - }; -}; -module.exports = debounce; diff --git a/test/decapitalize/decapitalize.test.js b/test/decapitalize.test.js similarity index 87% rename from test/decapitalize/decapitalize.test.js rename to test/decapitalize.test.js index 14ca0fa7a..30783ab14 100644 --- a/test/decapitalize/decapitalize.test.js +++ b/test/decapitalize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const decapitalize = require('./decapitalize.js'); +const {decapitalize} = require('./_30s.js'); test('decapitalize is a Function', () => { expect(decapitalize).toBeInstanceOf(Function); diff --git a/test/decapitalize/decapitalize.js b/test/decapitalize/decapitalize.js deleted file mode 100644 index 987929c01..000000000 --- a/test/decapitalize/decapitalize.js +++ /dev/null @@ -1,3 +0,0 @@ -const decapitalize = ([first, ...rest], upperRest = false) => - first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); -module.exports = decapitalize; diff --git a/test/deepClone/deepClone.test.js b/test/deepClone.test.js similarity index 92% rename from test/deepClone/deepClone.test.js rename to test/deepClone.test.js index 6983de5fc..9e73c19d1 100644 --- a/test/deepClone/deepClone.test.js +++ b/test/deepClone.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const deepClone = require('./deepClone.js'); +const {deepClone} = require('./_30s.js'); test('deepClone is a Function', () => { expect(deepClone).toBeInstanceOf(Function); diff --git a/test/deepClone/deepClone.js b/test/deepClone/deepClone.js deleted file mode 100644 index 538f37d3d..000000000 --- a/test/deepClone/deepClone.js +++ /dev/null @@ -1,8 +0,0 @@ -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; -}; -module.exports = deepClone; diff --git a/test/deepFlatten/deepFlatten.test.js b/test/deepFlatten.test.js similarity index 83% rename from test/deepFlatten/deepFlatten.test.js rename to test/deepFlatten.test.js index 6489d26ab..a99b67c4b 100644 --- a/test/deepFlatten/deepFlatten.test.js +++ b/test/deepFlatten.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const deepFlatten = require('./deepFlatten.js'); +const {deepFlatten} = require('./_30s.js'); test('deepFlatten is a Function', () => { expect(deepFlatten).toBeInstanceOf(Function); diff --git a/test/deepFlatten/deepFlatten.js b/test/deepFlatten/deepFlatten.js deleted file mode 100644 index 6d344be80..000000000 --- a/test/deepFlatten/deepFlatten.js +++ /dev/null @@ -1,2 +0,0 @@ -const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); -module.exports = deepFlatten; diff --git a/test/deepFreeze/deepFreeze.test.js b/test/deepFreeze.test.js similarity index 93% rename from test/deepFreeze/deepFreeze.test.js rename to test/deepFreeze.test.js index 12097d525..3a95c7049 100644 --- a/test/deepFreeze/deepFreeze.test.js +++ b/test/deepFreeze.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const deepFreeze = require('./deepFreeze.js'); +const {deepFreeze} = require('./_30s.js'); test('deepFreeze is a Function', () => { expect(deepFreeze).toBeInstanceOf(Function); diff --git a/test/deepFreeze/deepFreeze.js b/test/deepFreeze/deepFreeze.js deleted file mode 100644 index a6e1ac6cb..000000000 --- a/test/deepFreeze/deepFreeze.js +++ /dev/null @@ -1,6 +0,0 @@ -const deepFreeze = obj => - Object.keys(obj).forEach( - prop => - !obj[prop] instanceof Object || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop]) - ) || Object.freeze(obj); -module.exports = deepFreeze; diff --git a/test/defaults/defaults.test.js b/test/defaults.test.js similarity index 86% rename from test/defaults/defaults.test.js rename to test/defaults.test.js index 6a98064cd..6d7de0f2a 100644 --- a/test/defaults/defaults.test.js +++ b/test/defaults.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const defaults = require('./defaults.js'); +const {defaults} = require('./_30s.js'); test('defaults is a Function', () => { expect(defaults).toBeInstanceOf(Function); diff --git a/test/defaults/defaults.js b/test/defaults/defaults.js deleted file mode 100644 index e369fff7c..000000000 --- a/test/defaults/defaults.js +++ /dev/null @@ -1,2 +0,0 @@ -const defaults = (obj, ...defs) => Object.assign({}, obj, ...defs.reverse(), obj); -module.exports = defaults; diff --git a/test/defer/defer.test.js b/test/defer.test.js similarity index 75% rename from test/defer/defer.test.js rename to test/defer.test.js index 61f3665f1..f27d98e1d 100644 --- a/test/defer/defer.test.js +++ b/test/defer.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const defer = require('./defer.js'); +const {defer} = require('./_30s.js'); test('defer is a Function', () => { expect(defer).toBeInstanceOf(Function); diff --git a/test/defer/defer.js b/test/defer/defer.js deleted file mode 100644 index f8e069b65..000000000 --- a/test/defer/defer.js +++ /dev/null @@ -1,2 +0,0 @@ -const defer = (fn, ...args) => setTimeout(fn, 1, ...args); -module.exports = defer; diff --git a/test/degreesToRads/degreesToRads.test.js b/test/degreesToRads.test.js similarity index 85% rename from test/degreesToRads/degreesToRads.test.js rename to test/degreesToRads.test.js index 634140d76..a1827c426 100644 --- a/test/degreesToRads/degreesToRads.test.js +++ b/test/degreesToRads.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const degreesToRads = require('./degreesToRads.js'); +const {degreesToRads} = require('./_30s.js'); // const approxeq = (v1,v2, diff = 0.001) => Math.abs(v1 - v2) < diff; test('degreesToRads is a Function', () => { diff --git a/test/degreesToRads/degreesToRads.js b/test/degreesToRads/degreesToRads.js deleted file mode 100644 index ffc04f7fd..000000000 --- a/test/degreesToRads/degreesToRads.js +++ /dev/null @@ -1,2 +0,0 @@ -const degreesToRads = deg => (deg * Math.PI) / 180.0; -module.exports = degreesToRads; diff --git a/test/delay/delay.test.js b/test/delay.test.js similarity index 88% rename from test/delay/delay.test.js rename to test/delay.test.js index b43e12552..e06326766 100644 --- a/test/delay/delay.test.js +++ b/test/delay.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const delay = require('./delay.js'); +const {delay} = require('./_30s.js'); test('delay is a Function', () => { expect(delay).toBeInstanceOf(Function); diff --git a/test/delay/delay.js b/test/delay/delay.js deleted file mode 100644 index a05563960..000000000 --- a/test/delay/delay.js +++ /dev/null @@ -1,2 +0,0 @@ -const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args); -module.exports = delay; diff --git a/test/detectDeviceType/detectDeviceType.test.js b/test/detectDeviceType.test.js similarity index 70% rename from test/detectDeviceType/detectDeviceType.test.js rename to test/detectDeviceType.test.js index 695593771..943864b0c 100644 --- a/test/detectDeviceType/detectDeviceType.test.js +++ b/test/detectDeviceType.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const detectDeviceType = require('./detectDeviceType.js'); +const {detectDeviceType} = require('./_30s.js'); test('detectDeviceType is a Function', () => { expect(detectDeviceType).toBeInstanceOf(Function); diff --git a/test/detectDeviceType/detectDeviceType.js b/test/detectDeviceType/detectDeviceType.js deleted file mode 100644 index 2cb23d550..000000000 --- a/test/detectDeviceType/detectDeviceType.js +++ /dev/null @@ -1,5 +0,0 @@ -const detectDeviceType = () => - /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) - ? 'Mobile' - : 'Desktop'; -module.exports = detectDeviceType; diff --git a/test/difference/difference.test.js b/test/difference.test.js similarity index 83% rename from test/difference/difference.test.js rename to test/difference.test.js index 4d0f316f0..564713181 100644 --- a/test/difference/difference.test.js +++ b/test/difference.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const difference = require('./difference.js'); +const {difference} = require('./_30s.js'); test('difference is a Function', () => { expect(difference).toBeInstanceOf(Function); diff --git a/test/difference/difference.js b/test/difference/difference.js deleted file mode 100644 index 186ee847d..000000000 --- a/test/difference/difference.js +++ /dev/null @@ -1,5 +0,0 @@ -const difference = (a, b) => { - const s = new Set(b); - return a.filter(x => !s.has(x)); -}; -module.exports = difference; diff --git a/test/differenceBy/differenceBy.test.js b/test/differenceBy.test.js similarity index 89% rename from test/differenceBy/differenceBy.test.js rename to test/differenceBy.test.js index cb3499833..719f0df6b 100644 --- a/test/differenceBy/differenceBy.test.js +++ b/test/differenceBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const differenceBy = require('./differenceBy.js'); +const {differenceBy} = require('./_30s.js'); test('differenceBy is a Function', () => { expect(differenceBy).toBeInstanceOf(Function); diff --git a/test/differenceBy/differenceBy.js b/test/differenceBy/differenceBy.js deleted file mode 100644 index e777d310c..000000000 --- a/test/differenceBy/differenceBy.js +++ /dev/null @@ -1,5 +0,0 @@ -const differenceBy = (a, b, fn) => { - const s = new Set(b.map(v => fn(v))); - return a.filter(x => !s.has(fn(x))); -}; -module.exports = differenceBy; diff --git a/test/differenceWith/differenceWith.test.js b/test/differenceWith.test.js similarity index 85% rename from test/differenceWith/differenceWith.test.js rename to test/differenceWith.test.js index 14b4dcff3..f2b608afd 100644 --- a/test/differenceWith/differenceWith.test.js +++ b/test/differenceWith.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const differenceWith = require('./differenceWith.js'); +const {differenceWith} = require('./_30s.js'); test('differenceWith is a Function', () => { expect(differenceWith).toBeInstanceOf(Function); diff --git a/test/differenceWith/differenceWith.js b/test/differenceWith/differenceWith.js deleted file mode 100644 index bb4c127a0..000000000 --- a/test/differenceWith/differenceWith.js +++ /dev/null @@ -1,2 +0,0 @@ -const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1); -module.exports = differenceWith; diff --git a/test/dig/dig.test.js b/test/dig.test.js similarity index 94% rename from test/dig/dig.test.js rename to test/dig.test.js index d47d0edf7..8af2e3cc3 100644 --- a/test/dig/dig.test.js +++ b/test/dig.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const dig = require('./dig.js'); +const {dig} = require('./_30s.js'); const data = { level1: { diff --git a/test/dig/dig.js b/test/dig/dig.js deleted file mode 100644 index 90233fa3a..000000000 --- a/test/dig/dig.js +++ /dev/null @@ -1,8 +0,0 @@ -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); -module.exports = dig; diff --git a/test/digitize/digitize.test.js b/test/digitize.test.js similarity index 84% rename from test/digitize/digitize.test.js rename to test/digitize.test.js index 2feb29282..1f197322e 100644 --- a/test/digitize/digitize.test.js +++ b/test/digitize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const digitize = require('./digitize.js'); +const {digitize} = require('./_30s.js'); test('digitize is a Function', () => { expect(digitize).toBeInstanceOf(Function); diff --git a/test/digitize/digitize.js b/test/digitize/digitize.js deleted file mode 100644 index 6b85884be..000000000 --- a/test/digitize/digitize.js +++ /dev/null @@ -1,2 +0,0 @@ -const digitize = n => [...`${n}`].map(i => parseInt(i)); -module.exports = digitize; diff --git a/test/distance/distance.test.js b/test/distance.test.js similarity index 85% rename from test/distance/distance.test.js rename to test/distance.test.js index 7831be85d..f636df601 100644 --- a/test/distance/distance.test.js +++ b/test/distance.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const distance = require('./distance.js'); +const {distance} = require('./_30s.js'); test('distance is a Function', () => { expect(distance).toBeInstanceOf(Function); diff --git a/test/distance/distance.js b/test/distance/distance.js deleted file mode 100644 index 2c5735858..000000000 --- a/test/distance/distance.js +++ /dev/null @@ -1,2 +0,0 @@ -const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); -module.exports = distance; diff --git a/test/drop/drop.test.js b/test/drop.test.js similarity index 92% rename from test/drop/drop.test.js rename to test/drop.test.js index 87afd1070..7a08170b7 100644 --- a/test/drop/drop.test.js +++ b/test/drop.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const drop = require('./drop.js'); +const {drop} = require('./_30s.js'); test('drop is a Function', () => { expect(drop).toBeInstanceOf(Function); diff --git a/test/drop/drop.js b/test/drop/drop.js deleted file mode 100644 index bc2c9b76b..000000000 --- a/test/drop/drop.js +++ /dev/null @@ -1,2 +0,0 @@ -const drop = (arr, n = 1) => arr.slice(n); -module.exports = drop; diff --git a/test/dropRight/dropRight.test.js b/test/dropRight.test.js similarity index 91% rename from test/dropRight/dropRight.test.js rename to test/dropRight.test.js index 5f36ec265..95a574f75 100644 --- a/test/dropRight/dropRight.test.js +++ b/test/dropRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const dropRight = require('./dropRight.js'); +const {dropRight} = require('./_30s.js'); test('dropRight is a Function', () => { expect(dropRight).toBeInstanceOf(Function); diff --git a/test/dropRight/dropRight.js b/test/dropRight/dropRight.js deleted file mode 100644 index 635c86880..000000000 --- a/test/dropRight/dropRight.js +++ /dev/null @@ -1,2 +0,0 @@ -const dropRight = (arr, n = 1) => arr.slice(0, -n); -module.exports = dropRight; diff --git a/test/dropRightWhile/dropRightWhile.test.js b/test/dropRightWhile.test.js similarity index 84% rename from test/dropRightWhile/dropRightWhile.test.js rename to test/dropRightWhile.test.js index 76cf162d9..24ea544d7 100644 --- a/test/dropRightWhile/dropRightWhile.test.js +++ b/test/dropRightWhile.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const dropRightWhile = require('./dropRightWhile.js'); +const {dropRightWhile} = require('./_30s.js'); test('dropRightWhile is a Function', () => { expect(dropRightWhile).toBeInstanceOf(Function); diff --git a/test/dropRightWhile/dropRightWhile.js b/test/dropRightWhile/dropRightWhile.js deleted file mode 100644 index 35a373c08..000000000 --- a/test/dropRightWhile/dropRightWhile.js +++ /dev/null @@ -1,5 +0,0 @@ -const dropRightWhile = (arr, func) => { - while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1); - return arr; -}; -module.exports = dropRightWhile; diff --git a/test/dropWhile/dropWhile.test.js b/test/dropWhile.test.js similarity index 86% rename from test/dropWhile/dropWhile.test.js rename to test/dropWhile.test.js index 40c0f0987..88373d34f 100644 --- a/test/dropWhile/dropWhile.test.js +++ b/test/dropWhile.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const dropWhile = require('./dropWhile.js'); +const {dropWhile} = require('./_30s.js'); test('dropWhile is a Function', () => { expect(dropWhile).toBeInstanceOf(Function); diff --git a/test/dropWhile/dropWhile.js b/test/dropWhile/dropWhile.js deleted file mode 100644 index bcb01ebc0..000000000 --- a/test/dropWhile/dropWhile.js +++ /dev/null @@ -1,5 +0,0 @@ -const dropWhile = (arr, func) => { - while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1); - return arr; -}; -module.exports = dropWhile; diff --git a/test/elementContains/elementContains.test.js b/test/elementContains.test.js similarity index 70% rename from test/elementContains/elementContains.test.js rename to test/elementContains.test.js index ef9019c76..2a46c2d49 100644 --- a/test/elementContains/elementContains.test.js +++ b/test/elementContains.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const elementContains = require('./elementContains.js'); +const {elementContains} = require('./_30s.js'); test('elementContains is a Function', () => { expect(elementContains).toBeInstanceOf(Function); diff --git a/test/elementContains/elementContains.js b/test/elementContains/elementContains.js deleted file mode 100644 index d80f015fa..000000000 --- a/test/elementContains/elementContains.js +++ /dev/null @@ -1,2 +0,0 @@ -const elementContains = (parent, child) => parent !== child && parent.contains(child); -module.exports = elementContains; diff --git a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js b/test/elementIsVisibleInViewport.test.js similarity index 66% rename from test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js rename to test/elementIsVisibleInViewport.test.js index f3d70a2fd..68f0fa1d2 100644 --- a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js +++ b/test/elementIsVisibleInViewport.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const elementIsVisibleInViewport = require('./elementIsVisibleInViewport.js'); +const {elementIsVisibleInViewport} = require('./_30s.js'); test('elementIsVisibleInViewport is a Function', () => { expect(elementIsVisibleInViewport).toBeInstanceOf(Function); diff --git a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js deleted file mode 100644 index f695904eb..000000000 --- a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js +++ /dev/null @@ -1,9 +0,0 @@ -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; -}; -module.exports = elementIsVisibleInViewport; diff --git a/test/elo/elo.test.js b/test/elo.test.js similarity index 92% rename from test/elo/elo.test.js rename to test/elo.test.js index 042dad3d4..7210d3ebf 100644 --- a/test/elo/elo.test.js +++ b/test/elo.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const elo = require('./elo.js'); +const {elo} = require('./_30s.js'); test('elo is a Function', () => { expect(elo).toBeInstanceOf(Function); diff --git a/test/elo/elo.js b/test/elo/elo.js deleted file mode 100644 index 28f571510..000000000 --- a/test/elo/elo.js +++ /dev/null @@ -1,18 +0,0 @@ -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; -}; -module.exports = elo; diff --git a/test/equals/equals.test.js b/test/equals.test.js similarity index 95% rename from test/equals/equals.test.js rename to test/equals.test.js index 2f89886ec..dd3c64056 100644 --- a/test/equals/equals.test.js +++ b/test/equals.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const equals = require('./equals.js'); +const {equals} = require('./_30s.js'); test('equals is a Function', () => { expect(equals).toBeInstanceOf(Function); diff --git a/test/equals/equals.js b/test/equals/equals.js deleted file mode 100644 index 1d3665f5d..000000000 --- a/test/equals/equals.js +++ /dev/null @@ -1,11 +0,0 @@ -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])); -}; -module.exports = equals; diff --git a/test/escapeHTML/escapeHTML.test.js b/test/escapeHTML.test.js similarity index 86% rename from test/escapeHTML/escapeHTML.test.js rename to test/escapeHTML.test.js index e824acf9b..c7cd266ab 100644 --- a/test/escapeHTML/escapeHTML.test.js +++ b/test/escapeHTML.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const escapeHTML = require('./escapeHTML.js'); +const {escapeHTML} = require('./_30s.js'); test('escapeHTML is a Function', () => { expect(escapeHTML).toBeInstanceOf(Function); diff --git a/test/escapeHTML/escapeHTML.js b/test/escapeHTML/escapeHTML.js deleted file mode 100644 index d8c219fbc..000000000 --- a/test/escapeHTML/escapeHTML.js +++ /dev/null @@ -1,13 +0,0 @@ -const escapeHTML = str => - str.replace( - /[&<>'"]/g, - tag => - ({ - '&': '&', - '<': '<', - '>': '>', - "'": ''', - '"': '"' - }[tag] || tag) - ); -module.exports = escapeHTML; diff --git a/test/escapeRegExp/escapeRegExp.test.js b/test/escapeRegExp.test.js similarity index 83% rename from test/escapeRegExp/escapeRegExp.test.js rename to test/escapeRegExp.test.js index bd3f2168f..063a639af 100644 --- a/test/escapeRegExp/escapeRegExp.test.js +++ b/test/escapeRegExp.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const escapeRegExp = require('./escapeRegExp.js'); +const {escapeRegExp} = require('./_30s.js'); test('escapeRegExp is a Function', () => { expect(escapeRegExp).toBeInstanceOf(Function); diff --git a/test/escapeRegExp/escapeRegExp.js b/test/escapeRegExp/escapeRegExp.js deleted file mode 100644 index 2519cfe13..000000000 --- a/test/escapeRegExp/escapeRegExp.js +++ /dev/null @@ -1,2 +0,0 @@ -const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); -module.exports = escapeRegExp; diff --git a/test/everyNth/everyNth.test.js b/test/everyNth.test.js similarity index 84% rename from test/everyNth/everyNth.test.js rename to test/everyNth.test.js index 826f746cf..34b9918dd 100644 --- a/test/everyNth/everyNth.test.js +++ b/test/everyNth.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const everyNth = require('./everyNth.js'); +const {everyNth} = require('./_30s.js'); test('everyNth is a Function', () => { expect(everyNth).toBeInstanceOf(Function); diff --git a/test/everyNth/everyNth.js b/test/everyNth/everyNth.js deleted file mode 100644 index 4ef94c46c..000000000 --- a/test/everyNth/everyNth.js +++ /dev/null @@ -1,2 +0,0 @@ -const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1); -module.exports = everyNth; diff --git a/test/extendHex/extendHex.test.js b/test/extendHex.test.js similarity index 88% rename from test/extendHex/extendHex.test.js rename to test/extendHex.test.js index a31a3c6d2..52141ca11 100644 --- a/test/extendHex/extendHex.test.js +++ b/test/extendHex.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const extendHex = require('./extendHex.js'); +const {extendHex} = require('./_30s.js'); test('extendHex is a Function', () => { expect(extendHex).toBeInstanceOf(Function); diff --git a/test/extendHex/extendHex.js b/test/extendHex/extendHex.js deleted file mode 100644 index 36ea367a2..000000000 --- a/test/extendHex/extendHex.js +++ /dev/null @@ -1,8 +0,0 @@ -const extendHex = shortHex => - '#' + - shortHex - .slice(shortHex.startsWith('#') ? 1 : 0) - .split('') - .map(x => x + x) - .join(''); -module.exports = extendHex; diff --git a/test/factorial/factorial.test.js b/test/factorial.test.js similarity index 92% rename from test/factorial/factorial.test.js rename to test/factorial.test.js index 130d39a79..5f3c8d963 100644 --- a/test/factorial/factorial.test.js +++ b/test/factorial.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const factorial = require('./factorial.js'); +const {factorial} = require('./_30s.js'); test('factorial is a Function', () => { expect(factorial).toBeInstanceOf(Function); diff --git a/test/factorial/factorial.js b/test/factorial/factorial.js deleted file mode 100644 index 18e1c719f..000000000 --- a/test/factorial/factorial.js +++ /dev/null @@ -1,9 +0,0 @@ -const factorial = n => - n < 0 - ? (() => { - throw new TypeError('Negative numbers are not allowed!'); - })() - : n <= 1 - ? 1 - : n * factorial(n - 1); -module.exports = factorial; diff --git a/test/factors/factors.test.js b/test/factors.test.js similarity index 74% rename from test/factors/factors.test.js rename to test/factors.test.js index 961098ef4..b02c475c1 100644 --- a/test/factors/factors.test.js +++ b/test/factors.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const factors = require('./factors.js'); +const {factors} = require('./_30s.js'); test('factors is a Function', () => { expect(factors).toBeInstanceOf(Function); diff --git a/test/factors/factors.js b/test/factors/factors.js deleted file mode 100644 index 80e9e4b9b..000000000 --- a/test/factors/factors.js +++ /dev/null @@ -1,20 +0,0 @@ -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; -}; -module.exports = factors; diff --git a/test/fibonacci/fibonacci.test.js b/test/fibonacci.test.js similarity index 84% rename from test/fibonacci/fibonacci.test.js rename to test/fibonacci.test.js index c13d3551b..bd824ab16 100644 --- a/test/fibonacci/fibonacci.test.js +++ b/test/fibonacci.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const fibonacci = require('./fibonacci.js'); +const {fibonacci} = require('./_30s.js'); test('fibonacci is a Function', () => { expect(fibonacci).toBeInstanceOf(Function); diff --git a/test/fibonacci/fibonacci.js b/test/fibonacci/fibonacci.js deleted file mode 100644 index 3fa87a6e1..000000000 --- a/test/fibonacci/fibonacci.js +++ /dev/null @@ -1,6 +0,0 @@ -const fibonacci = n => - Array.from({ length: n }).reduce( - (acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), - [] - ); -module.exports = fibonacci; diff --git a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.test.js b/test/fibonacciCountUntilNum.test.js similarity index 68% rename from test/fibonacciCountUntilNum/fibonacciCountUntilNum.test.js rename to test/fibonacciCountUntilNum.test.js index 249b4ae48..38bb0e307 100644 --- a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.test.js +++ b/test/fibonacciCountUntilNum.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const fibonacciCountUntilNum = require('./fibonacciCountUntilNum.js'); +const {fibonacciCountUntilNum} = require('./_30s.js'); test('fibonacciCountUntilNum is a Function', () => { expect(fibonacciCountUntilNum).toBeInstanceOf(Function); diff --git a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js deleted file mode 100644 index aacbc269b..000000000 --- a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js +++ /dev/null @@ -1,3 +0,0 @@ -const fibonacciCountUntilNum = num => - Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2)); -module.exports = fibonacciCountUntilNum; diff --git a/test/fibonacciUntilNum/fibonacciUntilNum.test.js b/test/fibonacciUntilNum.test.js similarity index 69% rename from test/fibonacciUntilNum/fibonacciUntilNum.test.js rename to test/fibonacciUntilNum.test.js index a639afad4..f8c98a9c5 100644 --- a/test/fibonacciUntilNum/fibonacciUntilNum.test.js +++ b/test/fibonacciUntilNum.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const fibonacciUntilNum = require('./fibonacciUntilNum.js'); +const {fibonacciUntilNum} = require('./_30s.js'); test('fibonacciUntilNum is a Function', () => { expect(fibonacciUntilNum).toBeInstanceOf(Function); diff --git a/test/fibonacciUntilNum/fibonacciUntilNum.js b/test/fibonacciUntilNum/fibonacciUntilNum.js deleted file mode 100644 index e4c109fb1..000000000 --- a/test/fibonacciUntilNum/fibonacciUntilNum.js +++ /dev/null @@ -1,8 +0,0 @@ -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), - [] - ); -}; -module.exports = fibonacciUntilNum; diff --git a/test/filterNonUnique/filterNonUnique.test.js b/test/filterNonUnique.test.js similarity index 82% rename from test/filterNonUnique/filterNonUnique.test.js rename to test/filterNonUnique.test.js index 288d0209a..459c67282 100644 --- a/test/filterNonUnique/filterNonUnique.test.js +++ b/test/filterNonUnique.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const filterNonUnique = require('./filterNonUnique.js'); +const {filterNonUnique} = require('./_30s.js'); test('filterNonUnique is a Function', () => { expect(filterNonUnique).toBeInstanceOf(Function); diff --git a/test/filterNonUnique/filterNonUnique.js b/test/filterNonUnique/filterNonUnique.js deleted file mode 100644 index 84ca7a4e8..000000000 --- a/test/filterNonUnique/filterNonUnique.js +++ /dev/null @@ -1,2 +0,0 @@ -const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i)); -module.exports = filterNonUnique; diff --git a/test/filterNonUniqueBy/filterNonUniqueBy.test.js b/test/filterNonUniqueBy.test.js similarity index 93% rename from test/filterNonUniqueBy/filterNonUniqueBy.test.js rename to test/filterNonUniqueBy.test.js index c5b150049..16108cb66 100644 --- a/test/filterNonUniqueBy/filterNonUniqueBy.test.js +++ b/test/filterNonUniqueBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const filterNonUniqueBy = require('./filterNonUniqueBy.js'); +const {filterNonUniqueBy} = require('./_30s.js'); test('filterNonUniqueBy is a Function', () => { expect(filterNonUniqueBy).toBeInstanceOf(Function); diff --git a/test/filterNonUniqueBy/filterNonUniqueBy.js b/test/filterNonUniqueBy/filterNonUniqueBy.js deleted file mode 100644 index 274c1ce8a..000000000 --- a/test/filterNonUniqueBy/filterNonUniqueBy.js +++ /dev/null @@ -1,3 +0,0 @@ -const filterNonUniqueBy = (arr, fn) => - arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j))); -module.exports = filterNonUniqueBy; diff --git a/test/findKey/findKey.test.js b/test/findKey.test.js similarity index 90% rename from test/findKey/findKey.test.js rename to test/findKey.test.js index da13fb698..7a97fb19a 100644 --- a/test/findKey/findKey.test.js +++ b/test/findKey.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const findKey = require('./findKey.js'); +const {findKey} = require('./_30s.js'); test('findKey is a Function', () => { expect(findKey).toBeInstanceOf(Function); diff --git a/test/findKey/findKey.js b/test/findKey/findKey.js deleted file mode 100644 index 4f77774ce..000000000 --- a/test/findKey/findKey.js +++ /dev/null @@ -1,2 +0,0 @@ -const findKey = (obj, fn) => Object.keys(obj).find(key => fn(obj[key], key, obj)); -module.exports = findKey; diff --git a/test/findLast/findLast.test.js b/test/findLast.test.js similarity index 85% rename from test/findLast/findLast.test.js rename to test/findLast.test.js index 34fa06939..819b5083d 100644 --- a/test/findLast/findLast.test.js +++ b/test/findLast.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const findLast = require('./findLast.js'); +const {findLast} = require('./_30s.js'); test('findLast is a Function', () => { expect(findLast).toBeInstanceOf(Function); diff --git a/test/findLast/findLast.js b/test/findLast/findLast.js deleted file mode 100644 index da604a9bf..000000000 --- a/test/findLast/findLast.js +++ /dev/null @@ -1,2 +0,0 @@ -const findLast = (arr, fn) => arr.filter(fn).pop(); -module.exports = findLast; diff --git a/test/findLastIndex/findLastIndex.test.js b/test/findLastIndex.test.js similarity index 83% rename from test/findLastIndex/findLastIndex.test.js rename to test/findLastIndex.test.js index 6f438daf6..237ac94fb 100644 --- a/test/findLastIndex/findLastIndex.test.js +++ b/test/findLastIndex.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const findLastIndex = require('./findLastIndex.js'); +const {findLastIndex} = require('./_30s.js'); test('findLastIndex is a Function', () => { expect(findLastIndex).toBeInstanceOf(Function); diff --git a/test/findLastIndex/findLastIndex.js b/test/findLastIndex/findLastIndex.js deleted file mode 100644 index d99adccbb..000000000 --- a/test/findLastIndex/findLastIndex.js +++ /dev/null @@ -1,6 +0,0 @@ -const findLastIndex = (arr, fn) => - arr - .map((val, i) => [i, val]) - .filter(([i, val]) => fn(val, i, arr)) - .pop()[0]; -module.exports = findLastIndex; diff --git a/test/findLastKey/findLastKey.test.js b/test/findLastKey.test.js similarity index 89% rename from test/findLastKey/findLastKey.test.js rename to test/findLastKey.test.js index d2e910b2c..405f17496 100644 --- a/test/findLastKey/findLastKey.test.js +++ b/test/findLastKey.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const findLastKey = require('./findLastKey.js'); +const {findLastKey} = require('./_30s.js'); test('findLastKey is a Function', () => { expect(findLastKey).toBeInstanceOf(Function); diff --git a/test/findLastKey/findLastKey.js b/test/findLastKey/findLastKey.js deleted file mode 100644 index f27471663..000000000 --- a/test/findLastKey/findLastKey.js +++ /dev/null @@ -1,5 +0,0 @@ -const findLastKey = (obj, fn) => - Object.keys(obj) - .reverse() - .find(key => fn(obj[key], key, obj)); -module.exports = findLastKey; diff --git a/test/flatten/flatten.test.js b/test/flatten.test.js similarity index 89% rename from test/flatten/flatten.test.js rename to test/flatten.test.js index 536a63637..b88fca548 100644 --- a/test/flatten/flatten.test.js +++ b/test/flatten.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const flatten = require('./flatten.js'); +const {flatten} = require('./_30s.js'); test('flatten is a Function', () => { expect(flatten).toBeInstanceOf(Function); diff --git a/test/flatten/flatten.js b/test/flatten/flatten.js deleted file mode 100644 index 83cebd731..000000000 --- a/test/flatten/flatten.js +++ /dev/null @@ -1,3 +0,0 @@ -const flatten = (arr, depth = 1) => - arr.reduce((a, v) => a.concat(depth > 1 && Array.isArray(v) ? flatten(v, depth - 1) : v), []); -module.exports = flatten; diff --git a/test/flattenObject/flattenObject.test.js b/test/flattenObject.test.js similarity index 88% rename from test/flattenObject/flattenObject.test.js rename to test/flattenObject.test.js index e1d845c5d..c752d26d7 100644 --- a/test/flattenObject/flattenObject.test.js +++ b/test/flattenObject.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const flattenObject = require('./flattenObject.js'); +const {flattenObject} = require('./_30s.js'); test('flattenObject is a Function', () => { expect(flattenObject).toBeInstanceOf(Function); diff --git a/test/flattenObject/flattenObject.js b/test/flattenObject/flattenObject.js deleted file mode 100644 index bd796c5e1..000000000 --- a/test/flattenObject/flattenObject.js +++ /dev/null @@ -1,8 +0,0 @@ -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; - }, {}); -module.exports = flattenObject; diff --git a/test/flip/flip.test.js b/test/flip.test.js similarity index 89% rename from test/flip/flip.test.js rename to test/flip.test.js index 26ad46f43..0a72eae42 100644 --- a/test/flip/flip.test.js +++ b/test/flip.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const flip = require('./flip.js'); +const {flip} = require('./_30s.js'); test('flip is a Function', () => { expect(flip).toBeInstanceOf(Function); diff --git a/test/flip/flip.js b/test/flip/flip.js deleted file mode 100644 index 68cd33bb2..000000000 --- a/test/flip/flip.js +++ /dev/null @@ -1,2 +0,0 @@ -const flip = fn => (first, ...rest) => fn(...rest, first); -module.exports = flip; diff --git a/test/forEachRight/forEachRight.test.js b/test/forEachRight.test.js similarity index 84% rename from test/forEachRight/forEachRight.test.js rename to test/forEachRight.test.js index aec112662..01a6aa406 100644 --- a/test/forEachRight/forEachRight.test.js +++ b/test/forEachRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const forEachRight = require('./forEachRight.js'); +const {forEachRight} = require('./_30s.js'); test('forEachRight is a Function', () => { expect(forEachRight).toBeInstanceOf(Function); diff --git a/test/forEachRight/forEachRight.js b/test/forEachRight/forEachRight.js deleted file mode 100644 index b2143e743..000000000 --- a/test/forEachRight/forEachRight.js +++ /dev/null @@ -1,6 +0,0 @@ -const forEachRight = (arr, callback) => - arr - .slice(0) - .reverse() - .forEach(callback); -module.exports = forEachRight; diff --git a/test/forOwn/forOwn.test.js b/test/forOwn.test.js similarity index 88% rename from test/forOwn/forOwn.test.js rename to test/forOwn.test.js index 54f598cd0..e297312dc 100644 --- a/test/forOwn/forOwn.test.js +++ b/test/forOwn.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const forOwn = require('./forOwn.js'); +const {forOwn} = require('./_30s.js'); test('forOwn is a Function', () => { expect(forOwn).toBeInstanceOf(Function); diff --git a/test/forOwn/forOwn.js b/test/forOwn/forOwn.js deleted file mode 100644 index f6ddfd0c3..000000000 --- a/test/forOwn/forOwn.js +++ /dev/null @@ -1,2 +0,0 @@ -const forOwn = (obj, fn) => Object.keys(obj).forEach(key => fn(obj[key], key, obj)); -module.exports = forOwn; diff --git a/test/forOwnRight/forOwnRight.test.js b/test/forOwnRight.test.js similarity index 86% rename from test/forOwnRight/forOwnRight.test.js rename to test/forOwnRight.test.js index 542743af7..77fc161af 100644 --- a/test/forOwnRight/forOwnRight.test.js +++ b/test/forOwnRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const forOwnRight = require('./forOwnRight.js'); +const {forOwnRight} = require('./_30s.js'); test('forOwnRight is a Function', () => { expect(forOwnRight).toBeInstanceOf(Function); diff --git a/test/forOwnRight/forOwnRight.js b/test/forOwnRight/forOwnRight.js deleted file mode 100644 index 643cad803..000000000 --- a/test/forOwnRight/forOwnRight.js +++ /dev/null @@ -1,5 +0,0 @@ -const forOwnRight = (obj, fn) => - Object.keys(obj) - .reverse() - .forEach(key => fn(obj[key], key, obj)); -module.exports = forOwnRight; diff --git a/test/formatDuration/formatDuration.test.js b/test/formatDuration.test.js similarity index 89% rename from test/formatDuration/formatDuration.test.js rename to test/formatDuration.test.js index e1514868d..078c048bf 100644 --- a/test/formatDuration/formatDuration.test.js +++ b/test/formatDuration.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const formatDuration = require('./formatDuration.js'); +const {formatDuration} = require('./_30s.js'); test('formatDuration is a Function', () => { expect(formatDuration).toBeInstanceOf(Function); diff --git a/test/formatDuration/formatDuration.js b/test/formatDuration/formatDuration.js deleted file mode 100644 index 79014859d..000000000 --- a/test/formatDuration/formatDuration.js +++ /dev/null @@ -1,15 +0,0 @@ -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(([key, val]) => `${val} ${key}${val !== 1 ? 's' : ''}`) - .join(', '); -}; -module.exports = formatDuration; diff --git a/test/fromCamelCase/fromCamelCase.test.js b/test/fromCamelCase.test.js similarity index 91% rename from test/fromCamelCase/fromCamelCase.test.js rename to test/fromCamelCase.test.js index 28a067ebf..c4fed066f 100644 --- a/test/fromCamelCase/fromCamelCase.test.js +++ b/test/fromCamelCase.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const fromCamelCase = require('./fromCamelCase.js'); +const {fromCamelCase} = require('./_30s.js'); test('fromCamelCase is a Function', () => { expect(fromCamelCase).toBeInstanceOf(Function); diff --git a/test/fromCamelCase/fromCamelCase.js b/test/fromCamelCase/fromCamelCase.js deleted file mode 100644 index 49b0c7fee..000000000 --- a/test/fromCamelCase/fromCamelCase.js +++ /dev/null @@ -1,6 +0,0 @@ -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(); -module.exports = fromCamelCase; diff --git a/test/functionName/functionName.test.js b/test/functionName.test.js similarity index 100% rename from test/functionName/functionName.test.js rename to test/functionName.test.js diff --git a/test/functionName/functionName.js b/test/functionName/functionName.js deleted file mode 100644 index 3fb41366f..000000000 --- a/test/functionName/functionName.js +++ /dev/null @@ -1,2 +0,0 @@ -const functionName = fn => (console.debug(fn.name), fn); -module.exports = functionName; diff --git a/test/functions/functions.test.js b/test/functions.test.js similarity index 90% rename from test/functions/functions.test.js rename to test/functions.test.js index 92db006c1..6163d1b0c 100644 --- a/test/functions/functions.test.js +++ b/test/functions.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const functions = require('./functions.js'); +const {functions} = require('./_30s.js'); test('functions is a Function', () => { expect(functions).toBeInstanceOf(Function); diff --git a/test/functions/functions.js b/test/functions/functions.js deleted file mode 100644 index e01d43b3d..000000000 --- a/test/functions/functions.js +++ /dev/null @@ -1,6 +0,0 @@ -const functions = (obj, inherited = false) => - (inherited - ? [...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))] - : Object.keys(obj) - ).filter(key => typeof obj[key] === 'function'); -module.exports = functions; diff --git a/test/gcd/gcd.test.js b/test/gcd.test.js similarity index 91% rename from test/gcd/gcd.test.js rename to test/gcd.test.js index 0cb8d930a..764a628ca 100644 --- a/test/gcd/gcd.test.js +++ b/test/gcd.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const gcd = require('./gcd.js'); +const {gcd} = require('./_30s.js'); test('gcd is a Function', () => { expect(gcd).toBeInstanceOf(Function); diff --git a/test/gcd/gcd.js b/test/gcd/gcd.js deleted file mode 100644 index 06e88caa6..000000000 --- a/test/gcd/gcd.js +++ /dev/null @@ -1,5 +0,0 @@ -const gcd = (...arr) => { - const _gcd = (x, y) => (!y ? x : gcd(y, x % y)); - return [...arr].reduce((a, b) => _gcd(a, b)); -}; -module.exports = gcd; diff --git a/test/geometricProgression/geometricProgression.test.js b/test/geometricProgression.test.js similarity index 90% rename from test/geometricProgression/geometricProgression.test.js rename to test/geometricProgression.test.js index 6ac3ed8e4..6f3944be6 100644 --- a/test/geometricProgression/geometricProgression.test.js +++ b/test/geometricProgression.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const geometricProgression = require('./geometricProgression.js'); +const {geometricProgression} = require('./_30s.js'); test('geometricProgression is a Function', () => { expect(geometricProgression).toBeInstanceOf(Function); diff --git a/test/geometricProgression/geometricProgression.js b/test/geometricProgression/geometricProgression.js deleted file mode 100644 index fea8c663d..000000000 --- a/test/geometricProgression/geometricProgression.js +++ /dev/null @@ -1,5 +0,0 @@ -const geometricProgression = (end, start = 1, step = 2) => - Array.from({ length: Math.floor(Math.log(end / start) / Math.log(step)) + 1 }).map( - (v, i) => start * step ** i - ); -module.exports = geometricProgression; diff --git a/test/get/get.test.js b/test/get.test.js similarity index 89% rename from test/get/get.test.js rename to test/get.test.js index 715ee0033..06e90f56c 100644 --- a/test/get/get.test.js +++ b/test/get.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const get = require('./get.js'); +const {get} = require('./_30s.js'); test('get is a Function', () => { expect(get).toBeInstanceOf(Function); diff --git a/test/get/get.js b/test/get/get.js deleted file mode 100644 index 695c625b4..000000000 --- a/test/get/get.js +++ /dev/null @@ -1,9 +0,0 @@ -const get = (from, ...selectors) => - [...selectors].map(s => - s - .replace(/\[([^\[\]]*)\]/g, '.$1.') - .split('.') - .filter(t => t !== '') - .reduce((prev, cur) => prev && prev[cur], from) - ); -module.exports = get; diff --git a/test/getColonTimeFromDate/getColonTimeFromDate.test.js b/test/getColonTimeFromDate.test.js similarity index 68% rename from test/getColonTimeFromDate/getColonTimeFromDate.test.js rename to test/getColonTimeFromDate.test.js index e834ac265..6d14dee94 100644 --- a/test/getColonTimeFromDate/getColonTimeFromDate.test.js +++ b/test/getColonTimeFromDate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const getColonTimeFromDate = require('./getColonTimeFromDate.js'); +const {getColonTimeFromDate} = require('./_30s.js'); test('getColonTimeFromDate is a Function', () => { expect(getColonTimeFromDate).toBeInstanceOf(Function); diff --git a/test/getColonTimeFromDate/getColonTimeFromDate.js b/test/getColonTimeFromDate/getColonTimeFromDate.js deleted file mode 100644 index 352804b05..000000000 --- a/test/getColonTimeFromDate/getColonTimeFromDate.js +++ /dev/null @@ -1,2 +0,0 @@ -const getColonTimeFromDate = date => date.toTimeString().slice(0, 8); -module.exports = getColonTimeFromDate; diff --git a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js b/test/getDaysDiffBetweenDates.test.js similarity index 81% rename from test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js rename to test/getDaysDiffBetweenDates.test.js index 2128fe077..4fd396a39 100644 --- a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js +++ b/test/getDaysDiffBetweenDates.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const getDaysDiffBetweenDates = require('./getDaysDiffBetweenDates.js'); +const {getDaysDiffBetweenDates} = require('./_30s.js'); test('getDaysDiffBetweenDates is a Function', () => { expect(getDaysDiffBetweenDates).toBeInstanceOf(Function); diff --git a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js deleted file mode 100644 index ebfa776a3..000000000 --- a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js +++ /dev/null @@ -1,3 +0,0 @@ -const getDaysDiffBetweenDates = (dateInitial, dateFinal) => - (dateFinal - dateInitial) / (1000 * 3600 * 24); -module.exports = getDaysDiffBetweenDates; diff --git a/test/getImages/getImages.test.js b/test/getImages.test.js similarity index 93% rename from test/getImages/getImages.test.js rename to test/getImages.test.js index 668172d31..dc259cdd6 100644 --- a/test/getImages/getImages.test.js +++ b/test/getImages.test.js @@ -1,5 +1,5 @@ const expect = require("expect"); -const getImages = require("./getImages.js"); +const {getImages} = require("./_30s.js"); const jsdom = require("jsdom"); const { JSDOM } = jsdom; const TEST_HTML = new JSDOM("

    Hello world

    ").window.document; @@ -15,4 +15,4 @@ test("getImages returns an Array", () => { test("getImages removes duplicates from images Array", () => { expect(getImages(TEST_HTML, false).length).toBeLessThanOrEqual(getImages(TEST_HTML, true).length); expect(getImages(TEST_HTML, true)).toEqual(expect.arrayContaining(getImages(TEST_HTML, false))); -});\n +}); diff --git a/test/getImages/getImages.js b/test/getImages/getImages.js deleted file mode 100644 index 675dc839f..000000000 --- a/test/getImages/getImages.js +++ /dev/null @@ -1,5 +0,0 @@ -const getImages = (el, includeDuplicates = false) => { - const images = [...el.getElementsByTagName('img')].map(img => img.getAttribute('src')); - return includeDuplicates ? images : [...new Set(images)]; -}; -module.exports = getImages; diff --git a/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.test.js b/test/getMeridiemSuffixOfInteger.test.js similarity index 66% rename from test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.test.js rename to test/getMeridiemSuffixOfInteger.test.js index 936eb3c13..99a8bfe47 100644 --- a/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.test.js +++ b/test/getMeridiemSuffixOfInteger.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const getMeridiemSuffixOfInteger = require('./getMeridiemSuffixOfInteger.js'); +const {getMeridiemSuffixOfInteger} = require('./_30s.js'); test('getMeridiemSuffixOfInteger is a Function', () => { expect(getMeridiemSuffixOfInteger).toBeInstanceOf(Function); diff --git a/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js b/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js deleted file mode 100644 index 6e91ea80c..000000000 --- a/test/getMeridiemSuffixOfInteger/getMeridiemSuffixOfInteger.js +++ /dev/null @@ -1,9 +0,0 @@ -const getMeridiemSuffixOfInteger = num => - num === 0 || num === 24 - ? 12 + 'am' - : num === 12 - ? 12 + 'pm' - : num < 12 - ? (num % 12) + 'am' - : (num % 12) + 'pm'; -module.exports = getMeridiemSuffixOfInteger; diff --git a/test/getScrollPosition/getScrollPosition.test.js b/test/getScrollPosition.test.js similarity index 69% rename from test/getScrollPosition/getScrollPosition.test.js rename to test/getScrollPosition.test.js index 0137c4eb4..c061d268b 100644 --- a/test/getScrollPosition/getScrollPosition.test.js +++ b/test/getScrollPosition.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const getScrollPosition = require('./getScrollPosition.js'); +const {getScrollPosition} = require('./_30s.js'); test('getScrollPosition is a Function', () => { expect(getScrollPosition).toBeInstanceOf(Function); diff --git a/test/getScrollPosition/getScrollPosition.js b/test/getScrollPosition/getScrollPosition.js deleted file mode 100644 index aa3845525..000000000 --- a/test/getScrollPosition/getScrollPosition.js +++ /dev/null @@ -1,5 +0,0 @@ -const getScrollPosition = (el = window) => ({ - x: el.pageXOffset !== undefined ? el.pageXOffset : el.scrollLeft, - y: el.pageYOffset !== undefined ? el.pageYOffset : el.scrollTop -}); -module.exports = getScrollPosition; diff --git a/test/getStyle/getStyle.test.js b/test/getStyle.test.js similarity index 74% rename from test/getStyle/getStyle.test.js rename to test/getStyle.test.js index 6f279ab81..c6d6e0a1a 100644 --- a/test/getStyle/getStyle.test.js +++ b/test/getStyle.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const getStyle = require('./getStyle.js'); +const {getStyle} = require('./_30s.js'); test('getStyle is a Function', () => { expect(getStyle).toBeInstanceOf(Function); diff --git a/test/getStyle/getStyle.js b/test/getStyle/getStyle.js deleted file mode 100644 index b276a13b0..000000000 --- a/test/getStyle/getStyle.js +++ /dev/null @@ -1,2 +0,0 @@ -const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; -module.exports = getStyle; diff --git a/test/getType/getType.test.js b/test/getType.test.js similarity index 84% rename from test/getType/getType.test.js rename to test/getType.test.js index 660a7f020..c402a0a16 100644 --- a/test/getType/getType.test.js +++ b/test/getType.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const getType = require('./getType.js'); +const {getType} = require('./_30s.js'); test('getType is a Function', () => { expect(getType).toBeInstanceOf(Function); diff --git a/test/getType/getType.js b/test/getType/getType.js deleted file mode 100644 index 6b3bd5f10..000000000 --- a/test/getType/getType.js +++ /dev/null @@ -1,3 +0,0 @@ -const getType = v => - v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); -module.exports = getType; diff --git a/test/getURLParameters/getURLParameters.test.js b/test/getURLParameters.test.js similarity index 85% rename from test/getURLParameters/getURLParameters.test.js rename to test/getURLParameters.test.js index baf391631..118cc4973 100644 --- a/test/getURLParameters/getURLParameters.test.js +++ b/test/getURLParameters.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const getURLParameters = require('./getURLParameters.js'); +const {getURLParameters} = require('./_30s.js'); test('getURLParameters is a Function', () => { expect(getURLParameters).toBeInstanceOf(Function); diff --git a/test/getURLParameters/getURLParameters.js b/test/getURLParameters/getURLParameters.js deleted file mode 100644 index 288c65d3b..000000000 --- a/test/getURLParameters/getURLParameters.js +++ /dev/null @@ -1,6 +0,0 @@ -const getURLParameters = url => - (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce( - (a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), - {} - ); -module.exports = getURLParameters; diff --git a/test/groupBy/groupBy.test.js b/test/groupBy.test.js similarity index 91% rename from test/groupBy/groupBy.test.js rename to test/groupBy.test.js index de3d0560b..e0dd8740a 100644 --- a/test/groupBy/groupBy.test.js +++ b/test/groupBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const groupBy = require('./groupBy.js'); +const {groupBy} = require('./_30s.js'); test('groupBy is a Function', () => { expect(groupBy).toBeInstanceOf(Function); diff --git a/test/groupBy/groupBy.js b/test/groupBy/groupBy.js deleted file mode 100644 index 8f4c9b95e..000000000 --- a/test/groupBy/groupBy.js +++ /dev/null @@ -1,6 +0,0 @@ -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; - }, {}); -module.exports = groupBy; diff --git a/test/hammingDistance/hammingDistance.test.js b/test/hammingDistance.test.js similarity index 80% rename from test/hammingDistance/hammingDistance.test.js rename to test/hammingDistance.test.js index b884b6c89..c156772df 100644 --- a/test/hammingDistance/hammingDistance.test.js +++ b/test/hammingDistance.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hammingDistance = require('./hammingDistance.js'); +const {hammingDistance} = require('./_30s.js'); test('hammingDistance is a Function', () => { expect(hammingDistance).toBeInstanceOf(Function); diff --git a/test/hammingDistance/hammingDistance.js b/test/hammingDistance/hammingDistance.js deleted file mode 100644 index 429b458c3..000000000 --- a/test/hammingDistance/hammingDistance.js +++ /dev/null @@ -1,2 +0,0 @@ -const hammingDistance = (num1, num2) => ((num1 ^ num2).toString(2).match(/1/g) || '').length; -module.exports = hammingDistance; diff --git a/test/hasClass/hasClass.test.js b/test/hasClass.test.js similarity index 74% rename from test/hasClass/hasClass.test.js rename to test/hasClass.test.js index cd8fc69c7..d7f796238 100644 --- a/test/hasClass/hasClass.test.js +++ b/test/hasClass.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hasClass = require('./hasClass.js'); +const {hasClass} = require('./_30s.js'); test('hasClass is a Function', () => { expect(hasClass).toBeInstanceOf(Function); diff --git a/test/hasClass/hasClass.js b/test/hasClass/hasClass.js deleted file mode 100644 index f6c66e6e3..000000000 --- a/test/hasClass/hasClass.js +++ /dev/null @@ -1,2 +0,0 @@ -const hasClass = (el, className) => el.classList.contains(className); -module.exports = hasClass; diff --git a/test/hasFlags/hasFlags.test.js b/test/hasFlags.test.js similarity index 74% rename from test/hasFlags/hasFlags.test.js rename to test/hasFlags.test.js index b709e53f5..14f5a13f0 100644 --- a/test/hasFlags/hasFlags.test.js +++ b/test/hasFlags.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hasFlags = require('./hasFlags.js'); +const {hasFlags} = require('./_30s.js'); test('hasFlags is a Function', () => { expect(hasFlags).toBeInstanceOf(Function); diff --git a/test/hasFlags/hasFlags.js b/test/hasFlags/hasFlags.js deleted file mode 100644 index fe3fbb363..000000000 --- a/test/hasFlags/hasFlags.js +++ /dev/null @@ -1,3 +0,0 @@ -const hasFlags = (...flags) => - flags.every(flag => process.argv.includes(/^-{1,2}/.test(flag) ? flag : '--' + flag)); -module.exports = hasFlags; diff --git a/test/hashBrowser/hashBrowser.test.js b/test/hashBrowser.test.js similarity index 72% rename from test/hashBrowser/hashBrowser.test.js rename to test/hashBrowser.test.js index e51fe281c..71ced6299 100644 --- a/test/hashBrowser/hashBrowser.test.js +++ b/test/hashBrowser.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hashBrowser = require('./hashBrowser.js'); +const {hashBrowser} = require('./_30s.js'); test('hashBrowser is a Function', () => { expect(hashBrowser).toBeInstanceOf(Function); diff --git a/test/hashBrowser/hashBrowser.js b/test/hashBrowser/hashBrowser.js deleted file mode 100644 index 03b91f14d..000000000 --- a/test/hashBrowser/hashBrowser.js +++ /dev/null @@ -1,9 +0,0 @@ -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(''); - }); -module.exports = hashBrowser; diff --git a/test/hashNode/hashNode.test.js b/test/hashNode.test.js similarity index 89% rename from test/hashNode/hashNode.test.js rename to test/hashNode.test.js index 6cf659be2..126601da4 100644 --- a/test/hashNode/hashNode.test.js +++ b/test/hashNode.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hashNode = require('./hashNode.js'); +const {hashNode} = require('./_30s.js'); test('hashNode is a Function', () => { expect(hashNode).toBeInstanceOf(Function); diff --git a/test/hashNode/hashNode.js b/test/hashNode/hashNode.js deleted file mode 100644 index 49aa3371d..000000000 --- a/test/hashNode/hashNode.js +++ /dev/null @@ -1,15 +0,0 @@ -const crypto = require('crypto'); -const hashNode = val => - new Promise(resolve => - setTimeout( - () => - resolve( - crypto - .createHash('sha256') - .update(val) - .digest('hex') - ), - 0 - ) - ); -module.exports = hashNode; diff --git a/test/head/head.test.js b/test/head.test.js similarity index 96% rename from test/head/head.test.js rename to test/head.test.js index 4330a382a..c59af7dab 100644 --- a/test/head/head.test.js +++ b/test/head.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const head = require('./head.js'); +const {head} = require('./_30s.js'); test('head is a Function', () => { expect(head).toBeInstanceOf(Function); diff --git a/test/head/head.js b/test/head/head.js deleted file mode 100644 index 6f7144f5b..000000000 --- a/test/head/head.js +++ /dev/null @@ -1,2 +0,0 @@ -const head = arr => arr[0]; -module.exports = head; diff --git a/test/heronArea/heronArea.test.js b/test/heronArea.test.js similarity index 73% rename from test/heronArea/heronArea.test.js rename to test/heronArea.test.js index e323009ef..b0a76d1fc 100644 --- a/test/heronArea/heronArea.test.js +++ b/test/heronArea.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const heronArea = require('./heronArea.js'); +const {heronArea} = require('./_30s.js'); test('heronArea is a Function', () => { expect(heronArea).toBeInstanceOf(Function); diff --git a/test/heronArea/heronArea.js b/test/heronArea/heronArea.js deleted file mode 100644 index 3735380f1..000000000 --- a/test/heronArea/heronArea.js +++ /dev/null @@ -1,5 +0,0 @@ -const heronArea = (side_a, side_b, side_c) => { - const p = (side_a + side_b + side_c) / 2 - return Math.sqrt(p * (p-side_a) * (p-side_b) * (p-side_c)) - }; -module.exports = heronArea; diff --git a/test/hexToRGB/hexToRGB.test.js b/test/hexToRGB.test.js similarity index 92% rename from test/hexToRGB/hexToRGB.test.js rename to test/hexToRGB.test.js index 2f2bf427e..3526c748f 100644 --- a/test/hexToRGB/hexToRGB.test.js +++ b/test/hexToRGB.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hexToRGB = require('./hexToRGB.js'); +const {hexToRGB} = require('./_30s.js'); test('hexToRGB is a Function', () => { expect(hexToRGB).toBeInstanceOf(Function); diff --git a/test/hexToRGB/hexToRGB.js b/test/hexToRGB/hexToRGB.js deleted file mode 100644 index 3cce4385b..000000000 --- a/test/hexToRGB/hexToRGB.js +++ /dev/null @@ -1,20 +0,0 @@ -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}` : '') + - ')' - ); -}; -module.exports = hexToRGB; diff --git a/test/hide/hide.test.js b/test/hide.test.js similarity index 75% rename from test/hide/hide.test.js rename to test/hide.test.js index 7cfa1ec53..ed5ad2ad1 100644 --- a/test/hide/hide.test.js +++ b/test/hide.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hide = require('./hide.js'); +const {hide} = require('./_30s.js'); test('hide is a Function', () => { expect(hide).toBeInstanceOf(Function); diff --git a/test/hide/hide.js b/test/hide/hide.js deleted file mode 100644 index 0ae2b0d3c..000000000 --- a/test/hide/hide.js +++ /dev/null @@ -1,2 +0,0 @@ -const hide = els => els.forEach(e => (e.style.display = 'none')); -module.exports = hide; diff --git a/test/howManyTimes/howManyTimes.test.js b/test/howManyTimes.test.js similarity index 71% rename from test/howManyTimes/howManyTimes.test.js rename to test/howManyTimes.test.js index e0d7efe30..5c6b39838 100644 --- a/test/howManyTimes/howManyTimes.test.js +++ b/test/howManyTimes.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const howManyTimes = require('./howManyTimes.js'); +const {howManyTimes} = require('./_30s.js'); test('howManyTimes is a Function', () => { expect(howManyTimes).toBeInstanceOf(Function); diff --git a/test/howManyTimes/howManyTimes.js b/test/howManyTimes/howManyTimes.js deleted file mode 100644 index 029dff672..000000000 --- a/test/howManyTimes/howManyTimes.js +++ /dev/null @@ -1,11 +0,0 @@ -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; -}; -module.exports = howManyTimes; diff --git a/test/httpDelete/httpDelete.test.js b/test/httpDelete.test.js similarity index 72% rename from test/httpDelete/httpDelete.test.js rename to test/httpDelete.test.js index 6603d33bd..b5ea1c17a 100644 --- a/test/httpDelete/httpDelete.test.js +++ b/test/httpDelete.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const httpDelete = require('./httpDelete.js'); +const {httpDelete} = require('./_30s.js'); test('httpDelete is a Function', () => { expect(httpDelete).toBeInstanceOf(Function); diff --git a/test/httpDelete/httpDelete.js b/test/httpDelete/httpDelete.js deleted file mode 100644 index 5b86d324a..000000000 --- a/test/httpDelete/httpDelete.js +++ /dev/null @@ -1,8 +0,0 @@ -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(); -}; -module.exports = httpDelete; diff --git a/test/httpGet/httpGet.test.js b/test/httpGet.test.js similarity index 74% rename from test/httpGet/httpGet.test.js rename to test/httpGet.test.js index 5a19d5adc..9a02c0728 100644 --- a/test/httpGet/httpGet.test.js +++ b/test/httpGet.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const httpGet = require('./httpGet.js'); +const {httpGet} = require('./_30s.js'); test('httpGet is a Function', () => { expect(httpGet).toBeInstanceOf(Function); diff --git a/test/httpGet/httpGet.js b/test/httpGet/httpGet.js deleted file mode 100644 index 73f537e73..000000000 --- a/test/httpGet/httpGet.js +++ /dev/null @@ -1,8 +0,0 @@ -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(); -}; -module.exports = httpGet; diff --git a/test/httpPost/httpPost.test.js b/test/httpPost.test.js similarity index 74% rename from test/httpPost/httpPost.test.js rename to test/httpPost.test.js index 13ec36ccd..85cd66d59 100644 --- a/test/httpPost/httpPost.test.js +++ b/test/httpPost.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const httpPost = require('./httpPost.js'); +const {httpPost} = require('./_30s.js'); test('httpPost is a Function', () => { expect(httpPost).toBeInstanceOf(Function); diff --git a/test/httpPost/httpPost.js b/test/httpPost/httpPost.js deleted file mode 100644 index f1380dd1b..000000000 --- a/test/httpPost/httpPost.js +++ /dev/null @@ -1,9 +0,0 @@ -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); -}; -module.exports = httpPost; diff --git a/test/httpPut/httpPut.test.js b/test/httpPut.test.js similarity index 74% rename from test/httpPut/httpPut.test.js rename to test/httpPut.test.js index d76892baf..8b472caa7 100644 --- a/test/httpPut/httpPut.test.js +++ b/test/httpPut.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const httpPut = require('./httpPut.js'); +const {httpPut} = require('./_30s.js'); test('httpPut is a Function', () => { expect(httpPut).toBeInstanceOf(Function); diff --git a/test/httpPut/httpPut.js b/test/httpPut/httpPut.js deleted file mode 100644 index 8b966b39a..000000000 --- a/test/httpPut/httpPut.js +++ /dev/null @@ -1,9 +0,0 @@ -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); -}; -module.exports = httpPut; diff --git a/test/httpsRedirect/httpsRedirect.test.js b/test/httpsRedirect.test.js similarity index 71% rename from test/httpsRedirect/httpsRedirect.test.js rename to test/httpsRedirect.test.js index 68dd20f32..cf35a863a 100644 --- a/test/httpsRedirect/httpsRedirect.test.js +++ b/test/httpsRedirect.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const httpsRedirect = require('./httpsRedirect.js'); +const {httpsRedirect} = require('./_30s.js'); test('httpsRedirect is a Function', () => { expect(httpsRedirect).toBeInstanceOf(Function); diff --git a/test/httpsRedirect/httpsRedirect.js b/test/httpsRedirect/httpsRedirect.js deleted file mode 100644 index ef477f282..000000000 --- a/test/httpsRedirect/httpsRedirect.js +++ /dev/null @@ -1,4 +0,0 @@ -const httpsRedirect = () => { - if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]); -}; -module.exports = httpsRedirect; diff --git a/test/hz/hz.test.js b/test/hz.test.js similarity index 76% rename from test/hz/hz.test.js rename to test/hz.test.js index 58d0b4678..34cc4c187 100644 --- a/test/hz/hz.test.js +++ b/test/hz.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const hz = require('./hz.js'); +const {hz} = require('./_30s.js'); test('hz is a Function', () => { expect(hz).toBeInstanceOf(Function); diff --git a/test/hz/hz.js b/test/hz/hz.js deleted file mode 100644 index 7172074bb..000000000 --- a/test/hz/hz.js +++ /dev/null @@ -1,6 +0,0 @@ -const hz = (fn, iterations = 100) => { - const before = performance.now(); - for (let i = 0; i < iterations; i++) fn(); - return (1000 * iterations) / (performance.now() - before); -}; -module.exports = hz; diff --git a/test/inRange/inRange.test.js b/test/inRange.test.js similarity index 93% rename from test/inRange/inRange.test.js rename to test/inRange.test.js index c72efec2d..9a93aa20f 100644 --- a/test/inRange/inRange.test.js +++ b/test/inRange.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const inRange = require('./inRange.js'); +const {inRange} = require('./_30s.js'); test('inRange is a Function', () => { expect(inRange).toBeInstanceOf(Function); diff --git a/test/inRange/inRange.js b/test/inRange/inRange.js deleted file mode 100644 index 022dd4344..000000000 --- a/test/inRange/inRange.js +++ /dev/null @@ -1,5 +0,0 @@ -const inRange = (n, start, end = null) => { - if (end && start > end) [end, start] = [start, end]; - return end == null ? n >= 0 && n < start : n >= start && n < end; -}; -module.exports = inRange; diff --git a/test/indentString/indentString.test.js b/test/indentString.test.js similarity index 87% rename from test/indentString/indentString.test.js rename to test/indentString.test.js index 474523fb8..0ba6043f5 100644 --- a/test/indentString/indentString.test.js +++ b/test/indentString.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const indentString = require('./indentString.js'); +const {indentString} = require('./_30s.js'); test('indentString is a Function', () => { expect(indentString).toBeInstanceOf(Function); diff --git a/test/indentString/indentString.js b/test/indentString/indentString.js deleted file mode 100644 index 9f11c4efa..000000000 --- a/test/indentString/indentString.js +++ /dev/null @@ -1,2 +0,0 @@ -const indentString = (str, count, indent = ' ') => str.replace(/^/gm, indent.repeat(count)); -module.exports = indentString; diff --git a/test/indexOfAll/indexOfAll.test.js b/test/indexOfAll.test.js similarity index 88% rename from test/indexOfAll/indexOfAll.test.js rename to test/indexOfAll.test.js index 90233ce78..cc0620a6d 100644 --- a/test/indexOfAll/indexOfAll.test.js +++ b/test/indexOfAll.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const indexOfAll = require('./indexOfAll.js'); +const {indexOfAll} = require('./_30s.js'); test('indexOfAll is a Function', () => { expect(indexOfAll).toBeInstanceOf(Function); diff --git a/test/indexOfAll/indexOfAll.js b/test/indexOfAll/indexOfAll.js deleted file mode 100644 index f8e1225c7..000000000 --- a/test/indexOfAll/indexOfAll.js +++ /dev/null @@ -1,2 +0,0 @@ -const indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []); -module.exports = indexOfAll; diff --git a/test/initial/initial.test.js b/test/initial.test.js similarity index 85% rename from test/initial/initial.test.js rename to test/initial.test.js index 2c8a8b944..83507fd70 100644 --- a/test/initial/initial.test.js +++ b/test/initial.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const initial = require('./initial.js'); +const {initial} = require('./_30s.js'); test('initial is a Function', () => { expect(initial).toBeInstanceOf(Function); diff --git a/test/initial/initial.js b/test/initial/initial.js deleted file mode 100644 index e3fa5e368..000000000 --- a/test/initial/initial.js +++ /dev/null @@ -1,2 +0,0 @@ -const initial = arr => arr.slice(0, -1); -module.exports = initial; diff --git a/test/initialize2DArray/initialize2DArray.test.js b/test/initialize2DArray.test.js similarity index 82% rename from test/initialize2DArray/initialize2DArray.test.js rename to test/initialize2DArray.test.js index 885900afe..d520752c5 100644 --- a/test/initialize2DArray/initialize2DArray.test.js +++ b/test/initialize2DArray.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const initialize2DArray = require('./initialize2DArray.js'); +const {initialize2DArray} = require('./_30s.js'); test('initialize2DArray is a Function', () => { expect(initialize2DArray).toBeInstanceOf(Function); diff --git a/test/initialize2DArray/initialize2DArray.js b/test/initialize2DArray/initialize2DArray.js deleted file mode 100644 index 362362f11..000000000 --- a/test/initialize2DArray/initialize2DArray.js +++ /dev/null @@ -1,3 +0,0 @@ -const initialize2DArray = (w, h, val = null) => - Array.from({ length: h }).map(() => Array.from({ length: w }).fill(val)); -module.exports = initialize2DArray; diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.test.js b/test/initializeArrayWithRange.test.js similarity index 89% rename from test/initializeArrayWithRange/initializeArrayWithRange.test.js rename to test/initializeArrayWithRange.test.js index a645edc54..ca83833f5 100644 --- a/test/initializeArrayWithRange/initializeArrayWithRange.test.js +++ b/test/initializeArrayWithRange.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const initializeArrayWithRange = require('./initializeArrayWithRange.js'); +const {initializeArrayWithRange} = require('./_30s.js'); test('initializeArrayWithRange is a Function', () => { expect(initializeArrayWithRange).toBeInstanceOf(Function); diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.js b/test/initializeArrayWithRange/initializeArrayWithRange.js deleted file mode 100644 index a096edd8d..000000000 --- a/test/initializeArrayWithRange/initializeArrayWithRange.js +++ /dev/null @@ -1,3 +0,0 @@ -const initializeArrayWithRange = (end, start = 0, step = 1) => - Array.from({ length: Math.ceil((end - start + 1) / step) }, (v, i) => i * step + start); -module.exports = initializeArrayWithRange; diff --git a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js b/test/initializeArrayWithRangeRight.test.js similarity index 66% rename from test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js rename to test/initializeArrayWithRangeRight.test.js index 61f60f825..8bfbc0c86 100644 --- a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js +++ b/test/initializeArrayWithRangeRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const initializeArrayWithRangeRight = require('./initializeArrayWithRangeRight.js'); +const {initializeArrayWithRangeRight} = require('./_30s.js'); test('initializeArrayWithRangeRight is a Function', () => { expect(initializeArrayWithRangeRight).toBeInstanceOf(Function); diff --git a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js b/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js deleted file mode 100644 index f6a839c7f..000000000 --- a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.js +++ /dev/null @@ -1,5 +0,0 @@ -const initializeArrayWithRangeRight = (end, start = 0, step = 1) => - Array.from({ length: Math.ceil((end + 1 - start) / step) }).map( - (v, i, arr) => (arr.length - i - 1) * step + start - ); -module.exports = initializeArrayWithRangeRight; diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.test.js b/test/initializeArrayWithValues.test.js similarity index 79% rename from test/initializeArrayWithValues/initializeArrayWithValues.test.js rename to test/initializeArrayWithValues.test.js index 6b1b22eb3..d47e6f60c 100644 --- a/test/initializeArrayWithValues/initializeArrayWithValues.test.js +++ b/test/initializeArrayWithValues.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const initializeArrayWithValues = require('./initializeArrayWithValues.js'); +const {initializeArrayWithValues} = require('./_30s.js'); test('initializeArrayWithValues is a Function', () => { expect(initializeArrayWithValues).toBeInstanceOf(Function); diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.js b/test/initializeArrayWithValues/initializeArrayWithValues.js deleted file mode 100644 index 6f4ec947e..000000000 --- a/test/initializeArrayWithValues/initializeArrayWithValues.js +++ /dev/null @@ -1,2 +0,0 @@ -const initializeArrayWithValues = (n, val = 0) => Array(n).fill(val); -module.exports = initializeArrayWithValues; diff --git a/test/initializeNDArray/initializeNDArray.test.js b/test/initializeNDArray.test.js similarity index 69% rename from test/initializeNDArray/initializeNDArray.test.js rename to test/initializeNDArray.test.js index df9199213..b394f5d2a 100644 --- a/test/initializeNDArray/initializeNDArray.test.js +++ b/test/initializeNDArray.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const initializeNDArray = require('./initializeNDArray.js'); +const {initializeNDArray} = require('./_30s.js'); test('initializeNDArray is a Function', () => { expect(initializeNDArray).toBeInstanceOf(Function); diff --git a/test/initializeNDArray/initializeNDArray.js b/test/initializeNDArray/initializeNDArray.js deleted file mode 100644 index 44bcfe3a8..000000000 --- a/test/initializeNDArray/initializeNDArray.js +++ /dev/null @@ -1,5 +0,0 @@ -const initializeNDArray = (val, ...args) => - args.length === 0 - ? val - : Array.from({ length: args[0] }).map(() => initializeNDArray(val, ...args.slice(1))); -module.exports = initializeNDArray; diff --git a/test/insertAfter/insertAfter.test.js b/test/insertAfter.test.js similarity index 72% rename from test/insertAfter/insertAfter.test.js rename to test/insertAfter.test.js index 05f508d1a..3363c30ea 100644 --- a/test/insertAfter/insertAfter.test.js +++ b/test/insertAfter.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const insertAfter = require('./insertAfter.js'); +const {insertAfter} = require('./_30s.js'); test('insertAfter is a Function', () => { expect(insertAfter).toBeInstanceOf(Function); diff --git a/test/insertAfter/insertAfter.js b/test/insertAfter/insertAfter.js deleted file mode 100644 index 69de4395b..000000000 --- a/test/insertAfter/insertAfter.js +++ /dev/null @@ -1,2 +0,0 @@ -const insertAfter = (el, htmlString) => el.insertAdjacentHTML('afterend', htmlString); -module.exports = insertAfter; diff --git a/test/insertBefore/insertBefore.test.js b/test/insertBefore.test.js similarity index 71% rename from test/insertBefore/insertBefore.test.js rename to test/insertBefore.test.js index a482fb3df..f78e3e17a 100644 --- a/test/insertBefore/insertBefore.test.js +++ b/test/insertBefore.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const insertBefore = require('./insertBefore.js'); +const {insertBefore} = require('./_30s.js'); test('insertBefore is a Function', () => { expect(insertBefore).toBeInstanceOf(Function); diff --git a/test/insertBefore/insertBefore.js b/test/insertBefore/insertBefore.js deleted file mode 100644 index 8e29af968..000000000 --- a/test/insertBefore/insertBefore.js +++ /dev/null @@ -1,2 +0,0 @@ -const insertBefore = (el, htmlString) => el.insertAdjacentHTML('beforebegin', htmlString); -module.exports = insertBefore; diff --git a/test/intersection/intersection.test.js b/test/intersection.test.js similarity index 83% rename from test/intersection/intersection.test.js rename to test/intersection.test.js index 39186b7bb..e4a9543d3 100644 --- a/test/intersection/intersection.test.js +++ b/test/intersection.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const intersection = require('./intersection.js'); +const {intersection} = require('./_30s.js'); test('intersection is a Function', () => { expect(intersection).toBeInstanceOf(Function); diff --git a/test/intersection/intersection.js b/test/intersection/intersection.js deleted file mode 100644 index 521059129..000000000 --- a/test/intersection/intersection.js +++ /dev/null @@ -1,5 +0,0 @@ -const intersection = (a, b) => { - const s = new Set(b); - return a.filter(x => s.has(x)); -}; -module.exports = intersection; diff --git a/test/intersectionBy/intersectionBy.test.js b/test/intersectionBy.test.js similarity index 86% rename from test/intersectionBy/intersectionBy.test.js rename to test/intersectionBy.test.js index 5d69246bd..90fe4c5d8 100644 --- a/test/intersectionBy/intersectionBy.test.js +++ b/test/intersectionBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const intersectionBy = require('./intersectionBy.js'); +const {intersectionBy} = require('./_30s.js'); test('intersectionBy is a Function', () => { expect(intersectionBy).toBeInstanceOf(Function); diff --git a/test/intersectionBy/intersectionBy.js b/test/intersectionBy/intersectionBy.js deleted file mode 100644 index 0a6684fce..000000000 --- a/test/intersectionBy/intersectionBy.js +++ /dev/null @@ -1,5 +0,0 @@ -const intersectionBy = (a, b, fn) => { - const s = new Set(b.map(fn)); - return a.filter(x => s.has(fn(x))); -}; -module.exports = intersectionBy; diff --git a/test/intersectionWith/intersectionWith.test.js b/test/intersectionWith.test.js similarity index 87% rename from test/intersectionWith/intersectionWith.test.js rename to test/intersectionWith.test.js index b9a3b2008..513475e95 100644 --- a/test/intersectionWith/intersectionWith.test.js +++ b/test/intersectionWith.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const intersectionWith = require('./intersectionWith.js'); +const {intersectionWith} = require('./_30s.js'); test('intersectionWith is a Function', () => { expect(intersectionWith).toBeInstanceOf(Function); diff --git a/test/intersectionWith/intersectionWith.js b/test/intersectionWith/intersectionWith.js deleted file mode 100644 index 9b194c6e0..000000000 --- a/test/intersectionWith/intersectionWith.js +++ /dev/null @@ -1,2 +0,0 @@ -const intersectionWith = (a, b, comp) => a.filter(x => b.findIndex(y => comp(x, y)) !== -1); -module.exports = intersectionWith; diff --git a/test/invertKeyValues/invertKeyValues.test.js b/test/invertKeyValues.test.js similarity index 91% rename from test/invertKeyValues/invertKeyValues.test.js rename to test/invertKeyValues.test.js index 3c431ee6a..ccbd78030 100644 --- a/test/invertKeyValues/invertKeyValues.test.js +++ b/test/invertKeyValues.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const invertKeyValues = require('./invertKeyValues.js'); +const {invertKeyValues} = require('./_30s.js'); test('invertKeyValues is a Function', () => { expect(invertKeyValues).toBeInstanceOf(Function); diff --git a/test/invertKeyValues/invertKeyValues.js b/test/invertKeyValues/invertKeyValues.js deleted file mode 100644 index 5c6546dbe..000000000 --- a/test/invertKeyValues/invertKeyValues.js +++ /dev/null @@ -1,8 +0,0 @@ -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; - }, {}); -module.exports = invertKeyValues; diff --git a/test/is/is.test.js b/test/is.test.js similarity index 97% rename from test/is/is.test.js rename to test/is.test.js index 5309f0c08..48ec43edc 100644 --- a/test/is/is.test.js +++ b/test/is.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const is = require('./is.js'); +const {is} = require('./_30s.js'); test('is is a Function', () => { expect(is).toBeInstanceOf(Function); diff --git a/test/is/is.js b/test/is/is.js deleted file mode 100644 index ee5b7f6ba..000000000 --- a/test/is/is.js +++ /dev/null @@ -1,2 +0,0 @@ -const is = (type, val) => ![, null].includes(val) && val.constructor === type; -module.exports = is; diff --git a/test/isAbsoluteURL/isAbsoluteURL.test.js b/test/isAbsoluteURL.test.js similarity index 89% rename from test/isAbsoluteURL/isAbsoluteURL.test.js rename to test/isAbsoluteURL.test.js index 806ac881c..5e36e8b54 100644 --- a/test/isAbsoluteURL/isAbsoluteURL.test.js +++ b/test/isAbsoluteURL.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isAbsoluteURL = require('./isAbsoluteURL.js'); +const {isAbsoluteURL} = require('./_30s.js'); test('isAbsoluteURL is a Function', () => { expect(isAbsoluteURL).toBeInstanceOf(Function); diff --git a/test/isAbsoluteURL/isAbsoluteURL.js b/test/isAbsoluteURL/isAbsoluteURL.js deleted file mode 100644 index 8d5950d20..000000000 --- a/test/isAbsoluteURL/isAbsoluteURL.js +++ /dev/null @@ -1,2 +0,0 @@ -const isAbsoluteURL = str => /^[a-z][a-z0-9+.-]*:/.test(str); -module.exports = isAbsoluteURL; diff --git a/test/isAfterDate/isAfterDate.test.js b/test/isAfterDate.test.js similarity index 89% rename from test/isAfterDate/isAfterDate.test.js rename to test/isAfterDate.test.js index 4332eab5a..2386fe9a9 100644 --- a/test/isAfterDate/isAfterDate.test.js +++ b/test/isAfterDate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isAfterDate = require('./isAfterDate.js'); +const {isAfterDate} = require('./_30s.js'); test('isAfterDate is a Function', () => { expect(isAfterDate).toBeInstanceOf(Function); diff --git a/test/isAfterDate/isAfterDate.js b/test/isAfterDate/isAfterDate.js deleted file mode 100644 index e489c8439..000000000 --- a/test/isAfterDate/isAfterDate.js +++ /dev/null @@ -1,2 +0,0 @@ -const isAfterDate = (dateA, dateB) => dateA > dateB; -module.exports = isAfterDate; diff --git a/test/isAnagram/isAnagram.test.js b/test/isAnagram.test.js similarity index 92% rename from test/isAnagram/isAnagram.test.js rename to test/isAnagram.test.js index 6fc0a9cb6..9258a2193 100644 --- a/test/isAnagram/isAnagram.test.js +++ b/test/isAnagram.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isAnagram = require('./isAnagram.js'); +const {isAnagram} = require('./_30s.js'); test('isAnagram is a Function', () => { expect(isAnagram).toBeInstanceOf(Function); diff --git a/test/isAnagram/isAnagram.js b/test/isAnagram/isAnagram.js deleted file mode 100644 index 72931b190..000000000 --- a/test/isAnagram/isAnagram.js +++ /dev/null @@ -1,11 +0,0 @@ -const isAnagram = (str1, str2) => { - const normalize = str => - str - .toLowerCase() - .replace(/[^a-z0-9]/gi, '') - .split('') - .sort() - .join(''); - return normalize(str1) === normalize(str2); -}; -module.exports = isAnagram; diff --git a/test/isArmstrongNumber/isArmstrongNumber.test.js b/test/isArmstrongNumber.test.js similarity index 69% rename from test/isArmstrongNumber/isArmstrongNumber.test.js rename to test/isArmstrongNumber.test.js index 946cfa76f..93993ac5d 100644 --- a/test/isArmstrongNumber/isArmstrongNumber.test.js +++ b/test/isArmstrongNumber.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isArmstrongNumber = require('./isArmstrongNumber.js'); +const {isArmstrongNumber} = require('./_30s.js'); test('isArmstrongNumber is a Function', () => { expect(isArmstrongNumber).toBeInstanceOf(Function); diff --git a/test/isArmstrongNumber/isArmstrongNumber.js b/test/isArmstrongNumber/isArmstrongNumber.js deleted file mode 100644 index b4933a796..000000000 --- a/test/isArmstrongNumber/isArmstrongNumber.js +++ /dev/null @@ -1,5 +0,0 @@ -const isArmstrongNumber = digits => - (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)( - (digits + '').split('') - ); -module.exports = isArmstrongNumber; diff --git a/test/isArray/isArray.js b/test/isArray/isArray.js deleted file mode 100644 index 44cb6f381..000000000 --- a/test/isArray/isArray.js +++ /dev/null @@ -1,2 +0,0 @@ -const isArray = val => Array.isArray(val); -module.exports = isArray; diff --git a/test/isArray/isArray.test.js b/test/isArray/isArray.test.js deleted file mode 100644 index 5ca77144b..000000000 --- a/test/isArray/isArray.test.js +++ /dev/null @@ -1,12 +0,0 @@ -const expect = require('expect'); -const isArray = require('./isArray.js'); - -test('isArray is a Function', () => { - expect(isArray).toBeInstanceOf(Function); -}); -test('passed value is an array', () => { - expect(isArray([1])).toBeTruthy(); -}); -test('passed value is not an array', () => { - expect(isArray('array')).toBeFalsy(); -}); diff --git a/test/isArrayBuffer/isArrayBuffer.js b/test/isArrayBuffer/isArrayBuffer.js deleted file mode 100644 index bc888208e..000000000 --- a/test/isArrayBuffer/isArrayBuffer.js +++ /dev/null @@ -1,2 +0,0 @@ -const isArrayBuffer = val => val instanceof ArrayBuffer; -module.exports = isArrayBuffer; diff --git a/test/isArrayBuffer/isArrayBuffer.test.js b/test/isArrayBuffer/isArrayBuffer.test.js deleted file mode 100644 index fb65e81de..000000000 --- a/test/isArrayBuffer/isArrayBuffer.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const expect = require('expect'); -const isArrayBuffer = require('./isArrayBuffer.js'); - -test('isArrayBuffer is a Function', () => { - expect(isArrayBuffer).toBeInstanceOf(Function); -}); diff --git a/test/isArrayLike/isArrayLike.test.js b/test/isArrayLike.test.js similarity index 88% rename from test/isArrayLike/isArrayLike.test.js rename to test/isArrayLike.test.js index b1ffb49d1..04ffc5eda 100644 --- a/test/isArrayLike/isArrayLike.test.js +++ b/test/isArrayLike.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isArrayLike = require('./isArrayLike.js'); +const {isArrayLike} = require('./_30s.js'); test('isArrayLike is a Function', () => { expect(isArrayLike).toBeInstanceOf(Function); diff --git a/test/isArrayLike/isArrayLike.js b/test/isArrayLike/isArrayLike.js deleted file mode 100644 index 144b181d0..000000000 --- a/test/isArrayLike/isArrayLike.js +++ /dev/null @@ -1,2 +0,0 @@ -const isArrayLike = obj => obj != null && typeof obj[Symbol.iterator] === 'function'; -module.exports = isArrayLike; diff --git a/test/isBeforeDate/isBeforeDate.test.js b/test/isBeforeDate.test.js similarity index 89% rename from test/isBeforeDate/isBeforeDate.test.js rename to test/isBeforeDate.test.js index 5656970c1..e3ecb1403 100644 --- a/test/isBeforeDate/isBeforeDate.test.js +++ b/test/isBeforeDate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isBeforeDate = require('./isBeforeDate.js'); +const {isBeforeDate} = require('./_30s.js'); test('isBeforeDate is a Function', () => { expect(isBeforeDate).toBeInstanceOf(Function); diff --git a/test/isBeforeDate/isBeforeDate.js b/test/isBeforeDate/isBeforeDate.js deleted file mode 100644 index cd6207544..000000000 --- a/test/isBeforeDate/isBeforeDate.js +++ /dev/null @@ -1,2 +0,0 @@ -const isBeforeDate = (dateA, dateB) => dateA < dateB; -module.exports = isBeforeDate; diff --git a/test/isBoolean/isBoolean.test.js b/test/isBoolean.test.js similarity index 87% rename from test/isBoolean/isBoolean.test.js rename to test/isBoolean.test.js index 31074f1f4..ee527f7ca 100644 --- a/test/isBoolean/isBoolean.test.js +++ b/test/isBoolean.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isBoolean = require('./isBoolean.js'); +const {isBoolean} = require('./_30s.js'); test('isBoolean is a Function', () => { expect(isBoolean).toBeInstanceOf(Function); diff --git a/test/isBoolean/isBoolean.js b/test/isBoolean/isBoolean.js deleted file mode 100644 index 52698bff3..000000000 --- a/test/isBoolean/isBoolean.js +++ /dev/null @@ -1,2 +0,0 @@ -const isBoolean = val => typeof val === 'boolean'; -module.exports = isBoolean; diff --git a/test/isBrowser/isBrowser.test.js b/test/isBrowser.test.js similarity index 73% rename from test/isBrowser/isBrowser.test.js rename to test/isBrowser.test.js index a6c32ee74..359dfd8d8 100644 --- a/test/isBrowser/isBrowser.test.js +++ b/test/isBrowser.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isBrowser = require('./isBrowser.js'); +const {isBrowser} = require('./_30s.js'); test('isBrowser is a Function', () => { expect(isBrowser).toBeInstanceOf(Function); diff --git a/test/isBrowser/isBrowser.js b/test/isBrowser/isBrowser.js deleted file mode 100644 index 26d288f10..000000000 --- a/test/isBrowser/isBrowser.js +++ /dev/null @@ -1,2 +0,0 @@ -const isBrowser = () => ![typeof window, typeof document].includes('undefined'); -module.exports = isBrowser; diff --git a/test/isBrowserTabFocused/isBrowserTabFocused.test.js b/test/isBrowserTabFocused.test.js similarity index 69% rename from test/isBrowserTabFocused/isBrowserTabFocused.test.js rename to test/isBrowserTabFocused.test.js index 780a52095..1d3bf771d 100644 --- a/test/isBrowserTabFocused/isBrowserTabFocused.test.js +++ b/test/isBrowserTabFocused.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isBrowserTabFocused = require('./isBrowserTabFocused.js'); +const {isBrowserTabFocused} = require('./_30s.js'); test('isBrowserTabFocused is a Function', () => { expect(isBrowserTabFocused).toBeInstanceOf(Function); diff --git a/test/isBrowserTabFocused/isBrowserTabFocused.js b/test/isBrowserTabFocused/isBrowserTabFocused.js deleted file mode 100644 index f70930c29..000000000 --- a/test/isBrowserTabFocused/isBrowserTabFocused.js +++ /dev/null @@ -1,2 +0,0 @@ -const isBrowserTabFocused = () => !document.hidden; -module.exports = isBrowserTabFocused; diff --git a/test/isDivisible/isDivisible.test.js b/test/isDivisible.test.js similarity index 81% rename from test/isDivisible/isDivisible.test.js rename to test/isDivisible.test.js index e6a41305a..5a1ccd035 100644 --- a/test/isDivisible/isDivisible.test.js +++ b/test/isDivisible.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isDivisible = require('./isDivisible.js'); +const {isDivisible} = require('./_30s.js'); test('isDivisible is a Function', () => { expect(isDivisible).toBeInstanceOf(Function); diff --git a/test/isDivisible/isDivisible.js b/test/isDivisible/isDivisible.js deleted file mode 100644 index de112a3cc..000000000 --- a/test/isDivisible/isDivisible.js +++ /dev/null @@ -1,2 +0,0 @@ -const isDivisible = (dividend, divisor) => dividend % divisor === 0; -module.exports = isDivisible; diff --git a/test/isDuplexStream/isDuplexStream.test.js b/test/isDuplexStream.test.js similarity index 52% rename from test/isDuplexStream/isDuplexStream.test.js rename to test/isDuplexStream.test.js index 6ff332242..a037f401b 100644 --- a/test/isDuplexStream/isDuplexStream.test.js +++ b/test/isDuplexStream.test.js @@ -1,16 +1,15 @@ const expect = require('expect'); -const isDuplexStream = require('./isDuplexStream.js'); -const fs = require('fs'); +const {isDuplexStream} = require('./_30s.js'); const Stream = require('stream'); test('isDuplexStream is a Function', () => { expect(isDuplexStream).toBeInstanceOf(Function); }); -test('isDuplexStream returns true for read streams', () => { - expect(isDuplexStream(fs.createReadStream('isDuplexStream.js'))).toBeTruthy(); +test('isDuplexStream returns false for read streams', () => { + expect(isDuplexStream(new Stream.Readable())).toBeFalsy(); }); -test('isDuplexStream returns true for write streams', () => { - expect(isDuplexStream(fs.createWriteStream('isDuplexStream.js'))).toBeTruthy(); +test('isDuplexStream returns false for write streams', () => { + expect(isDuplexStream(new Stream.Writable())).toBeFalsy(); }); test('isDuplexStream returns true for duplex streams', () => { expect(isDuplexStream(new Stream.Duplex())).toBeTruthy(); diff --git a/test/isDuplexStream/isDuplexStream.js b/test/isDuplexStream/isDuplexStream.js deleted file mode 100644 index c39653e73..000000000 --- a/test/isDuplexStream/isDuplexStream.js +++ /dev/null @@ -1,9 +0,0 @@ -const isDuplexStream = val => - val !== null && - typeof val === 'object' && - typeof val.pipe === 'function' && - typeof val._read === 'function' && - typeof val._readableState === 'object' && - typeof val._write === 'function' && - typeof val._writableState === 'object'; -module.exports = isDuplexStream; diff --git a/test/isEmpty/isEmpty.test.js b/test/isEmpty.test.js similarity index 96% rename from test/isEmpty/isEmpty.test.js rename to test/isEmpty.test.js index da27a5581..cbb3078e3 100644 --- a/test/isEmpty/isEmpty.test.js +++ b/test/isEmpty.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isEmpty = require('./isEmpty.js'); +const {isEmpty} = require('./_30s.js'); test('isEmpty is a Function', () => { expect(isEmpty).toBeInstanceOf(Function); diff --git a/test/isEmpty/isEmpty.js b/test/isEmpty/isEmpty.js deleted file mode 100644 index 20738e4f2..000000000 --- a/test/isEmpty/isEmpty.js +++ /dev/null @@ -1,2 +0,0 @@ -const isEmpty = val => val == null || !(Object.keys(val) || val).length; -module.exports = isEmpty; diff --git a/test/isEven/isEven.test.js b/test/isEven.test.js similarity index 87% rename from test/isEven/isEven.test.js rename to test/isEven.test.js index 906f42b7b..6c9281460 100644 --- a/test/isEven/isEven.test.js +++ b/test/isEven.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isEven = require('./isEven.js'); +const {isEven} = require('./_30s.js'); test('isEven is a Function', () => { expect(isEven).toBeInstanceOf(Function); diff --git a/test/isEven/isEven.js b/test/isEven/isEven.js deleted file mode 100644 index d5eda889b..000000000 --- a/test/isEven/isEven.js +++ /dev/null @@ -1,2 +0,0 @@ -const isEven = num => num % 2 === 0; -module.exports = isEven; diff --git a/test/isFunction/isFunction.test.js b/test/isFunction.test.js similarity index 86% rename from test/isFunction/isFunction.test.js rename to test/isFunction.test.js index da7c3325a..36c70b88b 100644 --- a/test/isFunction/isFunction.test.js +++ b/test/isFunction.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isFunction = require('./isFunction.js'); +const {isFunction} = require('./_30s.js'); test('isFunction is a Function', () => { expect(isFunction).toBeInstanceOf(Function); diff --git a/test/isFunction/isFunction.js b/test/isFunction/isFunction.js deleted file mode 100644 index 29123f19f..000000000 --- a/test/isFunction/isFunction.js +++ /dev/null @@ -1,2 +0,0 @@ -const isFunction = val => typeof val === 'function'; -module.exports = isFunction; diff --git a/test/isLowerCase/isLowerCase.test.js b/test/isLowerCase.test.js similarity index 89% rename from test/isLowerCase/isLowerCase.test.js rename to test/isLowerCase.test.js index 9c6542476..fc38a7763 100644 --- a/test/isLowerCase/isLowerCase.test.js +++ b/test/isLowerCase.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isLowerCase = require('./isLowerCase.js'); +const {isLowerCase} = require('./_30s.js'); test('isLowerCase is a Function', () => { expect(isLowerCase).toBeInstanceOf(Function); diff --git a/test/isLowerCase/isLowerCase.js b/test/isLowerCase/isLowerCase.js deleted file mode 100644 index a5184a193..000000000 --- a/test/isLowerCase/isLowerCase.js +++ /dev/null @@ -1,2 +0,0 @@ -const isLowerCase = str => str === str.toLowerCase(); -module.exports = isLowerCase; diff --git a/test/isMap/isMap.js b/test/isMap/isMap.js deleted file mode 100644 index 8dc9687b4..000000000 --- a/test/isMap/isMap.js +++ /dev/null @@ -1,2 +0,0 @@ -const isMap = val => val instanceof Map; -module.exports = isMap; diff --git a/test/isMap/isMap.test.js b/test/isMap/isMap.test.js deleted file mode 100644 index e6e434636..000000000 --- a/test/isMap/isMap.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const expect = require('expect'); -const isMap = require('./isMap.js'); - -test('isMap is a Function', () => { - expect(isMap).toBeInstanceOf(Function); -}); diff --git a/test/isNil/isNil.test.js b/test/isNil.test.js similarity index 90% rename from test/isNil/isNil.test.js rename to test/isNil.test.js index be77815a2..4fa531e49 100644 --- a/test/isNil/isNil.test.js +++ b/test/isNil.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isNil = require('./isNil.js'); +const {isNil} = require('./_30s.js'); test('isNil is a Function', () => { expect(isNil).toBeInstanceOf(Function); diff --git a/test/isNil/isNil.js b/test/isNil/isNil.js deleted file mode 100644 index 6ed72a7be..000000000 --- a/test/isNil/isNil.js +++ /dev/null @@ -1,2 +0,0 @@ -const isNil = val => val === undefined || val === null; -module.exports = isNil; diff --git a/test/isNull/isNull.test.js b/test/isNull.test.js similarity index 87% rename from test/isNull/isNull.test.js rename to test/isNull.test.js index fdf97d069..8cb1c9051 100644 --- a/test/isNull/isNull.test.js +++ b/test/isNull.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isNull = require('./isNull.js'); +const {isNull} = require('./_30s.js'); test('isNull is a Function', () => { expect(isNull).toBeInstanceOf(Function); diff --git a/test/isNull/isNull.js b/test/isNull/isNull.js deleted file mode 100644 index 5cfec0ee2..000000000 --- a/test/isNull/isNull.js +++ /dev/null @@ -1,2 +0,0 @@ -const isNull = val => val === null; -module.exports = isNull; diff --git a/test/isNumber/isNumber.test.js b/test/isNumber.test.js similarity index 87% rename from test/isNumber/isNumber.test.js rename to test/isNumber.test.js index 9b4872778..4f27fe9ca 100644 --- a/test/isNumber/isNumber.test.js +++ b/test/isNumber.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isNumber = require('./isNumber.js'); +const {isNumber} = require('./_30s.js'); test('isNumber is a Function', () => { expect(isNumber).toBeInstanceOf(Function); diff --git a/test/isNumber/isNumber.js b/test/isNumber/isNumber.js deleted file mode 100644 index cd76e2128..000000000 --- a/test/isNumber/isNumber.js +++ /dev/null @@ -1,2 +0,0 @@ -const isNumber = val => typeof val === 'number'; -module.exports = isNumber; diff --git a/test/isObject/isObject.test.js b/test/isObject.test.js similarity index 91% rename from test/isObject/isObject.test.js rename to test/isObject.test.js index e7f570feb..341e1f38f 100644 --- a/test/isObject/isObject.test.js +++ b/test/isObject.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isObject = require('./isObject.js'); +const {isObject} = require('./_30s.js'); test('isObject is a Function', () => { expect(isObject).toBeInstanceOf(Function); diff --git a/test/isObject/isObject.js b/test/isObject/isObject.js deleted file mode 100644 index 1eb389d52..000000000 --- a/test/isObject/isObject.js +++ /dev/null @@ -1,2 +0,0 @@ -const isObject = obj => obj === Object(obj); -module.exports = isObject; diff --git a/test/isObjectLike/isObjectLike.test.js b/test/isObjectLike.test.js similarity index 90% rename from test/isObjectLike/isObjectLike.test.js rename to test/isObjectLike.test.js index 410878d8e..dfa1dc0b2 100644 --- a/test/isObjectLike/isObjectLike.test.js +++ b/test/isObjectLike.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isObjectLike = require('./isObjectLike.js'); +const {isObjectLike} = require('./_30s.js'); test('isObjectLike is a Function', () => { expect(isObjectLike).toBeInstanceOf(Function); diff --git a/test/isObjectLike/isObjectLike.js b/test/isObjectLike/isObjectLike.js deleted file mode 100644 index 4bdf057d1..000000000 --- a/test/isObjectLike/isObjectLike.js +++ /dev/null @@ -1,2 +0,0 @@ -const isObjectLike = val => val !== null && typeof val === 'object'; -module.exports = isObjectLike; diff --git a/test/isPlainObject/isPlainObject.test.js b/test/isPlainObject.test.js similarity index 87% rename from test/isPlainObject/isPlainObject.test.js rename to test/isPlainObject.test.js index eda33dabc..8f79ece8b 100644 --- a/test/isPlainObject/isPlainObject.test.js +++ b/test/isPlainObject.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isPlainObject = require('./isPlainObject.js'); +const {isPlainObject} = require('./_30s.js'); test('isPlainObject is a Function', () => { expect(isPlainObject).toBeInstanceOf(Function); diff --git a/test/isPlainObject/isPlainObject.js b/test/isPlainObject/isPlainObject.js deleted file mode 100644 index 593560238..000000000 --- a/test/isPlainObject/isPlainObject.js +++ /dev/null @@ -1,2 +0,0 @@ -const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object; -module.exports = isPlainObject; diff --git a/test/isPrime/isPrime.test.js b/test/isPrime.test.js similarity index 83% rename from test/isPrime/isPrime.test.js rename to test/isPrime.test.js index f6776f687..2e967fce3 100644 --- a/test/isPrime/isPrime.test.js +++ b/test/isPrime.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isPrime = require('./isPrime.js'); +const {isPrime} = require('./_30s.js'); test('isPrime is a Function', () => { expect(isPrime).toBeInstanceOf(Function); diff --git a/test/isPrime/isPrime.js b/test/isPrime/isPrime.js deleted file mode 100644 index 9613c2f63..000000000 --- a/test/isPrime/isPrime.js +++ /dev/null @@ -1,6 +0,0 @@ -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; -}; -module.exports = isPrime; diff --git a/test/isPrimitive/isPrimitive.test.js b/test/isPrimitive.test.js similarity index 96% rename from test/isPrimitive/isPrimitive.test.js rename to test/isPrimitive.test.js index 2d5179475..325e0d122 100644 --- a/test/isPrimitive/isPrimitive.test.js +++ b/test/isPrimitive.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isPrimitive = require('./isPrimitive.js'); +const {isPrimitive} = require('./_30s.js'); test('isPrimitive is a Function', () => { expect(isPrimitive).toBeInstanceOf(Function); diff --git a/test/isPrimitive/isPrimitive.js b/test/isPrimitive/isPrimitive.js deleted file mode 100644 index 89d7cc577..000000000 --- a/test/isPrimitive/isPrimitive.js +++ /dev/null @@ -1,2 +0,0 @@ -const isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null; -module.exports = isPrimitive; diff --git a/test/isPromiseLike/isPromiseLike.test.js b/test/isPromiseLike.test.js similarity index 88% rename from test/isPromiseLike/isPromiseLike.test.js rename to test/isPromiseLike.test.js index 7c3a17c28..eabc7fb80 100644 --- a/test/isPromiseLike/isPromiseLike.test.js +++ b/test/isPromiseLike.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isPromiseLike = require('./isPromiseLike.js'); +const {isPromiseLike} = require('./_30s.js'); test('isPromiseLike is a Function', () => { expect(isPromiseLike).toBeInstanceOf(Function); diff --git a/test/isPromiseLike/isPromiseLike.js b/test/isPromiseLike/isPromiseLike.js deleted file mode 100644 index b26b21400..000000000 --- a/test/isPromiseLike/isPromiseLike.js +++ /dev/null @@ -1,5 +0,0 @@ -const isPromiseLike = obj => - obj !== null && - (typeof obj === 'object' || typeof obj === 'function') && - typeof obj.then === 'function'; -module.exports = isPromiseLike; diff --git a/test/isReadableStream/isReadableStream.test.js b/test/isReadableStream.test.js similarity index 68% rename from test/isReadableStream/isReadableStream.test.js rename to test/isReadableStream.test.js index 7c5174d99..e8f5905e1 100644 --- a/test/isReadableStream/isReadableStream.test.js +++ b/test/isReadableStream.test.js @@ -1,16 +1,15 @@ const expect = require('expect'); -const isReadableStream = require('./isReadableStream.js'); -const fs = require('fs'); +const { isReadableStream } = require('./_30s.js'); const Stream = require('stream'); test('isReadableStream is a Function', () => { expect(isReadableStream).toBeInstanceOf(Function); }); test('isReadableStream returns true for read streams', () => { - expect(isReadableStream(fs.createReadStream('isReadableStream.js'))).toBeTruthy(); + expect(isReadableStream(new Stream.Readable())).toBeTruthy(); }); test('isReadableStream returns false for write streams', () => { - expect(isReadableStream(fs.createWriteStream('isReadableStream.js'))).toBeFalsy(); + expect(isReadableStream(new Stream.Writable())).toBeFalsy(); }); test('isReadableStream returns true for duplex streams', () => { expect(isReadableStream(new Stream.Duplex())).toBeTruthy(); diff --git a/test/isReadableStream/isReadableStream.js b/test/isReadableStream/isReadableStream.js deleted file mode 100644 index a514cc8d2..000000000 --- a/test/isReadableStream/isReadableStream.js +++ /dev/null @@ -1,7 +0,0 @@ -const isReadableStream = val => - val !== null && - typeof val === 'object' && - typeof val.pipe === 'function' && - typeof val._read === 'function' && - typeof val._readableState === 'object'; -module.exports = isReadableStream; diff --git a/test/isRegExp/isRegExp.js b/test/isRegExp/isRegExp.js deleted file mode 100644 index bae7a3135..000000000 --- a/test/isRegExp/isRegExp.js +++ /dev/null @@ -1,2 +0,0 @@ -const isRegExp = val => val instanceof RegExp; -module.exports = isRegExp; diff --git a/test/isRegExp/isRegExp.test.js b/test/isRegExp/isRegExp.test.js deleted file mode 100644 index ec565713f..000000000 --- a/test/isRegExp/isRegExp.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const expect = require('expect'); -const isRegExp = require('./isRegExp.js'); - -test('isRegExp is a Function', () => { - expect(isRegExp).toBeInstanceOf(Function); -}); diff --git a/test/isSameDate/isSameDate.test.js b/test/isSameDate.test.js similarity index 89% rename from test/isSameDate/isSameDate.test.js rename to test/isSameDate.test.js index 2b6e8cbd4..3467bf5b1 100644 --- a/test/isSameDate/isSameDate.test.js +++ b/test/isSameDate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isSameDate = require('./isSameDate.js'); +const {isSameDate} = require('./_30s.js'); test('isSameDate is a Function', () => { expect(isSameDate).toBeInstanceOf(Function); diff --git a/test/isSameDate/isSameDate.js b/test/isSameDate/isSameDate.js deleted file mode 100644 index 3bd6f2218..000000000 --- a/test/isSameDate/isSameDate.js +++ /dev/null @@ -1,2 +0,0 @@ -const isSameDate = (dateA, dateB) => dateA.toISOString() === dateB.toISOString(); -module.exports = isSameDate; diff --git a/test/isSet/isSet.js b/test/isSet/isSet.js deleted file mode 100644 index d2a3b00cb..000000000 --- a/test/isSet/isSet.js +++ /dev/null @@ -1,2 +0,0 @@ -const isSet = val => val instanceof Set; -module.exports = isSet; diff --git a/test/isSet/isSet.test.js b/test/isSet/isSet.test.js deleted file mode 100644 index 559889443..000000000 --- a/test/isSet/isSet.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const expect = require('expect'); -const isSet = require('./isSet.js'); - -test('isSet is a Function', () => { - expect(isSet).toBeInstanceOf(Function); -}); diff --git a/test/isSimilar/isSimilar.test.js b/test/isSimilar.test.js similarity index 73% rename from test/isSimilar/isSimilar.test.js rename to test/isSimilar.test.js index 0a632774e..0032f39d4 100644 --- a/test/isSimilar/isSimilar.test.js +++ b/test/isSimilar.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isSimilar = require('./isSimilar.js'); +const {isSimilar} = require('./_30s.js'); test('isSimilar is a Function', () => { expect(isSimilar).toBeInstanceOf(Function); diff --git a/test/isSimilar/isSimilar.js b/test/isSimilar/isSimilar.js deleted file mode 100644 index 9fbeb204c..000000000 --- a/test/isSimilar/isSimilar.js +++ /dev/null @@ -1,9 +0,0 @@ -const isSimilar = (pattern, str) => - [...str].reduce( - (matchIndex, char) => - char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() - ? matchIndex + 1 - : matchIndex, - 0 - ) === pattern.length; -module.exports = isSimilar; diff --git a/test/isSorted/isSorted.test.js b/test/isSorted.test.js similarity index 96% rename from test/isSorted/isSorted.test.js rename to test/isSorted.test.js index d1d9fcfd9..c5268ba02 100644 --- a/test/isSorted/isSorted.test.js +++ b/test/isSorted.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isSorted = require('./isSorted.js'); +const {isSorted} = require('./_30s.js'); test('isSorted is a Function', () => { expect(isSorted).toBeInstanceOf(Function); diff --git a/test/isSorted/isSorted.js b/test/isSorted/isSorted.js deleted file mode 100644 index 8250ab454..000000000 --- a/test/isSorted/isSorted.js +++ /dev/null @@ -1,9 +0,0 @@ -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; - } -}; -module.exports = isSorted; diff --git a/test/isStream/isStream.test.js b/test/isStream.test.js similarity index 70% rename from test/isStream/isStream.test.js rename to test/isStream.test.js index 3d0f18e56..2c535933c 100644 --- a/test/isStream/isStream.test.js +++ b/test/isStream.test.js @@ -1,16 +1,15 @@ const expect = require('expect'); -const isStream = require('./isStream.js'); -const fs = require('fs'); +const { isStream } = require('./_30s.js'); const Stream = require('stream'); test('isStream is a Function', () => { expect(isStream).toBeInstanceOf(Function); }); test('isStream returns true for read streams', () => { - expect(isStream(fs.createReadStream('isStream.js'))).toBeTruthy(); + expect(isStream(new Stream.Readable())).toBeTruthy(); }); test('isStream returns true for write streams', () => { - expect(isStream(fs.createWriteStream('isStream.js'))).toBeTruthy(); + expect(isStream(new Stream.Writable())).toBeTruthy(); }); test('isStream returns true for duplex streams', () => { expect(isStream(new Stream.Duplex())).toBeTruthy(); diff --git a/test/isStream/isStream.js b/test/isStream/isStream.js deleted file mode 100644 index cbdd9bd61..000000000 --- a/test/isStream/isStream.js +++ /dev/null @@ -1,2 +0,0 @@ -const isStream = val => val !== null && typeof val === 'object' && typeof val.pipe === 'function'; -module.exports = isStream; diff --git a/test/isString/isString.test.js b/test/isString.test.js similarity index 92% rename from test/isString/isString.test.js rename to test/isString.test.js index d3021b275..a1ba6bbdf 100644 --- a/test/isString/isString.test.js +++ b/test/isString.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isString = require('./isString.js'); +const {isString} = require('./_30s.js'); test('isString is a Function', () => { expect(isString).toBeInstanceOf(Function); diff --git a/test/isString/isString.js b/test/isString/isString.js deleted file mode 100644 index 6f644887f..000000000 --- a/test/isString/isString.js +++ /dev/null @@ -1,2 +0,0 @@ -const isString = val => typeof val === 'string'; -module.exports = isString; diff --git a/test/isSymbol/isSymbol.test.js b/test/isSymbol.test.js similarity index 84% rename from test/isSymbol/isSymbol.test.js rename to test/isSymbol.test.js index 7b614771b..162291a08 100644 --- a/test/isSymbol/isSymbol.test.js +++ b/test/isSymbol.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isSymbol = require('./isSymbol.js'); +const {isSymbol} = require('./_30s.js'); test('isSymbol is a Function', () => { expect(isSymbol).toBeInstanceOf(Function); diff --git a/test/isSymbol/isSymbol.js b/test/isSymbol/isSymbol.js deleted file mode 100644 index 8a3ebf2dc..000000000 --- a/test/isSymbol/isSymbol.js +++ /dev/null @@ -1,2 +0,0 @@ -const isSymbol = val => typeof val === 'symbol'; -module.exports = isSymbol; diff --git a/test/isTravisCI/isTravisCI.test.js b/test/isTravisCI.test.js similarity index 88% rename from test/isTravisCI/isTravisCI.test.js rename to test/isTravisCI.test.js index 024b6869f..6489b57ea 100644 --- a/test/isTravisCI/isTravisCI.test.js +++ b/test/isTravisCI.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isTravisCI = require('./isTravisCI.js'); +const {isTravisCI} = require('./_30s.js'); test('isTravisCI is a Function', () => { expect(isTravisCI).toBeInstanceOf(Function); diff --git a/test/isTravisCI/isTravisCI.js b/test/isTravisCI/isTravisCI.js deleted file mode 100644 index 9f4a22de5..000000000 --- a/test/isTravisCI/isTravisCI.js +++ /dev/null @@ -1,2 +0,0 @@ -const isTravisCI = () => 'TRAVIS' in process.env && 'CI' in process.env; -module.exports = isTravisCI; diff --git a/test/isTypedArray/isTypedArray.js b/test/isTypedArray/isTypedArray.js deleted file mode 100644 index 45e44809c..000000000 --- a/test/isTypedArray/isTypedArray.js +++ /dev/null @@ -1,2 +0,0 @@ -const isTypedArray = val => val instanceof TypedArray; -module.exports = isTypedArray; diff --git a/test/isTypedArray/isTypedArray.test.js b/test/isTypedArray/isTypedArray.test.js deleted file mode 100644 index 4264f8835..000000000 --- a/test/isTypedArray/isTypedArray.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const expect = require('expect'); -const isTypedArray = require('./isTypedArray.js'); - -test('isTypedArray is a Function', () => { - expect(isTypedArray).toBeInstanceOf(Function); -}); diff --git a/test/isUndefined/isUndefined.test.js b/test/isUndefined.test.js similarity index 81% rename from test/isUndefined/isUndefined.test.js rename to test/isUndefined.test.js index 60a725190..447b197dd 100644 --- a/test/isUndefined/isUndefined.test.js +++ b/test/isUndefined.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isUndefined = require('./isUndefined.js'); +const {isUndefined} = require('./_30s.js'); test('isUndefined is a Function', () => { expect(isUndefined).toBeInstanceOf(Function); diff --git a/test/isUndefined/isUndefined.js b/test/isUndefined/isUndefined.js deleted file mode 100644 index e0d3d5cee..000000000 --- a/test/isUndefined/isUndefined.js +++ /dev/null @@ -1,2 +0,0 @@ -const isUndefined = val => val === undefined; -module.exports = isUndefined; diff --git a/test/isUpperCase/isUpperCase.test.js b/test/isUpperCase.test.js similarity index 88% rename from test/isUpperCase/isUpperCase.test.js rename to test/isUpperCase.test.js index 0c2aeffa0..3156f9eed 100644 --- a/test/isUpperCase/isUpperCase.test.js +++ b/test/isUpperCase.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isUpperCase = require('./isUpperCase.js'); +const {isUpperCase} = require('./_30s.js'); test('isUpperCase is a Function', () => { expect(isUpperCase).toBeInstanceOf(Function); diff --git a/test/isUpperCase/isUpperCase.js b/test/isUpperCase/isUpperCase.js deleted file mode 100644 index b235dc8d1..000000000 --- a/test/isUpperCase/isUpperCase.js +++ /dev/null @@ -1,2 +0,0 @@ -const isUpperCase = str => str === str.toUpperCase(); -module.exports = isUpperCase; diff --git a/test/isValidJSON/isValidJSON.test.js b/test/isValidJSON.test.js similarity index 90% rename from test/isValidJSON/isValidJSON.test.js rename to test/isValidJSON.test.js index 6426d77ab..e014b697c 100644 --- a/test/isValidJSON/isValidJSON.test.js +++ b/test/isValidJSON.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const isValidJSON = require('./isValidJSON.js'); +const {isValidJSON} = require('./_30s.js'); test('isValidJSON is a Function', () => { expect(isValidJSON).toBeInstanceOf(Function); diff --git a/test/isValidJSON/isValidJSON.js b/test/isValidJSON/isValidJSON.js deleted file mode 100644 index eeeb340e9..000000000 --- a/test/isValidJSON/isValidJSON.js +++ /dev/null @@ -1,9 +0,0 @@ -const isValidJSON = obj => { - try { - JSON.parse(obj); - return true; - } catch (e) { - return false; - } -}; -module.exports = isValidJSON; diff --git a/test/isWeakMap/isWeakMap.js b/test/isWeakMap/isWeakMap.js deleted file mode 100644 index b53b69f5a..000000000 --- a/test/isWeakMap/isWeakMap.js +++ /dev/null @@ -1,2 +0,0 @@ -const isWeakMap = val => val instanceof WeakMap; -module.exports = isWeakMap; diff --git a/test/isWeakMap/isWeakMap.test.js b/test/isWeakMap/isWeakMap.test.js deleted file mode 100644 index 6643677e9..000000000 --- a/test/isWeakMap/isWeakMap.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const expect = require('expect'); -const isWeakMap = require('./isWeakMap.js'); - -test('isWeakMap is a Function', () => { - expect(isWeakMap).toBeInstanceOf(Function); -}); diff --git a/test/isWeakSet/isWeakSet.js b/test/isWeakSet/isWeakSet.js deleted file mode 100644 index c3b55777b..000000000 --- a/test/isWeakSet/isWeakSet.js +++ /dev/null @@ -1,2 +0,0 @@ -const isWeakSet = val => val instanceof WeakSet; -module.exports = isWeakSet; diff --git a/test/isWeakSet/isWeakSet.test.js b/test/isWeakSet/isWeakSet.test.js deleted file mode 100644 index 2466138af..000000000 --- a/test/isWeakSet/isWeakSet.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const expect = require('expect'); -const isWeakSet = require('./isWeakSet.js'); - -test('isWeakSet is a Function', () => { - expect(isWeakSet).toBeInstanceOf(Function); -}); diff --git a/test/isWritableStream/isWritableStream.test.js b/test/isWritableStream.test.js similarity index 68% rename from test/isWritableStream/isWritableStream.test.js rename to test/isWritableStream.test.js index 4ad21eb23..a2ff52297 100644 --- a/test/isWritableStream/isWritableStream.test.js +++ b/test/isWritableStream.test.js @@ -1,16 +1,15 @@ const expect = require('expect'); -const isWritableStream = require('./isWritableStream.js'); -const fs = require('fs'); +const { isWritableStream } = require('./_30s.js'); const Stream = require('stream'); test('isWritableStream is a Function', () => { expect(isWritableStream).toBeInstanceOf(Function); }); test('isWritableStream returns false for read streams', () => { - expect(isWritableStream(fs.createReadStream('isWritableStream.js'))).toBeFalsy(); + expect(isWritableStream(new Stream.Readable())).toBeFalsy(); }); test('isWritableStream returns true for write streams', () => { - expect(isWritableStream(fs.createWriteStream('isWritableStream.js'))).toBeTruthy(); + expect(isWritableStream(new Stream.Writable())).toBeTruthy(); }); test('isWritableStream returns true for duplex streams', () => { expect(isWritableStream(new Stream.Duplex())).toBeTruthy(); diff --git a/test/isWritableStream/isWritableStream.js b/test/isWritableStream/isWritableStream.js deleted file mode 100644 index a9679cc3d..000000000 --- a/test/isWritableStream/isWritableStream.js +++ /dev/null @@ -1,7 +0,0 @@ -const isWritableStream = val => - val !== null && - typeof val === 'object' && - typeof val.pipe === 'function' && - typeof val._write === 'function' && - typeof val._writableState === 'object'; -module.exports = isWritableStream; diff --git a/test/join/join.test.js b/test/join.test.js similarity index 94% rename from test/join/join.test.js rename to test/join.test.js index cb5209563..f8c25a300 100644 --- a/test/join/join.test.js +++ b/test/join.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const join = require('./join.js'); +const {join} = require('./_30s.js'); test('join is a Function', () => { expect(join).toBeInstanceOf(Function); diff --git a/test/join/join.js b/test/join/join.js deleted file mode 100644 index 15d0dd96e..000000000 --- a/test/join/join.js +++ /dev/null @@ -1,11 +0,0 @@ -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, - '' - ); -module.exports = join; diff --git a/test/last/last.test.js b/test/last.test.js similarity index 96% rename from test/last/last.test.js rename to test/last.test.js index e86f71ecd..fefc62b16 100644 --- a/test/last/last.test.js +++ b/test/last.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const last = require('./last.js'); +const {last} = require('./_30s.js'); test('last is a Function', () => { expect(last).toBeInstanceOf(Function); diff --git a/test/last/last.js b/test/last/last.js deleted file mode 100644 index 1e1d8a756..000000000 --- a/test/last/last.js +++ /dev/null @@ -1,2 +0,0 @@ -const last = arr => arr[arr.length - 1]; -module.exports = last; diff --git a/test/lcm/lcm.test.js b/test/lcm.test.js similarity index 90% rename from test/lcm/lcm.test.js rename to test/lcm.test.js index dfa340b88..70fcf8230 100644 --- a/test/lcm/lcm.test.js +++ b/test/lcm.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const lcm = require('./lcm.js'); +const {lcm} = require('./_30s.js'); test('lcm is a Function', () => { expect(lcm).toBeInstanceOf(Function); diff --git a/test/lcm/lcm.js b/test/lcm/lcm.js deleted file mode 100644 index a4d8b1032..000000000 --- a/test/lcm/lcm.js +++ /dev/null @@ -1,6 +0,0 @@ -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)); -}; -module.exports = lcm; diff --git a/test/levenshteinDistance/levenshteinDistance.test.js b/test/levenshteinDistance.test.js similarity index 69% rename from test/levenshteinDistance/levenshteinDistance.test.js rename to test/levenshteinDistance.test.js index c5556114d..8a8c5920b 100644 --- a/test/levenshteinDistance/levenshteinDistance.test.js +++ b/test/levenshteinDistance.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const levenshteinDistance = require('./levenshteinDistance.js'); +const {levenshteinDistance} = require('./_30s.js'); test('levenshteinDistance is a Function', () => { expect(levenshteinDistance).toBeInstanceOf(Function); diff --git a/test/levenshteinDistance/levenshteinDistance.js b/test/levenshteinDistance/levenshteinDistance.js deleted file mode 100644 index d9a76b41d..000000000 --- a/test/levenshteinDistance/levenshteinDistance.js +++ /dev/null @@ -1,25 +0,0 @@ -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]; -}; -module.exports = levenshteinDistance; diff --git a/test/longestItem/longestItem.test.js b/test/longestItem.test.js similarity index 95% rename from test/longestItem/longestItem.test.js rename to test/longestItem.test.js index c4315215d..b0a6fc999 100644 --- a/test/longestItem/longestItem.test.js +++ b/test/longestItem.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const longestItem = require('./longestItem.js'); +const {longestItem} = require('./_30s.js'); test('longestItem is a Function', () => { expect(longestItem).toBeInstanceOf(Function); diff --git a/test/longestItem/longestItem.js b/test/longestItem/longestItem.js deleted file mode 100644 index 3bfe6d8d3..000000000 --- a/test/longestItem/longestItem.js +++ /dev/null @@ -1,3 +0,0 @@ -const longestItem = (val, ...vals) => - [val, ...vals].reduce((a, x) => (x.length > a.length ? x : a)); -module.exports = longestItem; diff --git a/test/lowercaseKeys/lowercaseKeys.test.js b/test/lowercaseKeys.test.js similarity index 89% rename from test/lowercaseKeys/lowercaseKeys.test.js rename to test/lowercaseKeys.test.js index 8fee98446..ec991a352 100644 --- a/test/lowercaseKeys/lowercaseKeys.test.js +++ b/test/lowercaseKeys.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const lowercaseKeys = require('./lowercaseKeys.js'); +const {lowercaseKeys} = require('./_30s.js'); test('lowercaseKeys is a Function', () => { expect(lowercaseKeys).toBeInstanceOf(Function); diff --git a/test/lowercaseKeys/lowercaseKeys.js b/test/lowercaseKeys/lowercaseKeys.js deleted file mode 100644 index 235a0d5d8..000000000 --- a/test/lowercaseKeys/lowercaseKeys.js +++ /dev/null @@ -1,6 +0,0 @@ -const lowercaseKeys = obj => - Object.keys(obj).reduce((acc, key) => { - acc[key.toLowerCase()] = obj[key]; - return acc; - }, {}); -module.exports = lowercaseKeys; diff --git a/test/luhnCheck/luhnCheck.test.js b/test/luhnCheck.test.js similarity index 90% rename from test/luhnCheck/luhnCheck.test.js rename to test/luhnCheck.test.js index 28d176fe5..75e4a0daf 100644 --- a/test/luhnCheck/luhnCheck.test.js +++ b/test/luhnCheck.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const luhnCheck = require('./luhnCheck.js'); +const {luhnCheck} = require('./_30s.js'); test('luhnCheck is a Function', () => { expect(luhnCheck).toBeInstanceOf(Function); diff --git a/test/luhnCheck/luhnCheck.js b/test/luhnCheck/luhnCheck.js deleted file mode 100644 index d666a021a..000000000 --- a/test/luhnCheck/luhnCheck.js +++ /dev/null @@ -1,11 +0,0 @@ -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; -}; -module.exports = luhnCheck; diff --git a/test/mapKeys/mapKeys.test.js b/test/mapKeys.test.js similarity index 85% rename from test/mapKeys/mapKeys.test.js rename to test/mapKeys.test.js index 076f1fabe..aa3136f13 100644 --- a/test/mapKeys/mapKeys.test.js +++ b/test/mapKeys.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const mapKeys = require('./mapKeys.js'); +const {mapKeys} = require('./_30s.js'); test('mapKeys is a Function', () => { expect(mapKeys).toBeInstanceOf(Function); diff --git a/test/mapKeys/mapKeys.js b/test/mapKeys/mapKeys.js deleted file mode 100644 index fcafd2ff4..000000000 --- a/test/mapKeys/mapKeys.js +++ /dev/null @@ -1,6 +0,0 @@ -const mapKeys = (obj, fn) => - Object.keys(obj).reduce((acc, k) => { - acc[fn(obj[k], k, obj)] = obj[k]; - return acc; - }, {}); -module.exports = mapKeys; diff --git a/test/mapObject/mapObject.test.js b/test/mapObject.test.js similarity index 93% rename from test/mapObject/mapObject.test.js rename to test/mapObject.test.js index 86d5cf698..c9ffa673b 100644 --- a/test/mapObject/mapObject.test.js +++ b/test/mapObject.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const mapObject = require('./mapObject.js'); +const {mapObject} = require('./_30s.js'); test('mapObject is a Function', () => { expect(mapObject).toBeInstanceOf(Function); diff --git a/test/mapObject/mapObject.js b/test/mapObject/mapObject.js deleted file mode 100644 index 84710c299..000000000 --- a/test/mapObject/mapObject.js +++ /dev/null @@ -1,5 +0,0 @@ -const mapObject = (arr, fn) => - (a => ( - (a = [arr, arr.map(fn)]), a[0].reduce((acc, val, ind) => ((acc[val] = a[1][ind]), acc), {}) - ))(); -module.exports = mapObject; diff --git a/test/mapString/mapString.test.js b/test/mapString.test.js similarity index 93% rename from test/mapString/mapString.test.js rename to test/mapString.test.js index 9e400d095..a30444fbf 100644 --- a/test/mapString/mapString.test.js +++ b/test/mapString.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const mapString = require('./mapString.js'); +const {mapString} = require('./_30s.js'); test('mapString is a Function', () => { expect(mapString).toBeInstanceOf(Function); diff --git a/test/mapString/mapString.js b/test/mapString/mapString.js deleted file mode 100644 index b186c81ff..000000000 --- a/test/mapString/mapString.js +++ /dev/null @@ -1,6 +0,0 @@ -const mapString = (str, fn) => - str - .split('') - .map((c, i) => fn(c, i, str)) - .join(''); -module.exports = mapString; diff --git a/test/mapValues/mapValues.test.js b/test/mapValues.test.js similarity index 87% rename from test/mapValues/mapValues.test.js rename to test/mapValues.test.js index 24273703c..5b92ae3fd 100644 --- a/test/mapValues/mapValues.test.js +++ b/test/mapValues.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const mapValues = require('./mapValues.js'); +const {mapValues} = require('./_30s.js'); test('mapValues is a Function', () => { expect(mapValues).toBeInstanceOf(Function); diff --git a/test/mapValues/mapValues.js b/test/mapValues/mapValues.js deleted file mode 100644 index b278d0d15..000000000 --- a/test/mapValues/mapValues.js +++ /dev/null @@ -1,6 +0,0 @@ -const mapValues = (obj, fn) => - Object.keys(obj).reduce((acc, k) => { - acc[k] = fn(obj[k], k, obj); - return acc; - }, {}); -module.exports = mapValues; diff --git a/test/mask/mask.test.js b/test/mask.test.js similarity index 93% rename from test/mask/mask.test.js rename to test/mask.test.js index 11c8e4cb5..1080c0ee8 100644 --- a/test/mask/mask.test.js +++ b/test/mask.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const mask = require('./mask.js'); +const {mask} = require('./_30s.js'); test('mask is a Function', () => { expect(mask).toBeInstanceOf(Function); diff --git a/test/mask/mask.js b/test/mask/mask.js deleted file mode 100644 index a268b3710..000000000 --- a/test/mask/mask.js +++ /dev/null @@ -1,2 +0,0 @@ -const mask = (cc, num = 4, mask = '*') => `${cc}`.slice(-num).padStart(`${cc}`.length, mask); -module.exports = mask; diff --git a/test/matches/matches.test.js b/test/matches.test.js similarity index 92% rename from test/matches/matches.test.js rename to test/matches.test.js index 58f07dd9c..2a406e274 100644 --- a/test/matches/matches.test.js +++ b/test/matches.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const matches = require('./matches.js'); +const {matches} = require('./_30s.js'); test('matches is a Function', () => { expect(matches).toBeInstanceOf(Function); diff --git a/test/matches/matches.js b/test/matches/matches.js deleted file mode 100644 index cc354fb57..000000000 --- a/test/matches/matches.js +++ /dev/null @@ -1,3 +0,0 @@ -const matches = (obj, source) => - Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); -module.exports = matches; diff --git a/test/matchesWith/matchesWith.test.js b/test/matchesWith.test.js similarity index 89% rename from test/matchesWith/matchesWith.test.js rename to test/matchesWith.test.js index 5627ae2af..ee1e6b1ea 100644 --- a/test/matchesWith/matchesWith.test.js +++ b/test/matchesWith.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const matchesWith = require('./matchesWith.js'); +const {matchesWith} = require('./_30s.js'); test('matchesWith is a Function', () => { expect(matchesWith).toBeInstanceOf(Function); diff --git a/test/matchesWith/matchesWith.js b/test/matchesWith/matchesWith.js deleted file mode 100644 index 9f3b5ee34..000000000 --- a/test/matchesWith/matchesWith.js +++ /dev/null @@ -1,8 +0,0 @@ -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] - ); -module.exports = matchesWith; diff --git a/test/maxBy/maxBy.test.js b/test/maxBy.test.js similarity index 91% rename from test/maxBy/maxBy.test.js rename to test/maxBy.test.js index 2cd581553..3b805dea6 100644 --- a/test/maxBy/maxBy.test.js +++ b/test/maxBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const maxBy = require('./maxBy.js'); +const {maxBy} = require('./_30s.js'); test('maxBy is a Function', () => { expect(maxBy).toBeInstanceOf(Function); diff --git a/test/maxBy/maxBy.js b/test/maxBy/maxBy.js deleted file mode 100644 index f549f0e80..000000000 --- a/test/maxBy/maxBy.js +++ /dev/null @@ -1,2 +0,0 @@ -const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); -module.exports = maxBy; diff --git a/test/maxDate/maxDate.test.js b/test/maxDate.test.js similarity index 89% rename from test/maxDate/maxDate.test.js rename to test/maxDate.test.js index e7d6ae60c..0bfcd0a1a 100644 --- a/test/maxDate/maxDate.test.js +++ b/test/maxDate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const maxDate = require('./maxDate.js'); +const {maxDate} = require('./_30s.js'); test('maxDate is a Function', () => { expect(maxDate).toBeInstanceOf(Function); diff --git a/test/maxDate/maxDate.js b/test/maxDate/maxDate.js deleted file mode 100644 index b2413c849..000000000 --- a/test/maxDate/maxDate.js +++ /dev/null @@ -1,2 +0,0 @@ -const maxDate = (...dates) => new Date(Math.max.apply(null, ...dates)); -module.exports = maxDate; diff --git a/test/maxN/maxN.test.js b/test/maxN.test.js similarity index 90% rename from test/maxN/maxN.test.js rename to test/maxN.test.js index dc100b2f7..6a866f8c4 100644 --- a/test/maxN/maxN.test.js +++ b/test/maxN.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const maxN = require('./maxN.js'); +const {maxN} = require('./_30s.js'); test('maxN is a Function', () => { expect(maxN).toBeInstanceOf(Function); diff --git a/test/maxN/maxN.js b/test/maxN/maxN.js deleted file mode 100644 index 7663fb20e..000000000 --- a/test/maxN/maxN.js +++ /dev/null @@ -1,2 +0,0 @@ -const maxN = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n); -module.exports = maxN; diff --git a/test/median/median.test.js b/test/median.test.js similarity index 89% rename from test/median/median.test.js rename to test/median.test.js index 76835c0b8..0a62f30c0 100644 --- a/test/median/median.test.js +++ b/test/median.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const median = require('./median.js'); +const {median} = require('./_30s.js'); test('median is a Function', () => { expect(median).toBeInstanceOf(Function); diff --git a/test/median/median.js b/test/median/median.js deleted file mode 100644 index 6c48900c3..000000000 --- a/test/median/median.js +++ /dev/null @@ -1,6 +0,0 @@ -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; -}; -module.exports = median; diff --git a/test/memoize/memoize.test.js b/test/memoize.test.js similarity index 91% rename from test/memoize/memoize.test.js rename to test/memoize.test.js index b288861d3..fd906727b 100644 --- a/test/memoize/memoize.test.js +++ b/test/memoize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const memoize = require('./memoize.js'); +const {memoize} = require('./_30s.js'); test('memoize is a Function', () => { expect(memoize).toBeInstanceOf(Function); diff --git a/test/memoize/memoize.js b/test/memoize/memoize.js deleted file mode 100644 index 53cb2d5eb..000000000 --- a/test/memoize/memoize.js +++ /dev/null @@ -1,9 +0,0 @@ -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; -}; -module.exports = memoize; diff --git a/test/merge/merge.test.js b/test/merge.test.js similarity index 91% rename from test/merge/merge.test.js rename to test/merge.test.js index 635966c14..035b3b722 100644 --- a/test/merge/merge.test.js +++ b/test/merge.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const merge = require('./merge.js'); +const {merge} = require('./_30s.js'); test('merge is a Function', () => { expect(merge).toBeInstanceOf(Function); diff --git a/test/merge/merge.js b/test/merge/merge.js deleted file mode 100644 index 91d1355c6..000000000 --- a/test/merge/merge.js +++ /dev/null @@ -1,10 +0,0 @@ -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; - }, {}), - {} - ); -module.exports = merge; diff --git a/test/minBy/minBy.test.js b/test/minBy.test.js similarity index 91% rename from test/minBy/minBy.test.js rename to test/minBy.test.js index 82a1beeed..2c4c4a641 100644 --- a/test/minBy/minBy.test.js +++ b/test/minBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const minBy = require('./minBy.js'); +const {minBy} = require('./_30s.js'); test('minBy is a Function', () => { expect(minBy).toBeInstanceOf(Function); diff --git a/test/minBy/minBy.js b/test/minBy/minBy.js deleted file mode 100644 index 7318d7901..000000000 --- a/test/minBy/minBy.js +++ /dev/null @@ -1,2 +0,0 @@ -const minBy = (arr, fn) => Math.min(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); -module.exports = minBy; diff --git a/test/minDate/minDate.test.js b/test/minDate.test.js similarity index 89% rename from test/minDate/minDate.test.js rename to test/minDate.test.js index 7156eb98b..21154eb7d 100644 --- a/test/minDate/minDate.test.js +++ b/test/minDate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const minDate = require('./minDate.js'); +const {minDate} = require('./_30s.js'); test('minDate is a Function', () => { expect(minDate).toBeInstanceOf(Function); diff --git a/test/minDate/minDate.js b/test/minDate/minDate.js deleted file mode 100644 index a740098ed..000000000 --- a/test/minDate/minDate.js +++ /dev/null @@ -1,2 +0,0 @@ -const minDate = (...dates) => new Date(Math.min.apply(null, ...dates)); -module.exports = minDate; diff --git a/test/minN/minN.test.js b/test/minN.test.js similarity index 90% rename from test/minN/minN.test.js rename to test/minN.test.js index ac8fc29a9..5721f0350 100644 --- a/test/minN/minN.test.js +++ b/test/minN.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const minN = require('./minN.js'); +const {minN} = require('./_30s.js'); test('minN is a Function', () => { expect(minN).toBeInstanceOf(Function); diff --git a/test/minN/minN.js b/test/minN/minN.js deleted file mode 100644 index fd0f0e95a..000000000 --- a/test/minN/minN.js +++ /dev/null @@ -1,2 +0,0 @@ -const minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n); -module.exports = minN; diff --git a/test/mostPerformant/mostPerformant.test.js b/test/mostPerformant.test.js similarity index 71% rename from test/mostPerformant/mostPerformant.test.js rename to test/mostPerformant.test.js index 877fcdfa8..28f2b46dd 100644 --- a/test/mostPerformant/mostPerformant.test.js +++ b/test/mostPerformant.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const mostPerformant = require('./mostPerformant.js'); +const {mostPerformant} = require('./_30s.js'); test('mostPerformant is a Function', () => { expect(mostPerformant).toBeInstanceOf(Function); diff --git a/test/mostPerformant/mostPerformant.js b/test/mostPerformant/mostPerformant.js deleted file mode 100644 index ffeb69cba..000000000 --- a/test/mostPerformant/mostPerformant.js +++ /dev/null @@ -1,9 +0,0 @@ -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)); -}; -module.exports = mostPerformant; diff --git a/test/negate/negate.test.js b/test/negate.test.js similarity index 86% rename from test/negate/negate.test.js rename to test/negate.test.js index 7dfd8b080..82fe26a3e 100644 --- a/test/negate/negate.test.js +++ b/test/negate.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const negate = require('./negate.js'); +const {negate} = require('./_30s.js'); test('negate is a Function', () => { expect(negate).toBeInstanceOf(Function); diff --git a/test/negate/negate.js b/test/negate/negate.js deleted file mode 100644 index cf8436528..000000000 --- a/test/negate/negate.js +++ /dev/null @@ -1,2 +0,0 @@ -const negate = func => (...args) => !func(...args); -module.exports = negate; diff --git a/test/nest/nest.test.js b/test/nest.test.js similarity index 75% rename from test/nest/nest.test.js rename to test/nest.test.js index 894a17001..c06b9f6bd 100644 --- a/test/nest/nest.test.js +++ b/test/nest.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const nest = require('./nest.js'); +const {nest} = require('./_30s.js'); test('nest is a Function', () => { expect(nest).toBeInstanceOf(Function); diff --git a/test/nest/nest.js b/test/nest/nest.js deleted file mode 100644 index 4585b8bda..000000000 --- a/test/nest/nest.js +++ /dev/null @@ -1,5 +0,0 @@ -const nest = (items, id = null, link = 'parent_id') => - items - .filter(item => item[link] === id) - .map(item => ({ ...item, children: nest(items, item.id) })); -module.exports = nest; diff --git a/test/nodeListToArray/nodeListToArray.test.js b/test/nodeListToArray.test.js similarity index 70% rename from test/nodeListToArray/nodeListToArray.test.js rename to test/nodeListToArray.test.js index 414565976..b775d168a 100644 --- a/test/nodeListToArray/nodeListToArray.test.js +++ b/test/nodeListToArray.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const nodeListToArray = require('./nodeListToArray.js'); +const {nodeListToArray} = require('./_30s.js'); test('nodeListToArray is a Function', () => { expect(nodeListToArray).toBeInstanceOf(Function); diff --git a/test/nodeListToArray/nodeListToArray.js b/test/nodeListToArray/nodeListToArray.js deleted file mode 100644 index 2fc92fad0..000000000 --- a/test/nodeListToArray/nodeListToArray.js +++ /dev/null @@ -1,2 +0,0 @@ -const nodeListToArray = nodeList => [...nodeList]; -module.exports = nodeListToArray; diff --git a/test/none/none.test.js b/test/none.test.js similarity index 93% rename from test/none/none.test.js rename to test/none.test.js index fcc6c904c..87b53f48b 100644 --- a/test/none/none.test.js +++ b/test/none.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const none = require('./none.js'); +const {none} = require('./_30s.js'); test('none is a Function', () => { expect(none).toBeInstanceOf(Function); diff --git a/test/none/none.js b/test/none/none.js deleted file mode 100644 index a36445848..000000000 --- a/test/none/none.js +++ /dev/null @@ -1,2 +0,0 @@ -const none = (arr, fn = Boolean) => !arr.some(fn); -module.exports = none; diff --git a/test/nthArg/nthArg.test.js b/test/nthArg.test.js similarity index 91% rename from test/nthArg/nthArg.test.js rename to test/nthArg.test.js index b5689e24a..68a24f923 100644 --- a/test/nthArg/nthArg.test.js +++ b/test/nthArg.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const nthArg = require('./nthArg.js'); +const {nthArg} = require('./_30s.js'); test('nthArg is a Function', () => { expect(nthArg).toBeInstanceOf(Function); diff --git a/test/nthArg/nthArg.js b/test/nthArg/nthArg.js deleted file mode 100644 index cf2497e04..000000000 --- a/test/nthArg/nthArg.js +++ /dev/null @@ -1,2 +0,0 @@ -const nthArg = n => (...args) => args.slice(n)[0]; -module.exports = nthArg; diff --git a/test/nthElement/nthElement.test.js b/test/nthElement.test.js similarity index 88% rename from test/nthElement/nthElement.test.js rename to test/nthElement.test.js index 774de6f78..f17937e0f 100644 --- a/test/nthElement/nthElement.test.js +++ b/test/nthElement.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const nthElement = require('./nthElement.js'); +const {nthElement} = require('./_30s.js'); test('nthElement is a Function', () => { expect(nthElement).toBeInstanceOf(Function); diff --git a/test/nthElement/nthElement.js b/test/nthElement/nthElement.js deleted file mode 100644 index c9c0ffe21..000000000 --- a/test/nthElement/nthElement.js +++ /dev/null @@ -1,2 +0,0 @@ -const nthElement = (arr, n = 0) => (n === -1 ? arr.slice(n) : arr.slice(n, n + 1))[0]; -module.exports = nthElement; diff --git a/test/objectFromPairs/objectFromPairs.test.js b/test/objectFromPairs.test.js similarity index 83% rename from test/objectFromPairs/objectFromPairs.test.js rename to test/objectFromPairs.test.js index fcb9e8c6a..58e55b50d 100644 --- a/test/objectFromPairs/objectFromPairs.test.js +++ b/test/objectFromPairs.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const objectFromPairs = require('./objectFromPairs.js'); +const {objectFromPairs} = require('./_30s.js'); test('objectFromPairs is a Function', () => { expect(objectFromPairs).toBeInstanceOf(Function); diff --git a/test/objectFromPairs/objectFromPairs.js b/test/objectFromPairs/objectFromPairs.js deleted file mode 100644 index 6d27ccf4f..000000000 --- a/test/objectFromPairs/objectFromPairs.js +++ /dev/null @@ -1,2 +0,0 @@ -const objectFromPairs = arr => arr.reduce((a, [key, val]) => ((a[key] = val), a), {}); -module.exports = objectFromPairs; diff --git a/test/objectToPairs/objectToPairs.test.js b/test/objectToPairs.test.js similarity index 84% rename from test/objectToPairs/objectToPairs.test.js rename to test/objectToPairs.test.js index da2dd0c5f..c49dd39db 100644 --- a/test/objectToPairs/objectToPairs.test.js +++ b/test/objectToPairs.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const objectToPairs = require('./objectToPairs.js'); +const {objectToPairs} = require('./_30s.js'); test('objectToPairs is a Function', () => { expect(objectToPairs).toBeInstanceOf(Function); diff --git a/test/objectToPairs/objectToPairs.js b/test/objectToPairs/objectToPairs.js deleted file mode 100644 index e17645c30..000000000 --- a/test/objectToPairs/objectToPairs.js +++ /dev/null @@ -1,2 +0,0 @@ -const objectToPairs = obj => Object.keys(obj).map(k => [k, obj[k]]); -module.exports = objectToPairs; diff --git a/test/observeMutations/observeMutations.test.js b/test/observeMutations.test.js similarity index 70% rename from test/observeMutations/observeMutations.test.js rename to test/observeMutations.test.js index 314cdf633..0eb713695 100644 --- a/test/observeMutations/observeMutations.test.js +++ b/test/observeMutations.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const observeMutations = require('./observeMutations.js'); +const {observeMutations} = require('./_30s.js'); test('observeMutations is a Function', () => { expect(observeMutations).toBeInstanceOf(Function); diff --git a/test/observeMutations/observeMutations.js b/test/observeMutations/observeMutations.js deleted file mode 100644 index fd2a7f31a..000000000 --- a/test/observeMutations/observeMutations.js +++ /dev/null @@ -1,19 +0,0 @@ -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; -}; -module.exports = observeMutations; diff --git a/test/off/off.test.js b/test/off.test.js similarity index 75% rename from test/off/off.test.js rename to test/off.test.js index 59b87132d..0da5e9d94 100644 --- a/test/off/off.test.js +++ b/test/off.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const off = require('./off.js'); +const {off} = require('./_30s.js'); test('off is a Function', () => { expect(off).toBeInstanceOf(Function); diff --git a/test/off/off.js b/test/off/off.js deleted file mode 100644 index fa1ae6ec3..000000000 --- a/test/off/off.js +++ /dev/null @@ -1,2 +0,0 @@ -const off = (el, evt, fn, opts = false) => el.removeEventListener(evt, fn, opts); -module.exports = off; diff --git a/test/offset/offset.test.js b/test/offset.test.js similarity index 95% rename from test/offset/offset.test.js rename to test/offset.test.js index 73ee2fe04..2d6cd932a 100644 --- a/test/offset/offset.test.js +++ b/test/offset.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const offset = require('./offset.js'); +const {offset} = require('./_30s.js'); test('offset is a Function', () => { expect(offset).toBeInstanceOf(Function); diff --git a/test/offset/offset.js b/test/offset/offset.js deleted file mode 100644 index c20b1fe4c..000000000 --- a/test/offset/offset.js +++ /dev/null @@ -1,2 +0,0 @@ -const offset = (arr, offset) => [...arr.slice(offset), ...arr.slice(0, offset)]; -module.exports = offset; diff --git a/test/omit/omit.test.js b/test/omit.test.js similarity index 88% rename from test/omit/omit.test.js rename to test/omit.test.js index 05200cff3..766037a7f 100644 --- a/test/omit/omit.test.js +++ b/test/omit.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const omit = require('./omit.js'); +const {omit} = require('./_30s.js'); test('omit is a Function', () => { expect(omit).toBeInstanceOf(Function); diff --git a/test/omit/omit.js b/test/omit/omit.js deleted file mode 100644 index e443a6ef3..000000000 --- a/test/omit/omit.js +++ /dev/null @@ -1,5 +0,0 @@ -const omit = (obj, arr) => - Object.keys(obj) - .filter(k => !arr.includes(k)) - .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); -module.exports = omit; diff --git a/test/omitBy/omitBy.test.js b/test/omitBy.test.js similarity index 88% rename from test/omitBy/omitBy.test.js rename to test/omitBy.test.js index 3d433f904..467606dfc 100644 --- a/test/omitBy/omitBy.test.js +++ b/test/omitBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const omitBy = require('./omitBy.js'); +const {omitBy} = require('./_30s.js'); test('omitBy is a Function', () => { expect(omitBy).toBeInstanceOf(Function); diff --git a/test/omitBy/omitBy.js b/test/omitBy/omitBy.js deleted file mode 100644 index 297c51593..000000000 --- a/test/omitBy/omitBy.js +++ /dev/null @@ -1,5 +0,0 @@ -const omitBy = (obj, fn) => - Object.keys(obj) - .filter(k => !fn(obj[k], k)) - .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); -module.exports = omitBy; diff --git a/test/on/on.test.js b/test/on.test.js similarity index 76% rename from test/on/on.test.js rename to test/on.test.js index 8c1912742..c757e9592 100644 --- a/test/on/on.test.js +++ b/test/on.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const on = require('./on.js'); +const {on} = require('./_30s.js'); test('on is a Function', () => { expect(on).toBeInstanceOf(Function); diff --git a/test/on/on.js b/test/on/on.js deleted file mode 100644 index 5797671c9..000000000 --- a/test/on/on.js +++ /dev/null @@ -1,6 +0,0 @@ -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; -}; -module.exports = on; diff --git a/test/onUserInputChange/onUserInputChange.test.js b/test/onUserInputChange.test.js similarity index 69% rename from test/onUserInputChange/onUserInputChange.test.js rename to test/onUserInputChange.test.js index 675143979..c0ac171a9 100644 --- a/test/onUserInputChange/onUserInputChange.test.js +++ b/test/onUserInputChange.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const onUserInputChange = require('./onUserInputChange.js'); +const {onUserInputChange} = require('./_30s.js'); test('onUserInputChange is a Function', () => { expect(onUserInputChange).toBeInstanceOf(Function); diff --git a/test/onUserInputChange/onUserInputChange.js b/test/onUserInputChange/onUserInputChange.js deleted file mode 100644 index 2e18d25f2..000000000 --- a/test/onUserInputChange/onUserInputChange.js +++ /dev/null @@ -1,15 +0,0 @@ -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); - }); -}; -module.exports = onUserInputChange; diff --git a/test/once/once.test.js b/test/once.test.js similarity index 75% rename from test/once/once.test.js rename to test/once.test.js index ecd7ed6f0..04c07b340 100644 --- a/test/once/once.test.js +++ b/test/once.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const once = require('./once.js'); +const {once} = require('./_30s.js'); test('once is a Function', () => { expect(once).toBeInstanceOf(Function); diff --git a/test/once/once.js b/test/once/once.js deleted file mode 100644 index 3854d57c1..000000000 --- a/test/once/once.js +++ /dev/null @@ -1,9 +0,0 @@ -const once = fn => { - let called = false; - return function(...args) { - if (called) return; - called = true; - return fn.apply(this, args); - }; -}; -module.exports = once; diff --git a/test/orderBy/orderBy.test.js b/test/orderBy.test.js similarity index 94% rename from test/orderBy/orderBy.test.js rename to test/orderBy.test.js index 119950376..74b7e61c5 100644 --- a/test/orderBy/orderBy.test.js +++ b/test/orderBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const orderBy = require('./orderBy.js'); +const {orderBy} = require('./_30s.js'); test('orderBy is a Function', () => { expect(orderBy).toBeInstanceOf(Function); diff --git a/test/orderBy/orderBy.js b/test/orderBy/orderBy.js deleted file mode 100644 index a950b7af9..000000000 --- a/test/orderBy/orderBy.js +++ /dev/null @@ -1,11 +0,0 @@ -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) - ); -module.exports = orderBy; diff --git a/test/over/over.test.js b/test/over.test.js similarity index 88% rename from test/over/over.test.js rename to test/over.test.js index f4b7dd578..adb0c1918 100644 --- a/test/over/over.test.js +++ b/test/over.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const over = require('./over.js'); +const {over} = require('./_30s.js'); test('over is a Function', () => { expect(over).toBeInstanceOf(Function); diff --git a/test/over/over.js b/test/over/over.js deleted file mode 100644 index 304afe4cd..000000000 --- a/test/over/over.js +++ /dev/null @@ -1,2 +0,0 @@ -const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args)); -module.exports = over; diff --git a/test/overArgs/overArgs.test.js b/test/overArgs.test.js similarity index 89% rename from test/overArgs/overArgs.test.js rename to test/overArgs.test.js index 2025c109c..87162bba8 100644 --- a/test/overArgs/overArgs.test.js +++ b/test/overArgs.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const overArgs = require('./overArgs.js'); +const {overArgs} = require('./_30s.js'); test('overArgs is a Function', () => { expect(overArgs).toBeInstanceOf(Function); diff --git a/test/overArgs/overArgs.js b/test/overArgs/overArgs.js deleted file mode 100644 index 8f832de7a..000000000 --- a/test/overArgs/overArgs.js +++ /dev/null @@ -1,2 +0,0 @@ -const overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val))); -module.exports = overArgs; diff --git a/test/pad/pad.test.js b/test/pad.test.js similarity index 93% rename from test/pad/pad.test.js rename to test/pad.test.js index d01e4a983..4070553ba 100644 --- a/test/pad/pad.test.js +++ b/test/pad.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pad = require('./pad.js'); +const {pad} = require('./_30s.js'); test('pad is a Function', () => { expect(pad).toBeInstanceOf(Function); diff --git a/test/pad/pad.js b/test/pad/pad.js deleted file mode 100644 index 70aac13ed..000000000 --- a/test/pad/pad.js +++ /dev/null @@ -1,3 +0,0 @@ -const pad = (str, length, char = ' ') => - str.padStart((str.length + length) / 2, char).padEnd(length, char); -module.exports = pad; diff --git a/test/palindrome/palindrome.test.js b/test/palindrome.test.js similarity index 87% rename from test/palindrome/palindrome.test.js rename to test/palindrome.test.js index ae174bbec..834cc89b7 100644 --- a/test/palindrome/palindrome.test.js +++ b/test/palindrome.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const palindrome = require('./palindrome.js'); +const {palindrome} = require('./_30s.js'); test('palindrome is a Function', () => { expect(palindrome).toBeInstanceOf(Function); diff --git a/test/palindrome/palindrome.js b/test/palindrome/palindrome.js deleted file mode 100644 index 479292b4c..000000000 --- a/test/palindrome/palindrome.js +++ /dev/null @@ -1,5 +0,0 @@ -const palindrome = str => { - const s = str.toLowerCase().replace(/[\W_]/g, ''); - return s === [...s].reverse().join(''); -}; -module.exports = palindrome; diff --git a/test/parseCookie/parseCookie.test.js b/test/parseCookie.test.js similarity index 84% rename from test/parseCookie/parseCookie.test.js rename to test/parseCookie.test.js index 42e942538..536301992 100644 --- a/test/parseCookie/parseCookie.test.js +++ b/test/parseCookie.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const parseCookie = require('./parseCookie.js'); +const {parseCookie} = require('./_30s.js'); test('parseCookie is a Function', () => { expect(parseCookie).toBeInstanceOf(Function); diff --git a/test/parseCookie/parseCookie.js b/test/parseCookie/parseCookie.js deleted file mode 100644 index 6e9cc957a..000000000 --- a/test/parseCookie/parseCookie.js +++ /dev/null @@ -1,9 +0,0 @@ -const parseCookie = str => - str - .split(';') - .map(v => v.split('=')) - .reduce((acc, v) => { - acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); - return acc; - }, {}); -module.exports = parseCookie; diff --git a/test/partial/partial.test.js b/test/partial.test.js similarity index 88% rename from test/partial/partial.test.js rename to test/partial.test.js index 5b3fd8f2b..0cd4687b9 100644 --- a/test/partial/partial.test.js +++ b/test/partial.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const partial = require('./partial.js'); +const {partial} = require('./_30s.js'); test('partial is a Function', () => { expect(partial).toBeInstanceOf(Function); diff --git a/test/partial/partial.js b/test/partial/partial.js deleted file mode 100644 index 9b18c7a61..000000000 --- a/test/partial/partial.js +++ /dev/null @@ -1,2 +0,0 @@ -const partial = (fn, ...partials) => (...args) => fn(...partials, ...args); -module.exports = partial; diff --git a/test/partialRight/partialRight.test.js b/test/partialRight.test.js similarity index 86% rename from test/partialRight/partialRight.test.js rename to test/partialRight.test.js index 7e04a83ba..9f825f91d 100644 --- a/test/partialRight/partialRight.test.js +++ b/test/partialRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const partialRight = require('./partialRight.js'); +const {partialRight} = require('./_30s.js'); test('partialRight is a Function', () => { expect(partialRight).toBeInstanceOf(Function); diff --git a/test/partialRight/partialRight.js b/test/partialRight/partialRight.js deleted file mode 100644 index e8e956e72..000000000 --- a/test/partialRight/partialRight.js +++ /dev/null @@ -1,2 +0,0 @@ -const partialRight = (fn, ...partials) => (...args) => fn(...args, ...partials); -module.exports = partialRight; diff --git a/test/partition/partition.test.js b/test/partition.test.js similarity index 91% rename from test/partition/partition.test.js rename to test/partition.test.js index d86d95124..c2844264d 100644 --- a/test/partition/partition.test.js +++ b/test/partition.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const partition = require('./partition.js'); +const {partition} = require('./_30s.js'); test('partition is a Function', () => { expect(partition).toBeInstanceOf(Function); diff --git a/test/partition/partition.js b/test/partition/partition.js deleted file mode 100644 index 754a9104c..000000000 --- a/test/partition/partition.js +++ /dev/null @@ -1,9 +0,0 @@ -const partition = (arr, fn) => - arr.reduce( - (acc, val, i, arr) => { - acc[fn(val, i, arr) ? 0 : 1].push(val); - return acc; - }, - [[], []] - ); -module.exports = partition; diff --git a/test/percentile/percentile.test.js b/test/percentile.test.js similarity index 87% rename from test/percentile/percentile.test.js rename to test/percentile.test.js index 689c1be26..22affd750 100644 --- a/test/percentile/percentile.test.js +++ b/test/percentile.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const percentile = require('./percentile.js'); +const {percentile} = require('./_30s.js'); test('percentile is a Function', () => { expect(percentile).toBeInstanceOf(Function); diff --git a/test/percentile/percentile.js b/test/percentile/percentile.js deleted file mode 100644 index 07669d78b..000000000 --- a/test/percentile/percentile.js +++ /dev/null @@ -1,3 +0,0 @@ -const percentile = (arr, val) => - (100 * arr.reduce((acc, v) => acc + (v < val ? 1 : 0) + (v === val ? 0.5 : 0), 0)) / arr.length; -module.exports = percentile; diff --git a/test/permutations/permutations.test.js b/test/permutations.test.js similarity index 86% rename from test/permutations/permutations.test.js rename to test/permutations.test.js index d7c085a7f..f0d8764ab 100644 --- a/test/permutations/permutations.test.js +++ b/test/permutations.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const permutations = require('./permutations.js'); +const {permutations} = require('./_30s.js'); test('permutations is a Function', () => { expect(permutations).toBeInstanceOf(Function); diff --git a/test/permutations/permutations.js b/test/permutations/permutations.js deleted file mode 100644 index 69a31471c..000000000 --- a/test/permutations/permutations.js +++ /dev/null @@ -1,11 +0,0 @@ -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]) - ), - [] - ); -}; -module.exports = permutations; diff --git a/test/pick/pick.test.js b/test/pick.test.js similarity index 88% rename from test/pick/pick.test.js rename to test/pick.test.js index 08cac4fe2..248df1054 100644 --- a/test/pick/pick.test.js +++ b/test/pick.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pick = require('./pick.js'); +const {pick} = require('./_30s.js'); test('pick is a Function', () => { expect(pick).toBeInstanceOf(Function); diff --git a/test/pick/pick.js b/test/pick/pick.js deleted file mode 100644 index 5b7b72ca6..000000000 --- a/test/pick/pick.js +++ /dev/null @@ -1,3 +0,0 @@ -const pick = (obj, arr) => - arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); -module.exports = pick; diff --git a/test/pickBy/pickBy.test.js b/test/pickBy.test.js similarity index 89% rename from test/pickBy/pickBy.test.js rename to test/pickBy.test.js index d0d679682..4ace0e674 100644 --- a/test/pickBy/pickBy.test.js +++ b/test/pickBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pickBy = require('./pickBy.js'); +const {pickBy} = require('./_30s.js'); test('pickBy is a Function', () => { expect(pickBy).toBeInstanceOf(Function); diff --git a/test/pickBy/pickBy.js b/test/pickBy/pickBy.js deleted file mode 100644 index eca8e0f11..000000000 --- a/test/pickBy/pickBy.js +++ /dev/null @@ -1,5 +0,0 @@ -const pickBy = (obj, fn) => - Object.keys(obj) - .filter(k => fn(obj[k], k)) - .reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); -module.exports = pickBy; diff --git a/test/pipeAsyncFunctions/pipeAsyncFunctions.test.js b/test/pipeAsyncFunctions.test.js similarity index 86% rename from test/pipeAsyncFunctions/pipeAsyncFunctions.test.js rename to test/pipeAsyncFunctions.test.js index a53006bf4..294c10fe3 100644 --- a/test/pipeAsyncFunctions/pipeAsyncFunctions.test.js +++ b/test/pipeAsyncFunctions.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pipeAsyncFunctions = require('./pipeAsyncFunctions.js'); +const {pipeAsyncFunctions} = require('./_30s.js'); test('pipeAsyncFunctions is a Function', () => { expect(pipeAsyncFunctions).toBeInstanceOf(Function); diff --git a/test/pipeAsyncFunctions/pipeAsyncFunctions.js b/test/pipeAsyncFunctions/pipeAsyncFunctions.js deleted file mode 100644 index 501fda5bd..000000000 --- a/test/pipeAsyncFunctions/pipeAsyncFunctions.js +++ /dev/null @@ -1,2 +0,0 @@ -const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg)); -module.exports = pipeAsyncFunctions; diff --git a/test/pipeFunctions/pipeFunctions.test.js b/test/pipeFunctions.test.js similarity index 86% rename from test/pipeFunctions/pipeFunctions.test.js rename to test/pipeFunctions.test.js index b121c9612..17aa9654e 100644 --- a/test/pipeFunctions/pipeFunctions.test.js +++ b/test/pipeFunctions.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pipeFunctions = require('./pipeFunctions.js'); +const {pipeFunctions} = require('./_30s.js'); test('pipeFunctions is a Function', () => { expect(pipeFunctions).toBeInstanceOf(Function); diff --git a/test/pipeFunctions/pipeFunctions.js b/test/pipeFunctions/pipeFunctions.js deleted file mode 100644 index f6703cf5d..000000000 --- a/test/pipeFunctions/pipeFunctions.js +++ /dev/null @@ -1,2 +0,0 @@ -const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); -module.exports = pipeFunctions; diff --git a/test/pipeLog/pipeLog.test.js b/test/pipeLog.test.js similarity index 74% rename from test/pipeLog/pipeLog.test.js rename to test/pipeLog.test.js index 0c3804936..47ac1f9b1 100644 --- a/test/pipeLog/pipeLog.test.js +++ b/test/pipeLog.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pipeLog = require('./pipeLog.js'); +const {pipeLog} = require('./_30s.js'); test('pipeLog is a Function', () => { expect(pipeLog).toBeInstanceOf(Function); diff --git a/test/pipeLog/pipeLog.js b/test/pipeLog/pipeLog.js deleted file mode 100644 index 24a764e4d..000000000 --- a/test/pipeLog/pipeLog.js +++ /dev/null @@ -1,2 +0,0 @@ -const pipeLog = data => console.log(data) || data; -module.exports = pipeLog; diff --git a/test/pluralize/pluralize.test.js b/test/pluralize.test.js similarity index 94% rename from test/pluralize/pluralize.test.js rename to test/pluralize.test.js index 2a61e63b9..0dbe882cd 100644 --- a/test/pluralize/pluralize.test.js +++ b/test/pluralize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pluralize = require('./pluralize.js'); +const {pluralize} = require('./_30s.js'); test('pluralize is a Function', () => { expect(pluralize).toBeInstanceOf(Function); diff --git a/test/pluralize/pluralize.js b/test/pluralize/pluralize.js deleted file mode 100644 index a7e5d9fdd..000000000 --- a/test/pluralize/pluralize.js +++ /dev/null @@ -1,7 +0,0 @@ -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); -}; -module.exports = pluralize; diff --git a/test/powerset/powerset.test.js b/test/powerset.test.js similarity index 85% rename from test/powerset/powerset.test.js rename to test/powerset.test.js index 50fd91f89..598408863 100644 --- a/test/powerset/powerset.test.js +++ b/test/powerset.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const powerset = require('./powerset.js'); +const {powerset} = require('./_30s.js'); test('powerset is a Function', () => { expect(powerset).toBeInstanceOf(Function); diff --git a/test/powerset/powerset.js b/test/powerset/powerset.js deleted file mode 100644 index e9a2f5099..000000000 --- a/test/powerset/powerset.js +++ /dev/null @@ -1,2 +0,0 @@ -const powerset = arr => arr.reduce((a, v) => a.concat(a.map(r => [v].concat(r))), [[]]); -module.exports = powerset; diff --git a/test/prefix/prefix.test.js b/test/prefix.test.js similarity index 75% rename from test/prefix/prefix.test.js rename to test/prefix.test.js index b2c491ad4..df22a6f28 100644 --- a/test/prefix/prefix.test.js +++ b/test/prefix.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const prefix = require('./prefix.js'); +const {prefix} = require('./_30s.js'); test('prefix is a Function', () => { expect(prefix).toBeInstanceOf(Function); diff --git a/test/prefix/prefix.js b/test/prefix/prefix.js deleted file mode 100644 index ddcd28958..000000000 --- a/test/prefix/prefix.js +++ /dev/null @@ -1,9 +0,0 @@ -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; -}; -module.exports = prefix; diff --git a/test/prettyBytes/prettyBytes.test.js b/test/prettyBytes.test.js similarity index 91% rename from test/prettyBytes/prettyBytes.test.js rename to test/prettyBytes.test.js index 4bf4e3794..954713d42 100644 --- a/test/prettyBytes/prettyBytes.test.js +++ b/test/prettyBytes.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const prettyBytes = require('./prettyBytes.js'); +const {prettyBytes} = require('./_30s.js'); test('prettyBytes is a Function', () => { expect(prettyBytes).toBeInstanceOf(Function); diff --git a/test/prettyBytes/prettyBytes.js b/test/prettyBytes/prettyBytes.js deleted file mode 100644 index 1616f4f58..000000000 --- a/test/prettyBytes/prettyBytes.js +++ /dev/null @@ -1,8 +0,0 @@ -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]; -}; -module.exports = prettyBytes; diff --git a/test/primes/primes.test.js b/test/primes.test.js similarity index 86% rename from test/primes/primes.test.js rename to test/primes.test.js index b0561c953..2d2e46ff7 100644 --- a/test/primes/primes.test.js +++ b/test/primes.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const primes = require('./primes.js'); +const {primes} = require('./_30s.js'); test('primes is a Function', () => { expect(primes).toBeInstanceOf(Function); diff --git a/test/primes/primes.js b/test/primes/primes.js deleted file mode 100644 index 710c52db2..000000000 --- a/test/primes/primes.js +++ /dev/null @@ -1,8 +0,0 @@ -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; -}; -module.exports = primes; diff --git a/test/promisify/promisify.test.js b/test/promisify.test.js similarity index 89% rename from test/promisify/promisify.test.js rename to test/promisify.test.js index 9a65b98fc..820c73ba0 100644 --- a/test/promisify/promisify.test.js +++ b/test/promisify.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const promisify = require('./promisify.js'); +const {promisify} = require('./_30s.js'); test('promisify is a Function', () => { expect(promisify).toBeInstanceOf(Function); diff --git a/test/promisify/promisify.js b/test/promisify/promisify.js deleted file mode 100644 index 829aa5cda..000000000 --- a/test/promisify/promisify.js +++ /dev/null @@ -1,5 +0,0 @@ -const promisify = func => (...args) => - new Promise((resolve, reject) => - func(...args, (err, result) => (err ? reject(err) : resolve(result))) - ); -module.exports = promisify; diff --git a/test/pull/pull.test.js b/test/pull.test.js similarity index 88% rename from test/pull/pull.test.js rename to test/pull.test.js index 5a3ba43d1..1e2cb138f 100644 --- a/test/pull/pull.test.js +++ b/test/pull.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pull = require('./pull.js'); +const {pull} = require('./_30s.js'); test('pull is a Function', () => { expect(pull).toBeInstanceOf(Function); diff --git a/test/pull/pull.js b/test/pull/pull.js deleted file mode 100644 index 919af8ae8..000000000 --- a/test/pull/pull.js +++ /dev/null @@ -1,7 +0,0 @@ -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)); -}; -module.exports = pull; diff --git a/test/pullAtIndex/pullAtIndex.test.js b/test/pullAtIndex.test.js similarity index 88% rename from test/pullAtIndex/pullAtIndex.test.js rename to test/pullAtIndex.test.js index 380dee163..dd237b086 100644 --- a/test/pullAtIndex/pullAtIndex.test.js +++ b/test/pullAtIndex.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pullAtIndex = require('./pullAtIndex.js'); +const {pullAtIndex} = require('./_30s.js'); test('pullAtIndex is a Function', () => { expect(pullAtIndex).toBeInstanceOf(Function); diff --git a/test/pullAtIndex/pullAtIndex.js b/test/pullAtIndex/pullAtIndex.js deleted file mode 100644 index fa28f372b..000000000 --- a/test/pullAtIndex/pullAtIndex.js +++ /dev/null @@ -1,10 +0,0 @@ -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; -}; -module.exports = pullAtIndex; diff --git a/test/pullAtValue/pullAtValue.test.js b/test/pullAtValue.test.js similarity index 88% rename from test/pullAtValue/pullAtValue.test.js rename to test/pullAtValue.test.js index 261704da7..44e550668 100644 --- a/test/pullAtValue/pullAtValue.test.js +++ b/test/pullAtValue.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pullAtValue = require('./pullAtValue.js'); +const {pullAtValue} = require('./_30s.js'); test('pullAtValue is a Function', () => { expect(pullAtValue).toBeInstanceOf(Function); diff --git a/test/pullAtValue/pullAtValue.js b/test/pullAtValue/pullAtValue.js deleted file mode 100644 index 85599fd43..000000000 --- a/test/pullAtValue/pullAtValue.js +++ /dev/null @@ -1,9 +0,0 @@ -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; -}; -module.exports = pullAtValue; diff --git a/test/pullBy/pullBy.test.js b/test/pullBy.test.js similarity index 88% rename from test/pullBy/pullBy.test.js rename to test/pullBy.test.js index a1a7f1852..dd9be21a7 100644 --- a/test/pullBy/pullBy.test.js +++ b/test/pullBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const pullBy = require('./pullBy.js'); +const {pullBy} = require('./_30s.js'); test('pullBy is a Function', () => { expect(pullBy).toBeInstanceOf(Function); diff --git a/test/pullBy/pullBy.js b/test/pullBy/pullBy.js deleted file mode 100644 index fb254dbc2..000000000 --- a/test/pullBy/pullBy.js +++ /dev/null @@ -1,10 +0,0 @@ -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)); -}; -module.exports = pullBy; diff --git a/test/quickSort/quickSort.test.js b/test/quickSort.test.js similarity index 96% rename from test/quickSort/quickSort.test.js rename to test/quickSort.test.js index 780f81c93..57403de8b 100644 --- a/test/quickSort/quickSort.test.js +++ b/test/quickSort.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const quickSort = require('./quickSort.js'); +const {quickSort} = require('./_30s.js'); test('quickSort is a Function', () => { expect(quickSort).toBeInstanceOf(Function); diff --git a/test/quickSort/quickSort.js b/test/quickSort/quickSort.js deleted file mode 100644 index 692604be0..000000000 --- a/test/quickSort/quickSort.js +++ /dev/null @@ -1,9 +0,0 @@ -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) - ]; -module.exports = quickSort; diff --git a/test/radsToDegrees/radsToDegrees.test.js b/test/radsToDegrees.test.js similarity index 81% rename from test/radsToDegrees/radsToDegrees.test.js rename to test/radsToDegrees.test.js index 5e7bdea5c..7d0438f5e 100644 --- a/test/radsToDegrees/radsToDegrees.test.js +++ b/test/radsToDegrees.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const radsToDegrees = require('./radsToDegrees.js'); +const {radsToDegrees} = require('./_30s.js'); test('radsToDegrees is a Function', () => { expect(radsToDegrees).toBeInstanceOf(Function); diff --git a/test/radsToDegrees/radsToDegrees.js b/test/radsToDegrees/radsToDegrees.js deleted file mode 100644 index fde727a2f..000000000 --- a/test/radsToDegrees/radsToDegrees.js +++ /dev/null @@ -1,2 +0,0 @@ -const radsToDegrees = rad => (rad * 180.0) / Math.PI; -module.exports = radsToDegrees; diff --git a/test/randomHexColorCode/randomHexColorCode.test.js b/test/randomHexColorCode.test.js similarity index 89% rename from test/randomHexColorCode/randomHexColorCode.test.js rename to test/randomHexColorCode.test.js index 353cd2c4c..cce363b08 100644 --- a/test/randomHexColorCode/randomHexColorCode.test.js +++ b/test/randomHexColorCode.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const randomHexColorCode = require('./randomHexColorCode.js'); +const {randomHexColorCode} = require('./_30s.js'); test('randomHexColorCode is a Function', () => { expect(randomHexColorCode).toBeInstanceOf(Function); diff --git a/test/randomHexColorCode/randomHexColorCode.js b/test/randomHexColorCode/randomHexColorCode.js deleted file mode 100644 index 0b692db35..000000000 --- a/test/randomHexColorCode/randomHexColorCode.js +++ /dev/null @@ -1,5 +0,0 @@ -const randomHexColorCode = () => { - let n = (Math.random() * 0xfffff * 1000000).toString(16); - return '#' + n.slice(0, 6); -}; -module.exports = randomHexColorCode; diff --git a/test/randomIntArrayInRange/randomIntArrayInRange.test.js b/test/randomIntArrayInRange.test.js similarity index 91% rename from test/randomIntArrayInRange/randomIntArrayInRange.test.js rename to test/randomIntArrayInRange.test.js index f0e9e4913..21a037fd7 100644 --- a/test/randomIntArrayInRange/randomIntArrayInRange.test.js +++ b/test/randomIntArrayInRange.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const randomIntArrayInRange = require('./randomIntArrayInRange.js'); +const {randomIntArrayInRange} = require('./_30s.js'); test('randomIntArrayInRange is a Function', () => { expect(randomIntArrayInRange).toBeInstanceOf(Function); diff --git a/test/randomIntArrayInRange/randomIntArrayInRange.js b/test/randomIntArrayInRange/randomIntArrayInRange.js deleted file mode 100644 index f4e3a0dc6..000000000 --- a/test/randomIntArrayInRange/randomIntArrayInRange.js +++ /dev/null @@ -1,3 +0,0 @@ -const randomIntArrayInRange = (min, max, n = 1) => - Array.from({ length: n }, () => Math.floor(Math.random() * (max - min + 1)) + min); -module.exports = randomIntArrayInRange; diff --git a/test/randomIntegerInRange/randomIntegerInRange.test.js b/test/randomIntegerInRange.test.js similarity index 90% rename from test/randomIntegerInRange/randomIntegerInRange.test.js rename to test/randomIntegerInRange.test.js index 1e7179441..88e567892 100644 --- a/test/randomIntegerInRange/randomIntegerInRange.test.js +++ b/test/randomIntegerInRange.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const randomIntegerInRange = require('./randomIntegerInRange.js'); +const {randomIntegerInRange} = require('./_30s.js'); test('randomIntegerInRange is a Function', () => { expect(randomIntegerInRange).toBeInstanceOf(Function); diff --git a/test/randomIntegerInRange/randomIntegerInRange.js b/test/randomIntegerInRange/randomIntegerInRange.js deleted file mode 100644 index 8489482e8..000000000 --- a/test/randomIntegerInRange/randomIntegerInRange.js +++ /dev/null @@ -1,2 +0,0 @@ -const randomIntegerInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; -module.exports = randomIntegerInRange; diff --git a/test/randomNumberInRange/randomNumberInRange.test.js b/test/randomNumberInRange.test.js similarity index 90% rename from test/randomNumberInRange/randomNumberInRange.test.js rename to test/randomNumberInRange.test.js index f3eb1ddd8..f783bde4c 100644 --- a/test/randomNumberInRange/randomNumberInRange.test.js +++ b/test/randomNumberInRange.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const randomNumberInRange = require('./randomNumberInRange.js'); +const {randomNumberInRange} = require('./_30s.js'); test('randomNumberInRange is a Function', () => { expect(randomNumberInRange).toBeInstanceOf(Function); diff --git a/test/randomNumberInRange/randomNumberInRange.js b/test/randomNumberInRange/randomNumberInRange.js deleted file mode 100644 index 603adcbcb..000000000 --- a/test/randomNumberInRange/randomNumberInRange.js +++ /dev/null @@ -1,2 +0,0 @@ -const randomNumberInRange = (min, max) => Math.random() * (max - min) + min; -module.exports = randomNumberInRange; diff --git a/test/readFileLines/readFileLines.test.js b/test/readFileLines.test.js similarity index 71% rename from test/readFileLines/readFileLines.test.js rename to test/readFileLines.test.js index 604c87d79..7873a03be 100644 --- a/test/readFileLines/readFileLines.test.js +++ b/test/readFileLines.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const readFileLines = require('./readFileLines.js'); +const {readFileLines} = require('./_30s.js'); test('readFileLines is a Function', () => { expect(readFileLines).toBeInstanceOf(Function); diff --git a/test/readFileLines/readFileLines.js b/test/readFileLines/readFileLines.js deleted file mode 100644 index 5b041d603..000000000 --- a/test/readFileLines/readFileLines.js +++ /dev/null @@ -1,7 +0,0 @@ -const fs = require('fs'); -const readFileLines = filename => - fs - .readFileSync(filename) - .toString('UTF8') - .split('\n'); -module.exports = readFileLines; diff --git a/test/rearg/rearg.test.js b/test/rearg.test.js similarity index 89% rename from test/rearg/rearg.test.js rename to test/rearg.test.js index 28a589db3..ef20bfee2 100644 --- a/test/rearg/rearg.test.js +++ b/test/rearg.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const rearg = require('./rearg.js'); +const {rearg} = require('./_30s.js'); test('rearg is a Function', () => { expect(rearg).toBeInstanceOf(Function); diff --git a/test/rearg/rearg.js b/test/rearg/rearg.js deleted file mode 100644 index 927d9e9da..000000000 --- a/test/rearg/rearg.js +++ /dev/null @@ -1,2 +0,0 @@ -const rearg = (fn, indexes) => (...args) => fn(...indexes.map(i => args[i])); -module.exports = rearg; diff --git a/test/recordAnimationFrames/recordAnimationFrames.test.js b/test/recordAnimationFrames.test.js similarity index 68% rename from test/recordAnimationFrames/recordAnimationFrames.test.js rename to test/recordAnimationFrames.test.js index 7c95d8452..900c03488 100644 --- a/test/recordAnimationFrames/recordAnimationFrames.test.js +++ b/test/recordAnimationFrames.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const recordAnimationFrames = require('./recordAnimationFrames.js'); +const {recordAnimationFrames} = require('./_30s.js'); test('recordAnimationFrames is a Function', () => { expect(recordAnimationFrames).toBeInstanceOf(Function); diff --git a/test/recordAnimationFrames/recordAnimationFrames.js b/test/recordAnimationFrames/recordAnimationFrames.js deleted file mode 100644 index 753175588..000000000 --- a/test/recordAnimationFrames/recordAnimationFrames.js +++ /dev/null @@ -1,21 +0,0 @@ -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 }; -}; -module.exports = recordAnimationFrames; diff --git a/test/redirect/redirect.test.js b/test/redirect.test.js similarity index 74% rename from test/redirect/redirect.test.js rename to test/redirect.test.js index 831a1d75d..6f6ea68dd 100644 --- a/test/redirect/redirect.test.js +++ b/test/redirect.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const redirect = require('./redirect.js'); +const {redirect} = require('./_30s.js'); test('redirect is a Function', () => { expect(redirect).toBeInstanceOf(Function); diff --git a/test/redirect/redirect.js b/test/redirect/redirect.js deleted file mode 100644 index c0dc849eb..000000000 --- a/test/redirect/redirect.js +++ /dev/null @@ -1,3 +0,0 @@ -const redirect = (url, asLink = true) => - asLink ? (window.location.href = url) : window.location.replace(url); -module.exports = redirect; diff --git a/test/reduceSuccessive/reduceSuccessive.test.js b/test/reduceSuccessive.test.js similarity index 85% rename from test/reduceSuccessive/reduceSuccessive.test.js rename to test/reduceSuccessive.test.js index 333e613af..2f096c0a8 100644 --- a/test/reduceSuccessive/reduceSuccessive.test.js +++ b/test/reduceSuccessive.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const reduceSuccessive = require('./reduceSuccessive.js'); +const {reduceSuccessive} = require('./_30s.js'); test('reduceSuccessive is a Function', () => { expect(reduceSuccessive).toBeInstanceOf(Function); diff --git a/test/reduceSuccessive/reduceSuccessive.js b/test/reduceSuccessive/reduceSuccessive.js deleted file mode 100644 index 73579bb6f..000000000 --- a/test/reduceSuccessive/reduceSuccessive.js +++ /dev/null @@ -1,3 +0,0 @@ -const reduceSuccessive = (arr, fn, acc) => - arr.reduce((res, val, i, arr) => (res.push(fn(res.slice(-1)[0], val, i, arr)), res), [acc]); -module.exports = reduceSuccessive; diff --git a/test/reduceWhich/reduceWhich.test.js b/test/reduceWhich.test.js similarity index 92% rename from test/reduceWhich/reduceWhich.test.js rename to test/reduceWhich.test.js index 7789a74e9..757a0767d 100644 --- a/test/reduceWhich/reduceWhich.test.js +++ b/test/reduceWhich.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const reduceWhich = require('./reduceWhich.js'); +const {reduceWhich} = require('./_30s.js'); test('reduceWhich is a Function', () => { expect(reduceWhich).toBeInstanceOf(Function); diff --git a/test/reduceWhich/reduceWhich.js b/test/reduceWhich/reduceWhich.js deleted file mode 100644 index b74349439..000000000 --- a/test/reduceWhich/reduceWhich.js +++ /dev/null @@ -1,3 +0,0 @@ -const reduceWhich = (arr, comparator = (a, b) => a - b) => - arr.reduce((a, b) => (comparator(a, b) >= 0 ? b : a)); -module.exports = reduceWhich; diff --git a/test/reducedFilter/reducedFilter.test.js b/test/reducedFilter.test.js similarity index 89% rename from test/reducedFilter/reducedFilter.test.js rename to test/reducedFilter.test.js index bd37980ee..2630f1098 100644 --- a/test/reducedFilter/reducedFilter.test.js +++ b/test/reducedFilter.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const reducedFilter = require('./reducedFilter.js'); +const {reducedFilter} = require('./_30s.js'); test('reducedFilter is a Function', () => { expect(reducedFilter).toBeInstanceOf(Function); diff --git a/test/reducedFilter/reducedFilter.js b/test/reducedFilter/reducedFilter.js deleted file mode 100644 index c9ef05049..000000000 --- a/test/reducedFilter/reducedFilter.js +++ /dev/null @@ -1,8 +0,0 @@ -const reducedFilter = (data, keys, fn) => - data.filter(fn).map(el => - keys.reduce((acc, key) => { - acc[key] = el[key]; - return acc; - }, {}) - ); -module.exports = reducedFilter; diff --git a/test/reject/reject.test.js b/test/reject.test.js similarity index 91% rename from test/reject/reject.test.js rename to test/reject.test.js index 3dddd9fb2..6af1fbb28 100644 --- a/test/reject/reject.test.js +++ b/test/reject.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const reject = require('./reject.js'); +const {reject} = require('./_30s.js'); test('reject is a Function', () => { expect(reject).toBeInstanceOf(Function); diff --git a/test/reject/reject.js b/test/reject/reject.js deleted file mode 100644 index 4f095ce0a..000000000 --- a/test/reject/reject.js +++ /dev/null @@ -1,2 +0,0 @@ -const reject = (pred, array) => array.filter((...args) => !pred(...args)); -module.exports = reject; diff --git a/test/remove/remove.test.js b/test/remove.test.js similarity index 87% rename from test/remove/remove.test.js rename to test/remove.test.js index efafcc3da..85c57d951 100644 --- a/test/remove/remove.test.js +++ b/test/remove.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const remove = require('./remove.js'); +const {remove} = require('./_30s.js'); test('remove is a Function', () => { expect(remove).toBeInstanceOf(Function); diff --git a/test/remove/remove.js b/test/remove/remove.js deleted file mode 100644 index e1dda8ccb..000000000 --- a/test/remove/remove.js +++ /dev/null @@ -1,8 +0,0 @@ -const remove = (arr, func) => - Array.isArray(arr) - ? arr.filter(func).reduce((acc, val) => { - arr.splice(arr.indexOf(val), 1); - return acc.concat(val); - }, []) - : []; -module.exports = remove; diff --git a/test/removeNonASCII/removeNonASCII.test.js b/test/removeNonASCII.test.js similarity index 83% rename from test/removeNonASCII/removeNonASCII.test.js rename to test/removeNonASCII.test.js index 4e8f6f7bd..9c3ccdd62 100644 --- a/test/removeNonASCII/removeNonASCII.test.js +++ b/test/removeNonASCII.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const removeNonASCII = require('./removeNonASCII.js'); +const {removeNonASCII} = require('./_30s.js'); test('removeNonASCII is a Function', () => { expect(removeNonASCII).toBeInstanceOf(Function); diff --git a/test/removeNonASCII/removeNonASCII.js b/test/removeNonASCII/removeNonASCII.js deleted file mode 100644 index 1c6220bae..000000000 --- a/test/removeNonASCII/removeNonASCII.js +++ /dev/null @@ -1,2 +0,0 @@ -const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); -module.exports = removeNonASCII; diff --git a/test/removeVowels/removeVowels.test.js b/test/removeVowels.test.js similarity index 71% rename from test/removeVowels/removeVowels.test.js rename to test/removeVowels.test.js index a9e2458f8..13477fcb1 100644 --- a/test/removeVowels/removeVowels.test.js +++ b/test/removeVowels.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const removeVowels = require('./removeVowels.js'); +const {removeVowels} = require('./_30s.js'); test('removeVowels is a Function', () => { expect(removeVowels).toBeInstanceOf(Function); diff --git a/test/removeVowels/removeVowels.js b/test/removeVowels/removeVowels.js deleted file mode 100644 index 31250b816..000000000 --- a/test/removeVowels/removeVowels.js +++ /dev/null @@ -1,2 +0,0 @@ -const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi, repl); -module.exports = removeVowels; diff --git a/test/renameKeys/renameKeys.test.js b/test/renameKeys.test.js similarity index 89% rename from test/renameKeys/renameKeys.test.js rename to test/renameKeys.test.js index 574c18289..dd390f8ae 100644 --- a/test/renameKeys/renameKeys.test.js +++ b/test/renameKeys.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const renameKeys = require('./renameKeys.js'); +const {renameKeys} = require('./_30s.js'); test('renameKeys is a Function', () => { expect(renameKeys).toBeInstanceOf(Function); diff --git a/test/renameKeys/renameKeys.js b/test/renameKeys/renameKeys.js deleted file mode 100644 index 4a5fe11c8..000000000 --- a/test/renameKeys/renameKeys.js +++ /dev/null @@ -1,9 +0,0 @@ -const renameKeys = (keysMap, obj) => - Object.keys(obj).reduce( - (acc, key) => ({ - ...acc, - ...{ [keysMap[key] || key]: obj[key] } - }), - {} - ); -module.exports = renameKeys; diff --git a/test/reverseString/reverseString.test.js b/test/reverseString.test.js similarity index 80% rename from test/reverseString/reverseString.test.js rename to test/reverseString.test.js index 8eef925d7..40820df25 100644 --- a/test/reverseString/reverseString.test.js +++ b/test/reverseString.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const reverseString = require('./reverseString.js'); +const {reverseString} = require('./_30s.js'); test('reverseString is a Function', () => { expect(reverseString).toBeInstanceOf(Function); diff --git a/test/reverseString/reverseString.js b/test/reverseString/reverseString.js deleted file mode 100644 index 328f70143..000000000 --- a/test/reverseString/reverseString.js +++ /dev/null @@ -1,2 +0,0 @@ -const reverseString = str => [...str].reverse().join(''); -module.exports = reverseString; diff --git a/test/round/round.test.js b/test/round.test.js similarity index 96% rename from test/round/round.test.js rename to test/round.test.js index b3a834bf6..c2a3af3cf 100644 --- a/test/round/round.test.js +++ b/test/round.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const round = require('./round.js'); +const {round} = require('./_30s.js'); test('round is a Function', () => { expect(round).toBeInstanceOf(Function); diff --git a/test/round/round.js b/test/round/round.js deleted file mode 100644 index 2e9fdc4ec..000000000 --- a/test/round/round.js +++ /dev/null @@ -1,2 +0,0 @@ -const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`); -module.exports = round; diff --git a/test/runAsync/runAsync.test.js b/test/runAsync.test.js similarity index 74% rename from test/runAsync/runAsync.test.js rename to test/runAsync.test.js index fb2806ed4..18c84289d 100644 --- a/test/runAsync/runAsync.test.js +++ b/test/runAsync.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const runAsync = require('./runAsync.js'); +const {runAsync} = require('./_30s.js'); test('runAsync is a Function', () => { expect(runAsync).toBeInstanceOf(Function); diff --git a/test/runAsync/runAsync.js b/test/runAsync/runAsync.js deleted file mode 100644 index c588b6842..000000000 --- a/test/runAsync/runAsync.js +++ /dev/null @@ -1,16 +0,0 @@ -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(); - }; - }); -}; -module.exports = runAsync; diff --git a/test/runPromisesInSeries/runPromisesInSeries.test.js b/test/runPromisesInSeries.test.js similarity index 84% rename from test/runPromisesInSeries/runPromisesInSeries.test.js rename to test/runPromisesInSeries.test.js index 489a95859..b772745ec 100644 --- a/test/runPromisesInSeries/runPromisesInSeries.test.js +++ b/test/runPromisesInSeries.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const runPromisesInSeries = require('./runPromisesInSeries.js'); +const {runPromisesInSeries} = require('./_30s.js'); test('runPromisesInSeries is a Function', () => { expect(runPromisesInSeries).toBeInstanceOf(Function); diff --git a/test/runPromisesInSeries/runPromisesInSeries.js b/test/runPromisesInSeries/runPromisesInSeries.js deleted file mode 100644 index aacbe2f59..000000000 --- a/test/runPromisesInSeries/runPromisesInSeries.js +++ /dev/null @@ -1,2 +0,0 @@ -const runPromisesInSeries = ps => ps.reduce((p, next) => p.then(next), Promise.resolve()); -module.exports = runPromisesInSeries; diff --git a/test/sample/sample.test.js b/test/sample.test.js similarity index 91% rename from test/sample/sample.test.js rename to test/sample.test.js index e2549df61..0f139654c 100644 --- a/test/sample/sample.test.js +++ b/test/sample.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sample = require('./sample.js'); +const {sample} = require('./_30s.js'); test('sample is a Function', () => { expect(sample).toBeInstanceOf(Function); diff --git a/test/sample/sample.js b/test/sample/sample.js deleted file mode 100644 index 413d94d41..000000000 --- a/test/sample/sample.js +++ /dev/null @@ -1,2 +0,0 @@ -const sample = arr => arr[Math.floor(Math.random() * arr.length)]; -module.exports = sample; diff --git a/test/sampleSize/sampleSize.test.js b/test/sampleSize.test.js similarity index 93% rename from test/sampleSize/sampleSize.test.js rename to test/sampleSize.test.js index ef5b3ae96..9441a6967 100644 --- a/test/sampleSize/sampleSize.test.js +++ b/test/sampleSize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sampleSize = require('./sampleSize.js'); +const {sampleSize} = require('./_30s.js'); test('sampleSize is a Function', () => { expect(sampleSize).toBeInstanceOf(Function); diff --git a/test/sampleSize/sampleSize.js b/test/sampleSize/sampleSize.js deleted file mode 100644 index 90cb4e64d..000000000 --- a/test/sampleSize/sampleSize.js +++ /dev/null @@ -1,9 +0,0 @@ -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); -}; -module.exports = sampleSize; diff --git a/test/scrollToTop/scrollToTop.test.js b/test/scrollToTop.test.js similarity index 72% rename from test/scrollToTop/scrollToTop.test.js rename to test/scrollToTop.test.js index c92677b1b..1700d24c8 100644 --- a/test/scrollToTop/scrollToTop.test.js +++ b/test/scrollToTop.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const scrollToTop = require('./scrollToTop.js'); +const {scrollToTop} = require('./_30s.js'); test('scrollToTop is a Function', () => { expect(scrollToTop).toBeInstanceOf(Function); diff --git a/test/scrollToTop/scrollToTop.js b/test/scrollToTop/scrollToTop.js deleted file mode 100644 index 337e461b1..000000000 --- a/test/scrollToTop/scrollToTop.js +++ /dev/null @@ -1,8 +0,0 @@ -const scrollToTop = () => { - const c = document.documentElement.scrollTop || document.body.scrollTop; - if (c > 0) { - window.requestAnimationFrame(scrollToTop); - window.scrollTo(0, c - c / 8); - } -}; -module.exports = scrollToTop; diff --git a/test/sdbm/sdbm.test.js b/test/sdbm.test.js similarity index 85% rename from test/sdbm/sdbm.test.js rename to test/sdbm.test.js index 58567bc40..583500da6 100644 --- a/test/sdbm/sdbm.test.js +++ b/test/sdbm.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sdbm = require('./sdbm.js'); +const {sdbm} = require('./_30s.js'); test('sdbm is a Function', () => { expect(sdbm).toBeInstanceOf(Function); diff --git a/test/sdbm/sdbm.js b/test/sdbm/sdbm.js deleted file mode 100644 index 03aae310c..000000000 --- a/test/sdbm/sdbm.js +++ /dev/null @@ -1,9 +0,0 @@ -const sdbm = str => { - let arr = str.split(''); - return arr.reduce( - (hashCode, currentVal) => - (hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode), - 0 - ); -}; -module.exports = sdbm; diff --git a/test/serializeCookie/serializeCookie.test.js b/test/serializeCookie.test.js similarity index 80% rename from test/serializeCookie/serializeCookie.test.js rename to test/serializeCookie.test.js index 211ca7c21..2de3c2d1c 100644 --- a/test/serializeCookie/serializeCookie.test.js +++ b/test/serializeCookie.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const serializeCookie = require('./serializeCookie.js'); +const {serializeCookie} = require('./_30s.js'); test('serializeCookie is a Function', () => { expect(serializeCookie).toBeInstanceOf(Function); diff --git a/test/serializeCookie/serializeCookie.js b/test/serializeCookie/serializeCookie.js deleted file mode 100644 index 48155e78f..000000000 --- a/test/serializeCookie/serializeCookie.js +++ /dev/null @@ -1,2 +0,0 @@ -const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`; -module.exports = serializeCookie; diff --git a/test/setStyle/setStyle.test.js b/test/setStyle.test.js similarity index 74% rename from test/setStyle/setStyle.test.js rename to test/setStyle.test.js index 2982ae7cd..8d3e786c6 100644 --- a/test/setStyle/setStyle.test.js +++ b/test/setStyle.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const setStyle = require('./setStyle.js'); +const {setStyle} = require('./_30s.js'); test('setStyle is a Function', () => { expect(setStyle).toBeInstanceOf(Function); diff --git a/test/setStyle/setStyle.js b/test/setStyle/setStyle.js deleted file mode 100644 index 3a48adac9..000000000 --- a/test/setStyle/setStyle.js +++ /dev/null @@ -1,2 +0,0 @@ -const setStyle = (el, ruleName, val) => (el.style[ruleName] = val); -module.exports = setStyle; diff --git a/test/shallowClone/shallowClone.test.js b/test/shallowClone.test.js similarity index 87% rename from test/shallowClone/shallowClone.test.js rename to test/shallowClone.test.js index 14c8fdf1c..e58665917 100644 --- a/test/shallowClone/shallowClone.test.js +++ b/test/shallowClone.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const shallowClone = require('./shallowClone.js'); +const {shallowClone} = require('./_30s.js'); test('shallowClone is a Function', () => { expect(shallowClone).toBeInstanceOf(Function); diff --git a/test/shallowClone/shallowClone.js b/test/shallowClone/shallowClone.js deleted file mode 100644 index ecad6c309..000000000 --- a/test/shallowClone/shallowClone.js +++ /dev/null @@ -1,2 +0,0 @@ -const shallowClone = obj => Object.assign({}, obj); -module.exports = shallowClone; diff --git a/test/shank/shank.test.js b/test/shank.test.js similarity index 93% rename from test/shank/shank.test.js rename to test/shank.test.js index e14414748..c53b90656 100644 --- a/test/shank/shank.test.js +++ b/test/shank.test.js @@ -1,5 +1,5 @@ const expect = require("expect"); -const shank = require("./shank.js"); +const {shank} = require("./_30s.js"); test("shank is a Function", () => { expect(shank).toBeInstanceOf(Function); diff --git a/test/shank/shank.js b/test/shank/shank.js deleted file mode 100644 index 3d5e19f9c..000000000 --- a/test/shank/shank.js +++ /dev/null @@ -1,6 +0,0 @@ -const shank = (arr, index = 0, delCount = 0, ...elements) => - arr - .slice(0, index) - .concat(elements) - .concat(arr.slice(index + delCount)); -module.exports = shank; diff --git a/test/show/show.test.js b/test/show.test.js similarity index 75% rename from test/show/show.test.js rename to test/show.test.js index 81c5ea492..e1e535f43 100644 --- a/test/show/show.test.js +++ b/test/show.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const show = require('./show.js'); +const {show} = require('./_30s.js'); test('show is a Function', () => { expect(show).toBeInstanceOf(Function); diff --git a/test/show/show.js b/test/show/show.js deleted file mode 100644 index 028f2fc76..000000000 --- a/test/show/show.js +++ /dev/null @@ -1,2 +0,0 @@ -const show = (...el) => [...el].forEach(e => (e.style.display = '')); -module.exports = show; diff --git a/test/shuffle/shuffle.test.js b/test/shuffle.test.js similarity index 92% rename from test/shuffle/shuffle.test.js rename to test/shuffle.test.js index c71985f8e..9360ce237 100644 --- a/test/shuffle/shuffle.test.js +++ b/test/shuffle.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const shuffle = require('./shuffle.js'); +const {shuffle} = require('./_30s.js'); test('shuffle is a Function', () => { expect(shuffle).toBeInstanceOf(Function); diff --git a/test/shuffle/shuffle.js b/test/shuffle/shuffle.js deleted file mode 100644 index f03481f7a..000000000 --- a/test/shuffle/shuffle.js +++ /dev/null @@ -1,9 +0,0 @@ -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; -}; -module.exports = shuffle; diff --git a/test/similarity/similarity.test.js b/test/similarity.test.js similarity index 84% rename from test/similarity/similarity.test.js rename to test/similarity.test.js index 479c64b9c..5efd16e50 100644 --- a/test/similarity/similarity.test.js +++ b/test/similarity.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const similarity = require('./similarity.js'); +const {similarity} = require('./_30s.js'); test('similarity is a Function', () => { expect(similarity).toBeInstanceOf(Function); diff --git a/test/similarity/similarity.js b/test/similarity/similarity.js deleted file mode 100644 index 1614f82e4..000000000 --- a/test/similarity/similarity.js +++ /dev/null @@ -1,2 +0,0 @@ -const similarity = (arr, values) => arr.filter(v => values.includes(v)); -module.exports = similarity; diff --git a/test/size/size.test.js b/test/size.test.js similarity index 89% rename from test/size/size.test.js rename to test/size.test.js index 54622aa01..4a306faf5 100644 --- a/test/size/size.test.js +++ b/test/size.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const size = require('./size.js'); +const {size} = require('./_30s.js'); test('size is a Function', () => { expect(size).toBeInstanceOf(Function); diff --git a/test/size/size.js b/test/size/size.js deleted file mode 100644 index 88073bcb5..000000000 --- a/test/size/size.js +++ /dev/null @@ -1,9 +0,0 @@ -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; -module.exports = size; diff --git a/test/sleep/sleep.test.js b/test/sleep.test.js similarity index 86% rename from test/sleep/sleep.test.js rename to test/sleep.test.js index faff7c0f2..5dd0f9f6f 100644 --- a/test/sleep/sleep.test.js +++ b/test/sleep.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sleep = require('./sleep.js'); +const {sleep} = require('./_30s.js'); test('sleep is a Function', () => { expect(sleep).toBeInstanceOf(Function); diff --git a/test/sleep/sleep.js b/test/sleep/sleep.js deleted file mode 100644 index 56f452762..000000000 --- a/test/sleep/sleep.js +++ /dev/null @@ -1,2 +0,0 @@ -const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); -module.exports = sleep; diff --git a/test/smoothScroll/smoothScroll.test.js b/test/smoothScroll.test.js similarity index 71% rename from test/smoothScroll/smoothScroll.test.js rename to test/smoothScroll.test.js index 269e7252c..b8e60c56a 100644 --- a/test/smoothScroll/smoothScroll.test.js +++ b/test/smoothScroll.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const smoothScroll = require('./smoothScroll.js'); +const {smoothScroll} = require('./_30s.js'); test('smoothScroll is a Function', () => { expect(smoothScroll).toBeInstanceOf(Function); diff --git a/test/smoothScroll/smoothScroll.js b/test/smoothScroll/smoothScroll.js deleted file mode 100644 index ef93400af..000000000 --- a/test/smoothScroll/smoothScroll.js +++ /dev/null @@ -1,5 +0,0 @@ -const smoothScroll = element => - document.querySelector(element).scrollIntoView({ - behavior: 'smooth' - }); -module.exports = smoothScroll; diff --git a/test/solveRPN/solveRPN.test.js b/test/solveRPN.test.js similarity index 74% rename from test/solveRPN/solveRPN.test.js rename to test/solveRPN.test.js index c6a2fee8b..a2d942aed 100644 --- a/test/solveRPN/solveRPN.test.js +++ b/test/solveRPN.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const solveRPN = require('./solveRPN.js'); +const {solveRPN} = require('./_30s.js'); test('solveRPN is a Function', () => { expect(solveRPN).toBeInstanceOf(Function); diff --git a/test/solveRPN/solveRPN.js b/test/solveRPN/solveRPN.js deleted file mode 100644 index fec5b3b7e..000000000 --- a/test/solveRPN/solveRPN.js +++ /dev/null @@ -1,29 +0,0 @@ -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`; -}; -module.exports = solveRPN; diff --git a/test/sortCharactersInString/sortCharactersInString.test.js b/test/sortCharactersInString.test.js similarity index 79% rename from test/sortCharactersInString/sortCharactersInString.test.js rename to test/sortCharactersInString.test.js index 8979fe2b7..4fa845fe0 100644 --- a/test/sortCharactersInString/sortCharactersInString.test.js +++ b/test/sortCharactersInString.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sortCharactersInString = require('./sortCharactersInString.js'); +const {sortCharactersInString} = require('./_30s.js'); test('sortCharactersInString is a Function', () => { expect(sortCharactersInString).toBeInstanceOf(Function); diff --git a/test/sortCharactersInString/sortCharactersInString.js b/test/sortCharactersInString/sortCharactersInString.js deleted file mode 100644 index f92166670..000000000 --- a/test/sortCharactersInString/sortCharactersInString.js +++ /dev/null @@ -1,2 +0,0 @@ -const sortCharactersInString = str => [...str].sort((a, b) => a.localeCompare(b)).join(''); -module.exports = sortCharactersInString; diff --git a/test/sortedIndex/sortedIndex.test.js b/test/sortedIndex.test.js similarity index 90% rename from test/sortedIndex/sortedIndex.test.js rename to test/sortedIndex.test.js index 0bfe6ff39..bf1606098 100644 --- a/test/sortedIndex/sortedIndex.test.js +++ b/test/sortedIndex.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sortedIndex = require('./sortedIndex.js'); +const {sortedIndex} = require('./_30s.js'); test('sortedIndex is a Function', () => { expect(sortedIndex).toBeInstanceOf(Function); diff --git a/test/sortedIndex/sortedIndex.js b/test/sortedIndex/sortedIndex.js deleted file mode 100644 index 82d023c6a..000000000 --- a/test/sortedIndex/sortedIndex.js +++ /dev/null @@ -1,6 +0,0 @@ -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; -}; -module.exports = sortedIndex; diff --git a/test/sortedIndexBy/sortedIndexBy.test.js b/test/sortedIndexBy.test.js similarity index 85% rename from test/sortedIndexBy/sortedIndexBy.test.js rename to test/sortedIndexBy.test.js index 6e02b36a4..65545dd7f 100644 --- a/test/sortedIndexBy/sortedIndexBy.test.js +++ b/test/sortedIndexBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sortedIndexBy = require('./sortedIndexBy.js'); +const {sortedIndexBy} = require('./_30s.js'); test('sortedIndexBy is a Function', () => { expect(sortedIndexBy).toBeInstanceOf(Function); diff --git a/test/sortedIndexBy/sortedIndexBy.js b/test/sortedIndexBy/sortedIndexBy.js deleted file mode 100644 index 1a284e074..000000000 --- a/test/sortedIndexBy/sortedIndexBy.js +++ /dev/null @@ -1,7 +0,0 @@ -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; -}; -module.exports = sortedIndexBy; diff --git a/test/sortedLastIndex/sortedLastIndex.test.js b/test/sortedLastIndex.test.js similarity index 84% rename from test/sortedLastIndex/sortedLastIndex.test.js rename to test/sortedLastIndex.test.js index 84a9ff63a..789fcc188 100644 --- a/test/sortedLastIndex/sortedLastIndex.test.js +++ b/test/sortedLastIndex.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sortedLastIndex = require('./sortedLastIndex.js'); +const {sortedLastIndex} = require('./_30s.js'); test('sortedLastIndex is a Function', () => { expect(sortedLastIndex).toBeInstanceOf(Function); diff --git a/test/sortedLastIndex/sortedLastIndex.js b/test/sortedLastIndex/sortedLastIndex.js deleted file mode 100644 index 78cafda2a..000000000 --- a/test/sortedLastIndex/sortedLastIndex.js +++ /dev/null @@ -1,6 +0,0 @@ -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; -}; -module.exports = sortedLastIndex; diff --git a/test/sortedLastIndexBy/sortedLastIndexBy.test.js b/test/sortedLastIndexBy.test.js similarity index 84% rename from test/sortedLastIndexBy/sortedLastIndexBy.test.js rename to test/sortedLastIndexBy.test.js index ad0bfc718..8185bed93 100644 --- a/test/sortedLastIndexBy/sortedLastIndexBy.test.js +++ b/test/sortedLastIndexBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sortedLastIndexBy = require('./sortedLastIndexBy.js'); +const {sortedLastIndexBy} = require('./_30s.js'); test('sortedLastIndexBy is a Function', () => { expect(sortedLastIndexBy).toBeInstanceOf(Function); diff --git a/test/sortedLastIndexBy/sortedLastIndexBy.js b/test/sortedLastIndexBy/sortedLastIndexBy.js deleted file mode 100644 index d028f44b5..000000000 --- a/test/sortedLastIndexBy/sortedLastIndexBy.js +++ /dev/null @@ -1,10 +0,0 @@ -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; -}; -module.exports = sortedLastIndexBy; diff --git a/test/speechSynthesis/speechSynthesis.test.js b/test/speechSynthesis.test.js similarity index 70% rename from test/speechSynthesis/speechSynthesis.test.js rename to test/speechSynthesis.test.js index 9981924c8..e15907cf6 100644 --- a/test/speechSynthesis/speechSynthesis.test.js +++ b/test/speechSynthesis.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const speechSynthesis = require('./speechSynthesis.js'); +const {speechSynthesis} = require('./_30s.js'); test('speechSynthesis is a Function', () => { expect(speechSynthesis).toBeInstanceOf(Function); diff --git a/test/speechSynthesis/speechSynthesis.js b/test/speechSynthesis/speechSynthesis.js deleted file mode 100644 index 867f477ba..000000000 --- a/test/speechSynthesis/speechSynthesis.js +++ /dev/null @@ -1,6 +0,0 @@ -const speechSynthesis = message => { - const msg = new SpeechSynthesisUtterance(message); - msg.voice = window.speechSynthesis.getVoices()[0]; - window.speechSynthesis.speak(msg); -}; -module.exports = speechSynthesis; diff --git a/test/splitLines/splitLines.test.js b/test/splitLines.test.js similarity index 87% rename from test/splitLines/splitLines.test.js rename to test/splitLines.test.js index c35d956b9..4788486f3 100644 --- a/test/splitLines/splitLines.test.js +++ b/test/splitLines.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const splitLines = require('./splitLines.js'); +const {splitLines} = require('./_30s.js'); test('splitLines is a Function', () => { expect(splitLines).toBeInstanceOf(Function); diff --git a/test/splitLines/splitLines.js b/test/splitLines/splitLines.js deleted file mode 100644 index fc73cabe0..000000000 --- a/test/splitLines/splitLines.js +++ /dev/null @@ -1,2 +0,0 @@ -const splitLines = str => str.split(/\r?\n/); -module.exports = splitLines; diff --git a/test/spreadOver/spreadOver.test.js b/test/spreadOver.test.js similarity index 88% rename from test/spreadOver/spreadOver.test.js rename to test/spreadOver.test.js index 7f101c1d9..f1b8d30b5 100644 --- a/test/spreadOver/spreadOver.test.js +++ b/test/spreadOver.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const spreadOver = require('./spreadOver.js'); +const {spreadOver} = require('./_30s.js'); test('spreadOver is a Function', () => { expect(spreadOver).toBeInstanceOf(Function); diff --git a/test/spreadOver/spreadOver.js b/test/spreadOver/spreadOver.js deleted file mode 100644 index e84eb8060..000000000 --- a/test/spreadOver/spreadOver.js +++ /dev/null @@ -1,2 +0,0 @@ -const spreadOver = fn => argsArr => fn(...argsArr); -module.exports = spreadOver; diff --git a/test/stableSort/stableSort.test.js b/test/stableSort.test.js similarity index 86% rename from test/stableSort/stableSort.test.js rename to test/stableSort.test.js index 4c2f3a37b..903cea229 100644 --- a/test/stableSort/stableSort.test.js +++ b/test/stableSort.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const stableSort = require('./stableSort.js'); +const {stableSort} = require('./_30s.js'); test('stableSort is a Function', () => { expect(stableSort).toBeInstanceOf(Function); diff --git a/test/stableSort/stableSort.js b/test/stableSort/stableSort.js deleted file mode 100644 index dc75cd83d..000000000 --- a/test/stableSort/stableSort.js +++ /dev/null @@ -1,6 +0,0 @@ -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); -module.exports = stableSort; diff --git a/test/standardDeviation/standardDeviation.test.js b/test/standardDeviation.test.js similarity index 88% rename from test/standardDeviation/standardDeviation.test.js rename to test/standardDeviation.test.js index 2836df632..0f5d68394 100644 --- a/test/standardDeviation/standardDeviation.test.js +++ b/test/standardDeviation.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const standardDeviation = require('./standardDeviation.js'); +const {standardDeviation} = require('./_30s.js'); test('standardDeviation is a Function', () => { expect(standardDeviation).toBeInstanceOf(Function); diff --git a/test/standardDeviation/standardDeviation.js b/test/standardDeviation/standardDeviation.js deleted file mode 100644 index b698e7826..000000000 --- a/test/standardDeviation/standardDeviation.js +++ /dev/null @@ -1,8 +0,0 @@ -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)) - ); -}; -module.exports = standardDeviation; diff --git a/test/stringPermutations/stringPermutations.test.js b/test/stringPermutations.test.js similarity index 88% rename from test/stringPermutations/stringPermutations.test.js rename to test/stringPermutations.test.js index 80019e110..5ff4586f6 100644 --- a/test/stringPermutations/stringPermutations.test.js +++ b/test/stringPermutations.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const stringPermutations = require('./stringPermutations.js'); +const {stringPermutations} = require('./_30s.js'); test('stringPermutations is a Function', () => { expect(stringPermutations).toBeInstanceOf(Function); diff --git a/test/stringPermutations/stringPermutations.js b/test/stringPermutations/stringPermutations.js deleted file mode 100644 index 5f5c613b6..000000000 --- a/test/stringPermutations/stringPermutations.js +++ /dev/null @@ -1,11 +0,0 @@ -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)), - [] - ); -}; -module.exports = stringPermutations; diff --git a/test/stripHTMLTags/stripHTMLTags.test.js b/test/stripHTMLTags.test.js similarity index 84% rename from test/stripHTMLTags/stripHTMLTags.test.js rename to test/stripHTMLTags.test.js index 1543517a2..67eabfd4e 100644 --- a/test/stripHTMLTags/stripHTMLTags.test.js +++ b/test/stripHTMLTags.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const stripHTMLTags = require('./stripHTMLTags.js'); +const {stripHTMLTags} = require('./_30s.js'); test('stripHTMLTags is a Function', () => { expect(stripHTMLTags).toBeInstanceOf(Function); diff --git a/test/stripHTMLTags/stripHTMLTags.js b/test/stripHTMLTags/stripHTMLTags.js deleted file mode 100644 index 1106c81f0..000000000 --- a/test/stripHTMLTags/stripHTMLTags.js +++ /dev/null @@ -1,2 +0,0 @@ -const stripHTMLTags = str => str.replace(/<[^>]*>/g, ''); -module.exports = stripHTMLTags; diff --git a/test/sum/sum.test.js b/test/sum.test.js similarity index 85% rename from test/sum/sum.test.js rename to test/sum.test.js index ac94b8891..e1f8c846d 100644 --- a/test/sum/sum.test.js +++ b/test/sum.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sum = require('./sum.js'); +const {sum} = require('./_30s.js'); test('sum is a Function', () => { expect(sum).toBeInstanceOf(Function); diff --git a/test/sum/sum.js b/test/sum/sum.js deleted file mode 100644 index 64a39052e..000000000 --- a/test/sum/sum.js +++ /dev/null @@ -1,2 +0,0 @@ -const sum = (...arr) => [...arr].reduce((acc, val) => acc + val, 0); -module.exports = sum; diff --git a/test/sumBy/sumBy.test.js b/test/sumBy.test.js similarity index 75% rename from test/sumBy/sumBy.test.js rename to test/sumBy.test.js index 07e8c2b17..3fcd55f68 100644 --- a/test/sumBy/sumBy.test.js +++ b/test/sumBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sumBy = require('./sumBy.js'); +const {sumBy} = require('./_30s.js'); test('sumBy is a Function', () => { expect(sumBy).toBeInstanceOf(Function); diff --git a/test/sumBy/sumBy.js b/test/sumBy/sumBy.js deleted file mode 100644 index 8d6466d6b..000000000 --- a/test/sumBy/sumBy.js +++ /dev/null @@ -1,3 +0,0 @@ -const sumBy = (arr, fn) => - arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0); -module.exports = sumBy; diff --git a/test/sumPower/sumPower.test.js b/test/sumPower.test.js similarity index 92% rename from test/sumPower/sumPower.test.js rename to test/sumPower.test.js index b655fe974..7f48c8a8d 100644 --- a/test/sumPower/sumPower.test.js +++ b/test/sumPower.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const sumPower = require('./sumPower.js'); +const {sumPower} = require('./_30s.js'); test('sumPower is a Function', () => { expect(sumPower).toBeInstanceOf(Function); diff --git a/test/sumPower/sumPower.js b/test/sumPower/sumPower.js deleted file mode 100644 index 3537e8825..000000000 --- a/test/sumPower/sumPower.js +++ /dev/null @@ -1,6 +0,0 @@ -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); -module.exports = sumPower; diff --git a/test/symmetricDifference/symmetricDifference.test.js b/test/symmetricDifference.test.js similarity index 86% rename from test/symmetricDifference/symmetricDifference.test.js rename to test/symmetricDifference.test.js index c96e3b5a6..7a8ed8607 100644 --- a/test/symmetricDifference/symmetricDifference.test.js +++ b/test/symmetricDifference.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const symmetricDifference = require('./symmetricDifference.js'); +const {symmetricDifference} = require('./_30s.js'); test('symmetricDifference is a Function', () => { expect(symmetricDifference).toBeInstanceOf(Function); diff --git a/test/symmetricDifference/symmetricDifference.js b/test/symmetricDifference/symmetricDifference.js deleted file mode 100644 index f84ccc299..000000000 --- a/test/symmetricDifference/symmetricDifference.js +++ /dev/null @@ -1,6 +0,0 @@ -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))]; -}; -module.exports = symmetricDifference; diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js b/test/symmetricDifferenceBy.test.js similarity index 84% rename from test/symmetricDifferenceBy/symmetricDifferenceBy.test.js rename to test/symmetricDifferenceBy.test.js index 526ed9f50..064ad28cc 100644 --- a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js +++ b/test/symmetricDifferenceBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const symmetricDifferenceBy = require('./symmetricDifferenceBy.js'); +const {symmetricDifferenceBy} = require('./_30s.js'); test('symmetricDifferenceBy is a Function', () => { expect(symmetricDifferenceBy).toBeInstanceOf(Function); diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.js deleted file mode 100644 index e2eef5b34..000000000 --- a/test/symmetricDifferenceBy/symmetricDifferenceBy.js +++ /dev/null @@ -1,6 +0,0 @@ -const symmetricDifferenceBy = (a, b, fn) => { - const sA = new Set(a.map(v => fn(v))), - sB = new Set(b.map(v => fn(v))); - return [...a.filter(x => !sB.has(fn(x))), ...b.filter(x => !sA.has(fn(x)))]; -}; -module.exports = symmetricDifferenceBy; diff --git a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js b/test/symmetricDifferenceWith.test.js similarity index 85% rename from test/symmetricDifferenceWith/symmetricDifferenceWith.test.js rename to test/symmetricDifferenceWith.test.js index 44c7a4a3c..8d50e4e46 100644 --- a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js +++ b/test/symmetricDifferenceWith.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const symmetricDifferenceWith = require('./symmetricDifferenceWith.js'); +const {symmetricDifferenceWith} = require('./_30s.js'); test('symmetricDifferenceWith is a Function', () => { expect(symmetricDifferenceWith).toBeInstanceOf(Function); diff --git a/test/symmetricDifferenceWith/symmetricDifferenceWith.js b/test/symmetricDifferenceWith/symmetricDifferenceWith.js deleted file mode 100644 index 15e99a32f..000000000 --- a/test/symmetricDifferenceWith/symmetricDifferenceWith.js +++ /dev/null @@ -1,5 +0,0 @@ -const symmetricDifferenceWith = (arr, val, comp) => [ - ...arr.filter(a => val.findIndex(b => comp(a, b)) === -1), - ...val.filter(a => arr.findIndex(b => comp(a, b)) === -1) -]; -module.exports = symmetricDifferenceWith; diff --git a/test/tail/tail.test.js b/test/tail.test.js similarity index 87% rename from test/tail/tail.test.js rename to test/tail.test.js index e38eb7d37..e71cdcf10 100644 --- a/test/tail/tail.test.js +++ b/test/tail.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const tail = require('./tail.js'); +const {tail} = require('./_30s.js'); test('tail is a Function', () => { expect(tail).toBeInstanceOf(Function); diff --git a/test/tail/tail.js b/test/tail/tail.js deleted file mode 100644 index 25b3a5fd1..000000000 --- a/test/tail/tail.js +++ /dev/null @@ -1,2 +0,0 @@ -const tail = arr => (arr.length > 1 ? arr.slice(1) : arr); -module.exports = tail; diff --git a/test/take/take.test.js b/test/take.test.js similarity index 90% rename from test/take/take.test.js rename to test/take.test.js index 6621a5176..7506eea2d 100644 --- a/test/take/take.test.js +++ b/test/take.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const take = require('./take.js'); +const {take} = require('./_30s.js'); test('take is a Function', () => { expect(take).toBeInstanceOf(Function); diff --git a/test/take/take.js b/test/take/take.js deleted file mode 100644 index d6057a021..000000000 --- a/test/take/take.js +++ /dev/null @@ -1,2 +0,0 @@ -const take = (arr, n = 1) => arr.slice(0, n); -module.exports = take; diff --git a/test/takeRight/takeRight.test.js b/test/takeRight.test.js similarity index 89% rename from test/takeRight/takeRight.test.js rename to test/takeRight.test.js index b31c99d8d..075ca4bdd 100644 --- a/test/takeRight/takeRight.test.js +++ b/test/takeRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const takeRight = require('./takeRight.js'); +const {takeRight} = require('./_30s.js'); test('takeRight is a Function', () => { expect(takeRight).toBeInstanceOf(Function); diff --git a/test/takeRight/takeRight.js b/test/takeRight/takeRight.js deleted file mode 100644 index d847cc73b..000000000 --- a/test/takeRight/takeRight.js +++ /dev/null @@ -1,2 +0,0 @@ -const takeRight = (arr, n = 1) => arr.slice(arr.length - n, arr.length); -module.exports = takeRight; diff --git a/test/takeRightWhile/takeRightWhile.test.js b/test/takeRightWhile.test.js similarity index 83% rename from test/takeRightWhile/takeRightWhile.test.js rename to test/takeRightWhile.test.js index 9730677d9..90f52e510 100644 --- a/test/takeRightWhile/takeRightWhile.test.js +++ b/test/takeRightWhile.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const takeRightWhile = require('./takeRightWhile.js'); +const {takeRightWhile} = require('./_30s.js'); test('takeRightWhile is a Function', () => { expect(takeRightWhile).toBeInstanceOf(Function); diff --git a/test/takeRightWhile/takeRightWhile.js b/test/takeRightWhile/takeRightWhile.js deleted file mode 100644 index b01512663..000000000 --- a/test/takeRightWhile/takeRightWhile.js +++ /dev/null @@ -1,3 +0,0 @@ -const takeRightWhile = (arr, func) => - arr.reduceRight((acc, el) => (func(el) ? acc : [el, ...acc]), []); -module.exports = takeRightWhile; diff --git a/test/takeWhile/takeWhile.test.js b/test/takeWhile.test.js similarity index 85% rename from test/takeWhile/takeWhile.test.js rename to test/takeWhile.test.js index bdc14c586..b726f5e6e 100644 --- a/test/takeWhile/takeWhile.test.js +++ b/test/takeWhile.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const takeWhile = require('./takeWhile.js'); +const {takeWhile} = require('./_30s.js'); test('takeWhile is a Function', () => { expect(takeWhile).toBeInstanceOf(Function); diff --git a/test/takeWhile/takeWhile.js b/test/takeWhile/takeWhile.js deleted file mode 100644 index 2263afeec..000000000 --- a/test/takeWhile/takeWhile.js +++ /dev/null @@ -1,5 +0,0 @@ -const takeWhile = (arr, func) => { - for (const [i, val] of arr.entries()) if (func(val)) return arr.slice(0, i); - return arr; -}; -module.exports = takeWhile; diff --git a/test/throttle/throttle.test.js b/test/throttle.test.js similarity index 74% rename from test/throttle/throttle.test.js rename to test/throttle.test.js index 6f73087c6..646e93fa3 100644 --- a/test/throttle/throttle.test.js +++ b/test/throttle.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const throttle = require('./throttle.js'); +const {throttle} = require('./_30s.js'); test('throttle is a Function', () => { expect(throttle).toBeInstanceOf(Function); diff --git a/test/throttle/throttle.js b/test/throttle/throttle.js deleted file mode 100644 index 2ed612018..000000000 --- a/test/throttle/throttle.js +++ /dev/null @@ -1,21 +0,0 @@ -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)); - } - }; -}; -module.exports = throttle; diff --git a/test/timeTaken/timeTaken.test.js b/test/timeTaken.test.js similarity index 73% rename from test/timeTaken/timeTaken.test.js rename to test/timeTaken.test.js index fe67c4284..72436f8b6 100644 --- a/test/timeTaken/timeTaken.test.js +++ b/test/timeTaken.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const timeTaken = require('./timeTaken.js'); +const {timeTaken} = require('./_30s.js'); test('timeTaken is a Function', () => { expect(timeTaken).toBeInstanceOf(Function); diff --git a/test/timeTaken/timeTaken.js b/test/timeTaken/timeTaken.js deleted file mode 100644 index 96cab458b..000000000 --- a/test/timeTaken/timeTaken.js +++ /dev/null @@ -1,7 +0,0 @@ -const timeTaken = callback => { - console.time('timeTaken'); - const r = callback(); - console.timeEnd('timeTaken'); - return r; -}; -module.exports = timeTaken; diff --git a/test/times/times.test.js b/test/times.test.js similarity index 87% rename from test/times/times.test.js rename to test/times.test.js index e5108af66..c5c9c2ca8 100644 --- a/test/times/times.test.js +++ b/test/times.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const times = require('./times.js'); +const {times} = require('./_30s.js'); test('times is a Function', () => { expect(times).toBeInstanceOf(Function); diff --git a/test/times/times.js b/test/times/times.js deleted file mode 100644 index cb1402553..000000000 --- a/test/times/times.js +++ /dev/null @@ -1,5 +0,0 @@ -const times = (n, fn, context = undefined) => { - let i = 0; - while (fn.call(context, i) !== false && ++i < n) {} -}; -module.exports = times; diff --git a/test/toCamelCase/toCamelCase.test.js b/test/toCamelCase.test.js similarity index 97% rename from test/toCamelCase/toCamelCase.test.js rename to test/toCamelCase.test.js index 4681dbe9c..1e01c70ad 100644 --- a/test/toCamelCase/toCamelCase.test.js +++ b/test/toCamelCase.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toCamelCase = require('./toCamelCase.js'); +const {toCamelCase} = require('./_30s.js'); test('toCamelCase is a Function', () => { expect(toCamelCase).toBeInstanceOf(Function); diff --git a/test/toCamelCase/toCamelCase.js b/test/toCamelCase/toCamelCase.js deleted file mode 100644 index edc309d0f..000000000 --- a/test/toCamelCase/toCamelCase.js +++ /dev/null @@ -1,10 +0,0 @@ -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); -}; -module.exports = toCamelCase; diff --git a/test/toCurrency/toCurrency.test.js b/test/toCurrency.test.js similarity index 93% rename from test/toCurrency/toCurrency.test.js rename to test/toCurrency.test.js index 9f0aa3fdb..daa1624f3 100644 --- a/test/toCurrency/toCurrency.test.js +++ b/test/toCurrency.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toCurrency = require('./toCurrency.js'); +const {toCurrency} = require('./_30s.js'); test('toCurrency is a Function', () => { expect(toCurrency).toBeInstanceOf(Function); diff --git a/test/toCurrency/toCurrency.js b/test/toCurrency/toCurrency.js deleted file mode 100644 index 698ad39f2..000000000 --- a/test/toCurrency/toCurrency.js +++ /dev/null @@ -1,3 +0,0 @@ -const toCurrency = (n, curr, LanguageFormat = undefined) => - Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n); -module.exports = toCurrency; diff --git a/test/toDecimalMark/toDecimalMark.test.js b/test/toDecimalMark.test.js similarity index 84% rename from test/toDecimalMark/toDecimalMark.test.js rename to test/toDecimalMark.test.js index 8b287fdbb..eafee7a46 100644 --- a/test/toDecimalMark/toDecimalMark.test.js +++ b/test/toDecimalMark.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toDecimalMark = require('./toDecimalMark.js'); +const {toDecimalMark} = require('./_30s.js'); test('toDecimalMark is a Function', () => { expect(toDecimalMark).toBeInstanceOf(Function); diff --git a/test/toDecimalMark/toDecimalMark.js b/test/toDecimalMark/toDecimalMark.js deleted file mode 100644 index 839d2b25b..000000000 --- a/test/toDecimalMark/toDecimalMark.js +++ /dev/null @@ -1,2 +0,0 @@ -const toDecimalMark = num => num.toLocaleString('en-US'); -module.exports = toDecimalMark; diff --git a/test/toHash/toHash.test.js b/test/toHash.test.js similarity index 75% rename from test/toHash/toHash.test.js rename to test/toHash.test.js index 27c2b4e2a..7913d0591 100644 --- a/test/toHash/toHash.test.js +++ b/test/toHash.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toHash = require('./toHash.js'); +const {toHash} = require('./_30s.js'); test('toHash is a Function', () => { expect(toHash).toBeInstanceOf(Function); diff --git a/test/toHash/toHash.js b/test/toHash/toHash.js deleted file mode 100644 index d2a89a847..000000000 --- a/test/toHash/toHash.js +++ /dev/null @@ -1,7 +0,0 @@ -const toHash = (object, key) => - Array.prototype.reduce.call( - object, - (acc, data, index) => ((acc[!key ? index : data[key]] = data), acc), - {} - ); -module.exports = toHash; diff --git a/test/toKebabCase/toKebabCase.test.js b/test/toKebabCase.test.js similarity index 97% rename from test/toKebabCase/toKebabCase.test.js rename to test/toKebabCase.test.js index 38017653e..96df7e01f 100644 --- a/test/toKebabCase/toKebabCase.test.js +++ b/test/toKebabCase.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toKebabCase = require('./toKebabCase.js'); +const {toKebabCase} = require('./_30s.js'); test('toKebabCase is a Function', () => { expect(toKebabCase).toBeInstanceOf(Function); diff --git a/test/toKebabCase/toKebabCase.js b/test/toKebabCase/toKebabCase.js deleted file mode 100644 index 53e3c8c7f..000000000 --- a/test/toKebabCase/toKebabCase.js +++ /dev/null @@ -1,7 +0,0 @@ -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('-'); -module.exports = toKebabCase; diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.test.js b/test/toOrdinalSuffix.test.js similarity index 90% rename from test/toOrdinalSuffix/toOrdinalSuffix.test.js rename to test/toOrdinalSuffix.test.js index 8bdcb11ac..20e3b7340 100644 --- a/test/toOrdinalSuffix/toOrdinalSuffix.test.js +++ b/test/toOrdinalSuffix.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toOrdinalSuffix = require('./toOrdinalSuffix.js'); +const {toOrdinalSuffix} = require('./_30s.js'); test('toOrdinalSuffix is a Function', () => { expect(toOrdinalSuffix).toBeInstanceOf(Function); diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.js b/test/toOrdinalSuffix/toOrdinalSuffix.js deleted file mode 100644 index 85dcb7b53..000000000 --- a/test/toOrdinalSuffix/toOrdinalSuffix.js +++ /dev/null @@ -1,11 +0,0 @@ -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]; -}; -module.exports = toOrdinalSuffix; diff --git a/test/toSafeInteger/toSafeInteger.test.js b/test/toSafeInteger.test.js similarity index 96% rename from test/toSafeInteger/toSafeInteger.test.js rename to test/toSafeInteger.test.js index 634d6484f..1706ec306 100644 --- a/test/toSafeInteger/toSafeInteger.test.js +++ b/test/toSafeInteger.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toSafeInteger = require('./toSafeInteger.js'); +const {toSafeInteger} = require('./_30s.js'); test('toSafeInteger is a Function', () => { expect(toSafeInteger).toBeInstanceOf(Function); diff --git a/test/toSafeInteger/toSafeInteger.js b/test/toSafeInteger/toSafeInteger.js deleted file mode 100644 index f8408387f..000000000 --- a/test/toSafeInteger/toSafeInteger.js +++ /dev/null @@ -1,3 +0,0 @@ -const toSafeInteger = num => - Math.round(Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER)); -module.exports = toSafeInteger; diff --git a/test/toSnakeCase/toSnakeCase.test.js b/test/toSnakeCase.test.js similarity index 97% rename from test/toSnakeCase/toSnakeCase.test.js rename to test/toSnakeCase.test.js index a07405ee0..53f3ec7d1 100644 --- a/test/toSnakeCase/toSnakeCase.test.js +++ b/test/toSnakeCase.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toSnakeCase = require('./toSnakeCase.js'); +const {toSnakeCase} = require('./_30s.js'); test('toSnakeCase is a Function', () => { expect(toSnakeCase).toBeInstanceOf(Function); diff --git a/test/toSnakeCase/toSnakeCase.js b/test/toSnakeCase/toSnakeCase.js deleted file mode 100644 index 86c59cbb7..000000000 --- a/test/toSnakeCase/toSnakeCase.js +++ /dev/null @@ -1,7 +0,0 @@ -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('_'); -module.exports = toSnakeCase; diff --git a/test/toggleClass/toggleClass.test.js b/test/toggleClass.test.js similarity index 72% rename from test/toggleClass/toggleClass.test.js rename to test/toggleClass.test.js index 7c0be8524..2ec708391 100644 --- a/test/toggleClass/toggleClass.test.js +++ b/test/toggleClass.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const toggleClass = require('./toggleClass.js'); +const {toggleClass} = require('./_30s.js'); test('toggleClass is a Function', () => { expect(toggleClass).toBeInstanceOf(Function); diff --git a/test/toggleClass/toggleClass.js b/test/toggleClass/toggleClass.js deleted file mode 100644 index 61362e885..000000000 --- a/test/toggleClass/toggleClass.js +++ /dev/null @@ -1,2 +0,0 @@ -const toggleClass = (el, className) => el.classList.toggle(className); -module.exports = toggleClass; diff --git a/test/tomorrow/tomorrow.test.js b/test/tomorrow.test.js similarity index 92% rename from test/tomorrow/tomorrow.test.js rename to test/tomorrow.test.js index 4827289c8..96c2a15e2 100644 --- a/test/tomorrow/tomorrow.test.js +++ b/test/tomorrow.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const tomorrow = require('./tomorrow.js'); +const {tomorrow} = require('./_30s.js'); test('tomorrow is a Function', () => { expect(tomorrow).toBeInstanceOf(Function); diff --git a/test/tomorrow/tomorrow.js b/test/tomorrow/tomorrow.js deleted file mode 100644 index a78e50b47..000000000 --- a/test/tomorrow/tomorrow.js +++ /dev/null @@ -1,9 +0,0 @@ -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`; -}; -module.exports = tomorrow; diff --git a/test/transform/transform.test.js b/test/transform.test.js similarity index 89% rename from test/transform/transform.test.js rename to test/transform.test.js index 075e8345b..b134472f6 100644 --- a/test/transform/transform.test.js +++ b/test/transform.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const transform = require('./transform.js'); +const {transform} = require('./_30s.js'); test('transform is a Function', () => { expect(transform).toBeInstanceOf(Function); diff --git a/test/transform/transform.js b/test/transform/transform.js deleted file mode 100644 index 6381c797b..000000000 --- a/test/transform/transform.js +++ /dev/null @@ -1,2 +0,0 @@ -const transform = (obj, fn, acc) => Object.keys(obj).reduce((a, k) => fn(a, obj[k], k, obj), acc); -module.exports = transform; diff --git a/test/triggerEvent/triggerEvent.test.js b/test/triggerEvent.test.js similarity index 71% rename from test/triggerEvent/triggerEvent.test.js rename to test/triggerEvent.test.js index 02f0a0e18..13df31d08 100644 --- a/test/triggerEvent/triggerEvent.test.js +++ b/test/triggerEvent.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const triggerEvent = require('./triggerEvent.js'); +const {triggerEvent} = require('./_30s.js'); test('triggerEvent is a Function', () => { expect(triggerEvent).toBeInstanceOf(Function); diff --git a/test/triggerEvent/triggerEvent.js b/test/triggerEvent/triggerEvent.js deleted file mode 100644 index 8c6b1afd6..000000000 --- a/test/triggerEvent/triggerEvent.js +++ /dev/null @@ -1,3 +0,0 @@ -const triggerEvent = (el, eventType, detail) => - el.dispatchEvent(new CustomEvent(eventType, { detail })); -module.exports = triggerEvent; diff --git a/test/truncateString/truncateString.test.js b/test/truncateString.test.js similarity index 82% rename from test/truncateString/truncateString.test.js rename to test/truncateString.test.js index bcbf57a6a..355547b84 100644 --- a/test/truncateString/truncateString.test.js +++ b/test/truncateString.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const truncateString = require('./truncateString.js'); +const {truncateString} = require('./_30s.js'); test('truncateString is a Function', () => { expect(truncateString).toBeInstanceOf(Function); diff --git a/test/truncateString/truncateString.js b/test/truncateString/truncateString.js deleted file mode 100644 index a251353e3..000000000 --- a/test/truncateString/truncateString.js +++ /dev/null @@ -1,3 +0,0 @@ -const truncateString = (str, num) => - str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; -module.exports = truncateString; diff --git a/test/truthCheckCollection/truthCheckCollection.test.js b/test/truthCheckCollection.test.js similarity index 84% rename from test/truthCheckCollection/truthCheckCollection.test.js rename to test/truthCheckCollection.test.js index c25b5abdb..5f1ddfeb5 100644 --- a/test/truthCheckCollection/truthCheckCollection.test.js +++ b/test/truthCheckCollection.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const truthCheckCollection = require('./truthCheckCollection.js'); +const {truthCheckCollection} = require('./_30s.js'); test('truthCheckCollection is a Function', () => { expect(truthCheckCollection).toBeInstanceOf(Function); diff --git a/test/truthCheckCollection/truthCheckCollection.js b/test/truthCheckCollection/truthCheckCollection.js deleted file mode 100644 index 4308926ac..000000000 --- a/test/truthCheckCollection/truthCheckCollection.js +++ /dev/null @@ -1,2 +0,0 @@ -const truthCheckCollection = (collection, pre) => collection.every(obj => obj[pre]); -module.exports = truthCheckCollection; diff --git a/test/unary/unary.test.js b/test/unary.test.js similarity index 86% rename from test/unary/unary.test.js rename to test/unary.test.js index 791924bfc..6503aab98 100644 --- a/test/unary/unary.test.js +++ b/test/unary.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unary = require('./unary.js'); +const {unary} = require('./_30s.js'); test('unary is a Function', () => { expect(unary).toBeInstanceOf(Function); diff --git a/test/unary/unary.js b/test/unary/unary.js deleted file mode 100644 index 9dda10708..000000000 --- a/test/unary/unary.js +++ /dev/null @@ -1,2 +0,0 @@ -const unary = fn => val => fn(val); -module.exports = unary; diff --git a/test/uncurry/uncurry.test.js b/test/uncurry.test.js similarity index 92% rename from test/uncurry/uncurry.test.js rename to test/uncurry.test.js index 8a5eb4751..8e298929a 100644 --- a/test/uncurry/uncurry.test.js +++ b/test/uncurry.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const uncurry = require('./uncurry.js'); +const {uncurry} = require('./_30s.js'); test('uncurry is a Function', () => { expect(uncurry).toBeInstanceOf(Function); diff --git a/test/uncurry/uncurry.js b/test/uncurry/uncurry.js deleted file mode 100644 index f3bd5e58a..000000000 --- a/test/uncurry/uncurry.js +++ /dev/null @@ -1,6 +0,0 @@ -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)); -}; -module.exports = uncurry; diff --git a/test/unescapeHTML/unescapeHTML.test.js b/test/unescapeHTML.test.js similarity index 85% rename from test/unescapeHTML/unescapeHTML.test.js rename to test/unescapeHTML.test.js index 10237de0b..99248c078 100644 --- a/test/unescapeHTML/unescapeHTML.test.js +++ b/test/unescapeHTML.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unescapeHTML = require('./unescapeHTML.js'); +const {unescapeHTML} = require('./_30s.js'); test('unescapeHTML is a Function', () => { expect(unescapeHTML).toBeInstanceOf(Function); diff --git a/test/unescapeHTML/unescapeHTML.js b/test/unescapeHTML/unescapeHTML.js deleted file mode 100644 index 43ffa0bf9..000000000 --- a/test/unescapeHTML/unescapeHTML.js +++ /dev/null @@ -1,13 +0,0 @@ -const unescapeHTML = str => - str.replace( - /&|<|>|'|"/g, - tag => - ({ - '&': '&', - '<': '<', - '>': '>', - ''': "'", - '"': '"' - }[tag] || tag) - ); -module.exports = unescapeHTML; diff --git a/test/unflattenObject/unflattenObject.test.js b/test/unflattenObject.test.js similarity index 83% rename from test/unflattenObject/unflattenObject.test.js rename to test/unflattenObject.test.js index 743524974..170f07e0b 100644 --- a/test/unflattenObject/unflattenObject.test.js +++ b/test/unflattenObject.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unflattenObject = require('./unflattenObject.js'); +const {unflattenObject} = require('./_30s.js'); test('unflattenObject is a Function', () => { expect(unflattenObject).toBeInstanceOf(Function); diff --git a/test/unflattenObject/unflattenObject.js b/test/unflattenObject/unflattenObject.js deleted file mode 100644 index 9b52bad26..000000000 --- a/test/unflattenObject/unflattenObject.js +++ /dev/null @@ -1,17 +0,0 @@ -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; - }, {}); -module.exports = unflattenObject; diff --git a/test/unfold/unfold.test.js b/test/unfold.test.js similarity index 88% rename from test/unfold/unfold.test.js rename to test/unfold.test.js index b8eb61ac7..619dc43d0 100644 --- a/test/unfold/unfold.test.js +++ b/test/unfold.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unfold = require('./unfold.js'); +const {unfold} = require('./_30s.js'); test('unfold is a Function', () => { expect(unfold).toBeInstanceOf(Function); diff --git a/test/unfold/unfold.js b/test/unfold/unfold.js deleted file mode 100644 index 1f8d84437..000000000 --- a/test/unfold/unfold.js +++ /dev/null @@ -1,7 +0,0 @@ -const unfold = (fn, seed) => { - let result = [], - val = [null, seed]; - while ((val = fn(val[1]))) result.push(val[0]); - return result; -}; -module.exports = unfold; diff --git a/test/union/union.test.js b/test/union.test.js similarity index 97% rename from test/union/union.test.js rename to test/union.test.js index 40e0a690c..93baa5ac7 100644 --- a/test/union/union.test.js +++ b/test/union.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const union = require('./union.js'); +const {union} = require('./_30s.js'); test('union is a Function', () => { expect(union).toBeInstanceOf(Function); diff --git a/test/union/union.js b/test/union/union.js deleted file mode 100644 index c10144580..000000000 --- a/test/union/union.js +++ /dev/null @@ -1,2 +0,0 @@ -const union = (a, b) => Array.from(new Set([...a, ...b])); -module.exports = union; diff --git a/test/unionBy/unionBy.test.js b/test/unionBy.test.js similarity index 85% rename from test/unionBy/unionBy.test.js rename to test/unionBy.test.js index e4f5ed98b..e92e37715 100644 --- a/test/unionBy/unionBy.test.js +++ b/test/unionBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unionBy = require('./unionBy.js'); +const {unionBy} = require('./_30s.js'); test('unionBy is a Function', () => { expect(unionBy).toBeInstanceOf(Function); diff --git a/test/unionBy/unionBy.js b/test/unionBy/unionBy.js deleted file mode 100644 index 86d52180c..000000000 --- a/test/unionBy/unionBy.js +++ /dev/null @@ -1,5 +0,0 @@ -const unionBy = (a, b, fn) => { - const s = new Set(a.map(v => fn(v))); - return Array.from(new Set([...a, ...b.filter(x => !s.has(fn(x)))])); -}; -module.exports = unionBy; diff --git a/test/unionWith/unionWith.test.js b/test/unionWith.test.js similarity index 87% rename from test/unionWith/unionWith.test.js rename to test/unionWith.test.js index 4ad85edeb..f372b4ace 100644 --- a/test/unionWith/unionWith.test.js +++ b/test/unionWith.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unionWith = require('./unionWith.js'); +const {unionWith} = require('./_30s.js'); test('unionWith is a Function', () => { expect(unionWith).toBeInstanceOf(Function); diff --git a/test/unionWith/unionWith.js b/test/unionWith/unionWith.js deleted file mode 100644 index 1faa0a847..000000000 --- a/test/unionWith/unionWith.js +++ /dev/null @@ -1,3 +0,0 @@ -const unionWith = (a, b, comp) => - Array.from(new Set([...a, ...b.filter(x => a.findIndex(y => comp(x, y)) === -1)])); -module.exports = unionWith; diff --git a/test/uniqueElements/uniqueElements.test.js b/test/uniqueElements.test.js similarity index 97% rename from test/uniqueElements/uniqueElements.test.js rename to test/uniqueElements.test.js index 9b28a5be9..52ae8bd3b 100644 --- a/test/uniqueElements/uniqueElements.test.js +++ b/test/uniqueElements.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const uniqueElements = require('./uniqueElements.js'); +const {uniqueElements} = require('./_30s.js'); test('uniqueElements is a Function', () => { expect(uniqueElements).toBeInstanceOf(Function); diff --git a/test/uniqueElements/uniqueElements.js b/test/uniqueElements/uniqueElements.js deleted file mode 100644 index 17da4091f..000000000 --- a/test/uniqueElements/uniqueElements.js +++ /dev/null @@ -1,2 +0,0 @@ -const uniqueElements = arr => [...new Set(arr)]; -module.exports = uniqueElements; diff --git a/test/uniqueElementsBy/uniqueElementsBy.test.js b/test/uniqueElementsBy.test.js similarity index 94% rename from test/uniqueElementsBy/uniqueElementsBy.test.js rename to test/uniqueElementsBy.test.js index 5ff75d831..256eae523 100644 --- a/test/uniqueElementsBy/uniqueElementsBy.test.js +++ b/test/uniqueElementsBy.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const uniqueElementsBy = require('./uniqueElementsBy.js'); +const {uniqueElementsBy} = require('./_30s.js'); test('uniqueElementsBy is a Function', () => { expect(uniqueElementsBy).toBeInstanceOf(Function); diff --git a/test/uniqueElementsBy/uniqueElementsBy.js b/test/uniqueElementsBy/uniqueElementsBy.js deleted file mode 100644 index 151471448..000000000 --- a/test/uniqueElementsBy/uniqueElementsBy.js +++ /dev/null @@ -1,6 +0,0 @@ -const uniqueElementsBy = (arr, fn) => - arr.reduce((acc, v) => { - if (!acc.some(x => fn(v, x))) acc.push(v); - return acc; - }, []); -module.exports = uniqueElementsBy; diff --git a/test/uniqueElementsByRight/uniqueElementsByRight.test.js b/test/uniqueElementsByRight.test.js similarity index 93% rename from test/uniqueElementsByRight/uniqueElementsByRight.test.js rename to test/uniqueElementsByRight.test.js index 9e324ef1f..4340dd2b1 100644 --- a/test/uniqueElementsByRight/uniqueElementsByRight.test.js +++ b/test/uniqueElementsByRight.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const uniqueElementsByRight = require('./uniqueElementsByRight.js'); +const {uniqueElementsByRight} = require('./_30s.js'); test('uniqueElementsByRight is a Function', () => { expect(uniqueElementsByRight).toBeInstanceOf(Function); diff --git a/test/uniqueElementsByRight/uniqueElementsByRight.js b/test/uniqueElementsByRight/uniqueElementsByRight.js deleted file mode 100644 index 8f114ebf9..000000000 --- a/test/uniqueElementsByRight/uniqueElementsByRight.js +++ /dev/null @@ -1,6 +0,0 @@ -const uniqueElementsByRight = (arr, fn) => - arr.reduceRight((acc, v) => { - if (!acc.some(x => fn(v, x))) acc.push(v); - return acc; - }, []); -module.exports = uniqueElementsByRight; diff --git a/test/uniqueSymmetricDifference/uniqueSymmetricDifference.test.js b/test/uniqueSymmetricDifference.test.js similarity index 85% rename from test/uniqueSymmetricDifference/uniqueSymmetricDifference.test.js rename to test/uniqueSymmetricDifference.test.js index 788d1f65e..d9fa598b6 100644 --- a/test/uniqueSymmetricDifference/uniqueSymmetricDifference.test.js +++ b/test/uniqueSymmetricDifference.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const uniqueSymmetricDifference = require('./uniqueSymmetricDifference.js'); +const {uniqueSymmetricDifference} = require('./_30s.js'); test('uniqueSymmetricDifference is a Function', () => { expect(uniqueSymmetricDifference).toBeInstanceOf(Function); diff --git a/test/uniqueSymmetricDifference/uniqueSymmetricDifference.js b/test/uniqueSymmetricDifference/uniqueSymmetricDifference.js deleted file mode 100644 index 62cb18a5f..000000000 --- a/test/uniqueSymmetricDifference/uniqueSymmetricDifference.js +++ /dev/null @@ -1,4 +0,0 @@ -const uniqueSymmetricDifference = (a, b) => [ - ...new Set([...a.filter(v => !b.includes(v)), ...b.filter(v => !a.includes(v))]) -]; -module.exports = uniqueSymmetricDifference; diff --git a/test/untildify/untildify.test.js b/test/untildify.test.js similarity index 91% rename from test/untildify/untildify.test.js rename to test/untildify.test.js index d8e3134e1..3e0c934c3 100644 --- a/test/untildify/untildify.test.js +++ b/test/untildify.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const untildify = require('./untildify.js'); +const {untildify} = require('./_30s.js'); test('untildify is a Function', () => { expect(untildify).toBeInstanceOf(Function); diff --git a/test/untildify/untildify.js b/test/untildify/untildify.js deleted file mode 100644 index 4dd64d3b1..000000000 --- a/test/untildify/untildify.js +++ /dev/null @@ -1,2 +0,0 @@ -const untildify = str => str.replace(/^~($|\/|\\)/, `${require('os').homedir()}$1`); -module.exports = untildify; diff --git a/test/unzip/unzip.test.js b/test/unzip.test.js similarity index 92% rename from test/unzip/unzip.test.js rename to test/unzip.test.js index b8c67f6e7..770cec738 100644 --- a/test/unzip/unzip.test.js +++ b/test/unzip.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unzip = require('./unzip.js'); +const {unzip} = require('./_30s.js'); test('unzip is a Function', () => { expect(unzip).toBeInstanceOf(Function); diff --git a/test/unzip/unzip.js b/test/unzip/unzip.js deleted file mode 100644 index 4aa9c5965..000000000 --- a/test/unzip/unzip.js +++ /dev/null @@ -1,8 +0,0 @@ -const unzip = arr => - arr.reduce( - (acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc), - Array.from({ - length: Math.max(...arr.map(x => x.length)) - }).map(x => []) - ); -module.exports = unzip; diff --git a/test/unzipWith/unzipWith.test.js b/test/unzipWith.test.js similarity index 89% rename from test/unzipWith/unzipWith.test.js rename to test/unzipWith.test.js index 8a439000c..9ba060eb8 100644 --- a/test/unzipWith/unzipWith.test.js +++ b/test/unzipWith.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const unzipWith = require('./unzipWith.js'); +const {unzipWith} = require('./_30s.js'); test('unzipWith is a Function', () => { expect(unzipWith).toBeInstanceOf(Function); diff --git a/test/unzipWith/unzipWith.js b/test/unzipWith/unzipWith.js deleted file mode 100644 index 7c94b6875..000000000 --- a/test/unzipWith/unzipWith.js +++ /dev/null @@ -1,10 +0,0 @@ -const unzipWith = (arr, fn) => - arr - .reduce( - (acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc), - Array.from({ - length: Math.max(...arr.map(x => x.length)) - }).map(x => []) - ) - .map(val => fn(...val)); -module.exports = unzipWith; diff --git a/test/validateNumber/validateNumber.test.js b/test/validateNumber.test.js similarity index 96% rename from test/validateNumber/validateNumber.test.js rename to test/validateNumber.test.js index 2d009afae..c50b6f578 100644 --- a/test/validateNumber/validateNumber.test.js +++ b/test/validateNumber.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const validateNumber = require('./validateNumber.js'); +const {validateNumber} = require('./_30s.js'); test('validateNumber is a Function', () => { expect(validateNumber).toBeInstanceOf(Function); diff --git a/test/validateNumber/validateNumber.js b/test/validateNumber/validateNumber.js deleted file mode 100644 index 691081f8e..000000000 --- a/test/validateNumber/validateNumber.js +++ /dev/null @@ -1,2 +0,0 @@ -const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n; -module.exports = validateNumber; diff --git a/test/when/when.test.js b/test/when.test.js similarity index 90% rename from test/when/when.test.js rename to test/when.test.js index 5ea4c3baf..d4da63014 100644 --- a/test/when/when.test.js +++ b/test/when.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const when = require('./when.js'); +const {when} = require('./_30s.js'); test('when is a Function', () => { expect(when).toBeInstanceOf(Function); diff --git a/test/when/when.js b/test/when/when.js deleted file mode 100644 index 57055511f..000000000 --- a/test/when/when.js +++ /dev/null @@ -1,2 +0,0 @@ -const when = (pred, whenTrue) => x => (pred(x) ? whenTrue(x) : x); -module.exports = when; diff --git a/test/without/without.test.js b/test/without.test.js similarity index 96% rename from test/without/without.test.js rename to test/without.test.js index 21a9684df..72e0f3b2a 100644 --- a/test/without/without.test.js +++ b/test/without.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const without = require('./without.js'); +const {without} = require('./_30s.js'); test('without is a Function', () => { expect(without).toBeInstanceOf(Function); diff --git a/test/without/without.js b/test/without/without.js deleted file mode 100644 index c17d28369..000000000 --- a/test/without/without.js +++ /dev/null @@ -1,2 +0,0 @@ -const without = (arr, ...args) => arr.filter(v => !args.includes(v)); -module.exports = without; diff --git a/test/words/words.test.js b/test/words.test.js similarity index 96% rename from test/words/words.test.js rename to test/words.test.js index 4ed2c9e9f..18f675e33 100644 --- a/test/words/words.test.js +++ b/test/words.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const words = require('./words.js'); +const {words} = require('./_30s.js'); test('words is a Function', () => { expect(words).toBeInstanceOf(Function); diff --git a/test/words/words.js b/test/words/words.js deleted file mode 100644 index f7a51417a..000000000 --- a/test/words/words.js +++ /dev/null @@ -1,2 +0,0 @@ -const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean); -module.exports = words; diff --git a/test/xProd/xProd.test.js b/test/xProd.test.js similarity index 88% rename from test/xProd/xProd.test.js rename to test/xProd.test.js index 2b6f00116..ce283f333 100644 --- a/test/xProd/xProd.test.js +++ b/test/xProd.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const xProd = require('./xProd.js'); +const {xProd} = require('./_30s.js'); test('xProd is a Function', () => { expect(xProd).toBeInstanceOf(Function); diff --git a/test/xProd/xProd.js b/test/xProd/xProd.js deleted file mode 100644 index b98865854..000000000 --- a/test/xProd/xProd.js +++ /dev/null @@ -1,2 +0,0 @@ -const xProd = (a, b) => a.reduce((acc, x) => acc.concat(b.map(y => [x, y])), []); -module.exports = xProd; diff --git a/test/yesNo/yesNo.test.js b/test/yesNo.test.js similarity index 96% rename from test/yesNo/yesNo.test.js rename to test/yesNo.test.js index 9bc825531..650518033 100644 --- a/test/yesNo/yesNo.test.js +++ b/test/yesNo.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const yesNo = require('./yesNo.js'); +const {yesNo} = require('./_30s.js'); test('yesNo is a Function', () => { expect(yesNo).toBeInstanceOf(Function); diff --git a/test/yesNo/yesNo.js b/test/yesNo/yesNo.js deleted file mode 100644 index 5e318eec4..000000000 --- a/test/yesNo/yesNo.js +++ /dev/null @@ -1,3 +0,0 @@ -const yesNo = (val, def = false) => - /^(y|yes)$/i.test(val) ? true : /^(n|no)$/i.test(val) ? false : def; -module.exports = yesNo; diff --git a/test/zip/zip.test.js b/test/zip.test.js similarity index 96% rename from test/zip/zip.test.js rename to test/zip.test.js index 90a291cb2..37ecb8053 100644 --- a/test/zip/zip.test.js +++ b/test/zip.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const zip = require('./zip.js'); +const {zip} = require('./_30s.js'); test('zip is a Function', () => { expect(zip).toBeInstanceOf(Function); diff --git a/test/zip/zip.js b/test/zip/zip.js deleted file mode 100644 index 29dd6e79c..000000000 --- a/test/zip/zip.js +++ /dev/null @@ -1,7 +0,0 @@ -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]); - }); -}; -module.exports = zip; diff --git a/test/zipObject/zipObject.test.js b/test/zipObject.test.js similarity index 96% rename from test/zipObject/zipObject.test.js rename to test/zipObject.test.js index abdc07d77..f8cc69864 100644 --- a/test/zipObject/zipObject.test.js +++ b/test/zipObject.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const zipObject = require('./zipObject.js'); +const {zipObject} = require('./_30s.js'); test('zipObject is a Function', () => { expect(zipObject).toBeInstanceOf(Function); diff --git a/test/zipObject/zipObject.js b/test/zipObject/zipObject.js deleted file mode 100644 index 3a670fefa..000000000 --- a/test/zipObject/zipObject.js +++ /dev/null @@ -1,3 +0,0 @@ -const zipObject = (props, values) => - props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); -module.exports = zipObject; diff --git a/test/zipWith/zipWith.test.js b/test/zipWith.test.js similarity index 74% rename from test/zipWith/zipWith.test.js rename to test/zipWith.test.js index 3cffd0a46..663be4604 100644 --- a/test/zipWith/zipWith.test.js +++ b/test/zipWith.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const zipWith = require('./zipWith.js'); +const {zipWith} = require('./_30s.js'); test('zipWith is a Function', () => { expect(zipWith).toBeInstanceOf(Function); diff --git a/test/zipWith/zipWith.js b/test/zipWith/zipWith.js deleted file mode 100644 index 9a6a1e926..000000000 --- a/test/zipWith/zipWith.js +++ /dev/null @@ -1,8 +0,0 @@ -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])) - ); -}; -module.exports = zipWith;