diff --git a/test/JSONToDate/JSONToDate.js b/test/JSONToDate/JSONToDate.js new file mode 100644 index 000000000..935c919cd --- /dev/null +++ b/test/JSONToDate/JSONToDate.js @@ -0,0 +1,4 @@ +module.exports = arr => { +const dt = new Date(parseInt(arr.toString().substr(6))); +return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`; +}; \ No newline at end of file diff --git a/test/JSONToDate/JSONToDate.test.js b/test/JSONToDate/JSONToDate.test.js new file mode 100644 index 000000000..9636880ac --- /dev/null +++ b/test/JSONToDate/JSONToDate.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const JSONToDate = require('./JSONToDate.js'); + +test('Testing JSONToDate', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof JSONToDate === 'function', 'JSONToDate is a Function'); + //t.deepEqual(JSONToDate(args..), 'Expected'); + //t.equal(JSONToDate(args..), 'Expected'); + //t.false(JSONToDate(args..), 'Expected'); + //t.throws(JSONToDate(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/RGBToHex/RGBToHex.js b/test/RGBToHex/RGBToHex.js new file mode 100644 index 000000000..d2f44e32d --- /dev/null +++ b/test/RGBToHex/RGBToHex.js @@ -0,0 +1 @@ +module.exports = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0'); \ No newline at end of file diff --git a/test/RGBToHex/RGBToHex.test.js b/test/RGBToHex/RGBToHex.test.js new file mode 100644 index 000000000..0e9dbd72e --- /dev/null +++ b/test/RGBToHex/RGBToHex.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const RGBToHex = require('./RGBToHex.js'); + +test('Testing RGBToHex', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof RGBToHex === 'function', 'RGBToHex is a Function'); + //t.deepEqual(RGBToHex(args..), 'Expected'); + //t.equal(RGBToHex(args..), 'Expected'); + //t.false(RGBToHex(args..), 'Expected'); + //t.throws(RGBToHex(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js new file mode 100644 index 000000000..260bca776 --- /dev/null +++ b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.js @@ -0,0 +1,4 @@ +module.exports = () => +([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => +(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16) +); \ No newline at end of file diff --git a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js new file mode 100644 index 000000000..d6f5407a4 --- /dev/null +++ b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const UUIDGeneratorBrowser = require('./UUIDGeneratorBrowser.js'); + +test('Testing UUIDGeneratorBrowser', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof UUIDGeneratorBrowser === 'function', 'UUIDGeneratorBrowser is a Function'); + //t.deepEqual(UUIDGeneratorBrowser(args..), 'Expected'); + //t.equal(UUIDGeneratorBrowser(args..), 'Expected'); + //t.false(UUIDGeneratorBrowser(args..), 'Expected'); + //t.throws(UUIDGeneratorBrowser(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/anagrams/anagrams.js b/test/anagrams/anagrams.js new file mode 100644 index 000000000..8d41e77f5 --- /dev/null +++ b/test/anagrams/anagrams.js @@ -0,0 +1,10 @@ +module.exports = str => { +if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str]; +return str +.split('') +.reduce( +(acc, letter, i) => +acc.concat(anagrams(str.slice(0, i) + str.slice(i + 1)).map(val => letter + val)), +[] +); +}; \ No newline at end of file diff --git a/test/anagrams/anagrams.test.js b/test/anagrams/anagrams.test.js new file mode 100644 index 000000000..067204b64 --- /dev/null +++ b/test/anagrams/anagrams.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const anagrams = require('./anagrams.js'); + +test('Testing anagrams', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof anagrams === 'function', 'anagrams is a Function'); + //t.deepEqual(anagrams(args..), 'Expected'); + //t.equal(anagrams(args..), 'Expected'); + //t.false(anagrams(args..), 'Expected'); + //t.throws(anagrams(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/arrayToHtmlList/arrayToHtmlList.js b/test/arrayToHtmlList/arrayToHtmlList.js new file mode 100644 index 000000000..d2aa87f0f --- /dev/null +++ b/test/arrayToHtmlList/arrayToHtmlList.js @@ -0,0 +1,2 @@ +module.exports = (arr, listID) => +arr.map(item => (document.querySelector('#' + listID).innerHTML += `
  • ${item}
  • `)); \ No newline at end of file diff --git a/test/arrayToHtmlList/arrayToHtmlList.test.js b/test/arrayToHtmlList/arrayToHtmlList.test.js new file mode 100644 index 000000000..b4a4b036b --- /dev/null +++ b/test/arrayToHtmlList/arrayToHtmlList.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const arrayToHtmlList = require('./arrayToHtmlList.js'); + +test('Testing arrayToHtmlList', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof arrayToHtmlList === 'function', 'arrayToHtmlList is a Function'); + //t.deepEqual(arrayToHtmlList(args..), 'Expected'); + //t.equal(arrayToHtmlList(args..), 'Expected'); + //t.false(arrayToHtmlList(args..), 'Expected'); + //t.throws(arrayToHtmlList(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/average/average.js b/test/average/average.js new file mode 100644 index 000000000..64e74d7db --- /dev/null +++ b/test/average/average.js @@ -0,0 +1 @@ +module.exports = (...nums) => [...nums].reduce((acc, val) => acc + val, 0) / nums.length; \ No newline at end of file diff --git a/test/average/average.test.js b/test/average/average.test.js new file mode 100644 index 000000000..3445e55ff --- /dev/null +++ b/test/average/average.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const average = require('./average.js'); + +test('Testing average', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof average === 'function', 'average is a Function'); + //t.deepEqual(average(args..), 'Expected'); + //t.equal(average(args..), 'Expected'); + //t.false(average(args..), 'Expected'); + //t.throws(average(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/binarySearch/binarySearch.js b/test/binarySearch/binarySearch.js new file mode 100644 index 000000000..96e71ecc3 --- /dev/null +++ b/test/binarySearch/binarySearch.js @@ -0,0 +1,7 @@ +module.exports = (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; +} \ No newline at end of file diff --git a/test/binarySearch/binarySearch.test.js b/test/binarySearch/binarySearch.test.js new file mode 100644 index 000000000..754a31ad6 --- /dev/null +++ b/test/binarySearch/binarySearch.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const binarySearch = require('./binarySearch.js'); + +test('Testing binarySearch', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof binarySearch === 'function', 'binarySearch is a Function'); + //t.deepEqual(binarySearch(args..), 'Expected'); + //t.equal(binarySearch(args..), 'Expected'); + //t.false(binarySearch(args..), 'Expected'); + //t.throws(binarySearch(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/bottomVisible/bottomVisible.js b/test/bottomVisible/bottomVisible.js new file mode 100644 index 000000000..eb338f509 --- /dev/null +++ b/test/bottomVisible/bottomVisible.js @@ -0,0 +1,3 @@ +module.exports = () => +document.documentElement.clientHeight + window.scrollY >= +(document.documentElement.scrollHeight || document.documentElement.clientHeight); \ No newline at end of file diff --git a/test/bottomVisible/bottomVisible.test.js b/test/bottomVisible/bottomVisible.test.js new file mode 100644 index 000000000..be6f6871b --- /dev/null +++ b/test/bottomVisible/bottomVisible.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const bottomVisible = require('./bottomVisible.js'); + +test('Testing bottomVisible', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof bottomVisible === 'function', 'bottomVisible is a Function'); + //t.deepEqual(bottomVisible(args..), 'Expected'); + //t.equal(bottomVisible(args..), 'Expected'); + //t.false(bottomVisible(args..), 'Expected'); + //t.throws(bottomVisible(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/byteSize/byteSize.js b/test/byteSize/byteSize.js new file mode 100644 index 000000000..d4334d952 --- /dev/null +++ b/test/byteSize/byteSize.js @@ -0,0 +1 @@ +module.exports = str => new Blob([str]).size; \ No newline at end of file diff --git a/test/byteSize/byteSize.test.js b/test/byteSize/byteSize.test.js new file mode 100644 index 000000000..495fce83d --- /dev/null +++ b/test/byteSize/byteSize.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const byteSize = require('./byteSize.js'); + +test('Testing byteSize', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof byteSize === 'function', 'byteSize is a Function'); + //t.deepEqual(byteSize(args..), 'Expected'); + //t.equal(byteSize(args..), 'Expected'); + //t.false(byteSize(args..), 'Expected'); + //t.throws(byteSize(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/call/call.js b/test/call/call.js new file mode 100644 index 000000000..61bf02b5d --- /dev/null +++ b/test/call/call.js @@ -0,0 +1 @@ +module.exports = (key, ...args) => context => context[key](...args); \ No newline at end of file diff --git a/test/call/call.test.js b/test/call/call.test.js new file mode 100644 index 000000000..f01b61ab1 --- /dev/null +++ b/test/call/call.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const call = require('./call.js'); + +test('Testing call', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof call === 'function', 'call is a Function'); + //t.deepEqual(call(args..), 'Expected'); + //t.equal(call(args..), 'Expected'); + //t.false(call(args..), 'Expected'); + //t.throws(call(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/capitalize/capitalize.js b/test/capitalize/capitalize.js new file mode 100644 index 000000000..d1dccff21 --- /dev/null +++ b/test/capitalize/capitalize.js @@ -0,0 +1,2 @@ +module.exports = ([first, ...rest], lowerRest = false) => +first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join('')); \ No newline at end of file diff --git a/test/capitalize/capitalize.test.js b/test/capitalize/capitalize.test.js new file mode 100644 index 000000000..5953b6c53 --- /dev/null +++ b/test/capitalize/capitalize.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const capitalize = require('./capitalize.js'); + +test('Testing capitalize', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof capitalize === 'function', 'capitalize is a Function'); + //t.deepEqual(capitalize(args..), 'Expected'); + //t.equal(capitalize(args..), 'Expected'); + //t.false(capitalize(args..), 'Expected'); + //t.throws(capitalize(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/capitalizeEveryWord/capitalizeEveryWord.js b/test/capitalizeEveryWord/capitalizeEveryWord.js new file mode 100644 index 000000000..6177e8bcc --- /dev/null +++ b/test/capitalizeEveryWord/capitalizeEveryWord.js @@ -0,0 +1 @@ +module.exports = str => str.replace(/\b[a-z]/g, char => char.toUpperCase()); \ No newline at end of file diff --git a/test/capitalizeEveryWord/capitalizeEveryWord.test.js b/test/capitalizeEveryWord/capitalizeEveryWord.test.js new file mode 100644 index 000000000..245e3bd14 --- /dev/null +++ b/test/capitalizeEveryWord/capitalizeEveryWord.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const capitalizeEveryWord = require('./capitalizeEveryWord.js'); + +test('Testing capitalizeEveryWord', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof capitalizeEveryWord === 'function', 'capitalizeEveryWord is a Function'); + //t.deepEqual(capitalizeEveryWord(args..), 'Expected'); + //t.equal(capitalizeEveryWord(args..), 'Expected'); + //t.false(capitalizeEveryWord(args..), 'Expected'); + //t.throws(capitalizeEveryWord(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/chainAsync/chainAsync.js b/test/chainAsync/chainAsync.js new file mode 100644 index 000000000..0f110e62a --- /dev/null +++ b/test/chainAsync/chainAsync.js @@ -0,0 +1,5 @@ +module.exports = fns => { +let curr = 0; +const next = () => fns[curr++](next); +next(); +}; \ No newline at end of file diff --git a/test/chainAsync/chainAsync.test.js b/test/chainAsync/chainAsync.test.js new file mode 100644 index 000000000..9fab8a947 --- /dev/null +++ b/test/chainAsync/chainAsync.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const chainAsync = require('./chainAsync.js'); + +test('Testing chainAsync', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof chainAsync === 'function', 'chainAsync is a Function'); + //t.deepEqual(chainAsync(args..), 'Expected'); + //t.equal(chainAsync(args..), 'Expected'); + //t.false(chainAsync(args..), 'Expected'); + //t.throws(chainAsync(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/chunk/chunk.js b/test/chunk/chunk.js new file mode 100644 index 000000000..1907e30d9 --- /dev/null +++ b/test/chunk/chunk.js @@ -0,0 +1,4 @@ +module.exports = (arr, size) => +Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => +arr.slice(i * size, i * size + size) +); \ No newline at end of file diff --git a/test/chunk/chunk.test.js b/test/chunk/chunk.test.js new file mode 100644 index 000000000..c87e050fe --- /dev/null +++ b/test/chunk/chunk.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const chunk = require('./chunk.js'); + +test('Testing chunk', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof chunk === 'function', 'chunk is a Function'); + //t.deepEqual(chunk(args..), 'Expected'); + //t.equal(chunk(args..), 'Expected'); + //t.false(chunk(args..), 'Expected'); + //t.throws(chunk(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/clampNumber/clampNumber.js b/test/clampNumber/clampNumber.js new file mode 100644 index 000000000..f82160568 --- /dev/null +++ b/test/clampNumber/clampNumber.js @@ -0,0 +1 @@ +module.exports = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); \ No newline at end of file diff --git a/test/clampNumber/clampNumber.test.js b/test/clampNumber/clampNumber.test.js new file mode 100644 index 000000000..8e5511749 --- /dev/null +++ b/test/clampNumber/clampNumber.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const clampNumber = require('./clampNumber.js'); + +test('Testing clampNumber', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof clampNumber === 'function', 'clampNumber is a Function'); + //t.deepEqual(clampNumber(args..), 'Expected'); + //t.equal(clampNumber(args..), 'Expected'); + //t.false(clampNumber(args..), 'Expected'); + //t.throws(clampNumber(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/cleanObj/cleanObj.js b/test/cleanObj/cleanObj.js new file mode 100644 index 000000000..ce4ea9bbf --- /dev/null +++ b/test/cleanObj/cleanObj.js @@ -0,0 +1,10 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/cleanObj/cleanObj.test.js b/test/cleanObj/cleanObj.test.js new file mode 100644 index 000000000..47e035791 --- /dev/null +++ b/test/cleanObj/cleanObj.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const cleanObj = require('./cleanObj.js'); + +test('Testing cleanObj', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof cleanObj === 'function', 'cleanObj is a Function'); + //t.deepEqual(cleanObj(args..), 'Expected'); + //t.equal(cleanObj(args..), 'Expected'); + //t.false(cleanObj(args..), 'Expected'); + //t.throws(cleanObj(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/cloneRegExp/cloneRegExp.js b/test/cloneRegExp/cloneRegExp.js new file mode 100644 index 000000000..bc4db3683 --- /dev/null +++ b/test/cloneRegExp/cloneRegExp.js @@ -0,0 +1 @@ +module.exports = regExp => new RegExp(regExp.source, regExp.flags); \ No newline at end of file diff --git a/test/cloneRegExp/cloneRegExp.test.js b/test/cloneRegExp/cloneRegExp.test.js new file mode 100644 index 000000000..2fb7f7b82 --- /dev/null +++ b/test/cloneRegExp/cloneRegExp.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const cloneRegExp = require('./cloneRegExp.js'); + +test('Testing cloneRegExp', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof cloneRegExp === 'function', 'cloneRegExp is a Function'); + //t.deepEqual(cloneRegExp(args..), 'Expected'); + //t.equal(cloneRegExp(args..), 'Expected'); + //t.false(cloneRegExp(args..), 'Expected'); + //t.throws(cloneRegExp(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/coalesce/coalesce.js b/test/coalesce/coalesce.js new file mode 100644 index 000000000..18e4e3793 --- /dev/null +++ b/test/coalesce/coalesce.js @@ -0,0 +1 @@ +module.exports = (...args) => args.find(_ => ![undefined, null].includes(_)); \ No newline at end of file diff --git a/test/coalesce/coalesce.test.js b/test/coalesce/coalesce.test.js new file mode 100644 index 000000000..a4dbd1a04 --- /dev/null +++ b/test/coalesce/coalesce.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const coalesce = require('./coalesce.js'); + +test('Testing coalesce', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof coalesce === 'function', 'coalesce is a Function'); + //t.deepEqual(coalesce(args..), 'Expected'); + //t.equal(coalesce(args..), 'Expected'); + //t.false(coalesce(args..), 'Expected'); + //t.throws(coalesce(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/coalesceFactory/coalesceFactory.js b/test/coalesceFactory/coalesceFactory.js new file mode 100644 index 000000000..debdd990c --- /dev/null +++ b/test/coalesceFactory/coalesceFactory.js @@ -0,0 +1 @@ +module.exports = valid => (...args) => args.find(valid); \ No newline at end of file diff --git a/test/coalesceFactory/coalesceFactory.test.js b/test/coalesceFactory/coalesceFactory.test.js new file mode 100644 index 000000000..91989e138 --- /dev/null +++ b/test/coalesceFactory/coalesceFactory.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const coalesceFactory = require('./coalesceFactory.js'); + +test('Testing coalesceFactory', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof coalesceFactory === 'function', 'coalesceFactory is a Function'); + //t.deepEqual(coalesceFactory(args..), 'Expected'); + //t.equal(coalesceFactory(args..), 'Expected'); + //t.false(coalesceFactory(args..), 'Expected'); + //t.throws(coalesceFactory(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/collatz/collatz.js b/test/collatz/collatz.js new file mode 100644 index 000000000..3fb44dac9 --- /dev/null +++ b/test/collatz/collatz.js @@ -0,0 +1 @@ +module.exports = n => (n % 2 == 0 ? n / 2 : 3 * n + 1); \ No newline at end of file diff --git a/test/collatz/collatz.test.js b/test/collatz/collatz.test.js new file mode 100644 index 000000000..d713c999d --- /dev/null +++ b/test/collatz/collatz.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const collatz = require('./collatz.js'); + +test('Testing collatz', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof collatz === 'function', 'collatz is a Function'); + //t.deepEqual(collatz(args..), 'Expected'); + //t.equal(collatz(args..), 'Expected'); + //t.false(collatz(args..), 'Expected'); + //t.throws(collatz(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/collectInto/collectInto.js b/test/collectInto/collectInto.js new file mode 100644 index 000000000..8f5ef94ea --- /dev/null +++ b/test/collectInto/collectInto.js @@ -0,0 +1 @@ +module.exports = fn => (...args) => fn(args); \ No newline at end of file diff --git a/test/collectInto/collectInto.test.js b/test/collectInto/collectInto.test.js new file mode 100644 index 000000000..99407663e --- /dev/null +++ b/test/collectInto/collectInto.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const collectInto = require('./collectInto.js'); + +test('Testing collectInto', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof collectInto === 'function', 'collectInto is a Function'); + //t.deepEqual(collectInto(args..), 'Expected'); + //t.equal(collectInto(args..), 'Expected'); + //t.false(collectInto(args..), 'Expected'); + //t.throws(collectInto(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/compact/compact.js b/test/compact/compact.js new file mode 100644 index 000000000..73f3f0dcf --- /dev/null +++ b/test/compact/compact.js @@ -0,0 +1 @@ +module.exports = arr => arr.filter(Boolean); \ No newline at end of file diff --git a/test/compact/compact.test.js b/test/compact/compact.test.js new file mode 100644 index 000000000..f895a35fb --- /dev/null +++ b/test/compact/compact.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const compact = require('./compact.js'); + +test('Testing compact', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof compact === 'function', 'compact is a Function'); + //t.deepEqual(compact(args..), 'Expected'); + //t.equal(compact(args..), 'Expected'); + //t.false(compact(args..), 'Expected'); + //t.throws(compact(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/compose/compose.js b/test/compose/compose.js new file mode 100644 index 000000000..32886d307 --- /dev/null +++ b/test/compose/compose.js @@ -0,0 +1 @@ +module.exports = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); \ No newline at end of file diff --git a/test/compose/compose.test.js b/test/compose/compose.test.js new file mode 100644 index 000000000..11593b563 --- /dev/null +++ b/test/compose/compose.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const compose = require('./compose.js'); + +test('Testing compose', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof compose === 'function', 'compose is a Function'); + //t.deepEqual(compose(args..), 'Expected'); + //t.equal(compose(args..), 'Expected'); + //t.false(compose(args..), 'Expected'); + //t.throws(compose(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/copyToClipboard/copyToClipboard.js b/test/copyToClipboard/copyToClipboard.js new file mode 100644 index 000000000..c73d01bc5 --- /dev/null +++ b/test/copyToClipboard/copyToClipboard.js @@ -0,0 +1,17 @@ +module.exports = 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); +} +}; \ No newline at end of file diff --git a/test/copyToClipboard/copyToClipboard.test.js b/test/copyToClipboard/copyToClipboard.test.js new file mode 100644 index 000000000..af7678391 --- /dev/null +++ b/test/copyToClipboard/copyToClipboard.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const copyToClipboard = require('./copyToClipboard.js'); + +test('Testing copyToClipboard', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof copyToClipboard === 'function', 'copyToClipboard is a Function'); + //t.deepEqual(copyToClipboard(args..), 'Expected'); + //t.equal(copyToClipboard(args..), 'Expected'); + //t.false(copyToClipboard(args..), 'Expected'); + //t.throws(copyToClipboard(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/countOccurrences/countOccurrences.js b/test/countOccurrences/countOccurrences.js new file mode 100644 index 000000000..6cd81e0ef --- /dev/null +++ b/test/countOccurrences/countOccurrences.js @@ -0,0 +1 @@ +module.exports = (arr, val) => arr.reduce((a, v) => (v === val ? a + 1 : a + 0), 0); \ No newline at end of file diff --git a/test/countOccurrences/countOccurrences.test.js b/test/countOccurrences/countOccurrences.test.js new file mode 100644 index 000000000..64b2d14c4 --- /dev/null +++ b/test/countOccurrences/countOccurrences.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const countOccurrences = require('./countOccurrences.js'); + +test('Testing countOccurrences', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof countOccurrences === 'function', 'countOccurrences is a Function'); + //t.deepEqual(countOccurrences(args..), 'Expected'); + //t.equal(countOccurrences(args..), 'Expected'); + //t.false(countOccurrences(args..), 'Expected'); + //t.throws(countOccurrences(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/countVowels/countVowels.js b/test/countVowels/countVowels.js new file mode 100644 index 000000000..a737d075b --- /dev/null +++ b/test/countVowels/countVowels.js @@ -0,0 +1 @@ +module.exports = str => (str.match(/[aeiou]/gi) || []).length; \ No newline at end of file diff --git a/test/countVowels/countVowels.test.js b/test/countVowels/countVowels.test.js new file mode 100644 index 000000000..2b91572e9 --- /dev/null +++ b/test/countVowels/countVowels.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const countVowels = require('./countVowels.js'); + +test('Testing countVowels', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof countVowels === 'function', 'countVowels is a Function'); + //t.deepEqual(countVowels(args..), 'Expected'); + //t.equal(countVowels(args..), 'Expected'); + //t.false(countVowels(args..), 'Expected'); + //t.throws(countVowels(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/createElement/createElement.js b/test/createElement/createElement.js new file mode 100644 index 000000000..db234e405 --- /dev/null +++ b/test/createElement/createElement.js @@ -0,0 +1,5 @@ +module.exports = str => { +const el = document.createElement('div'); +el.innerHTML = str; +return el.firstElementChild; +}; \ No newline at end of file diff --git a/test/createElement/createElement.test.js b/test/createElement/createElement.test.js new file mode 100644 index 000000000..bda8d943e --- /dev/null +++ b/test/createElement/createElement.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const createElement = require('./createElement.js'); + +test('Testing createElement', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof createElement === 'function', 'createElement is a Function'); + //t.deepEqual(createElement(args..), 'Expected'); + //t.equal(createElement(args..), 'Expected'); + //t.false(createElement(args..), 'Expected'); + //t.throws(createElement(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/currentURL/currentURL.js b/test/currentURL/currentURL.js new file mode 100644 index 000000000..ad4f466a4 --- /dev/null +++ b/test/currentURL/currentURL.js @@ -0,0 +1 @@ +module.exports = () => window.location.href; \ No newline at end of file diff --git a/test/currentURL/currentURL.test.js b/test/currentURL/currentURL.test.js new file mode 100644 index 000000000..ee9f82d9c --- /dev/null +++ b/test/currentURL/currentURL.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const currentURL = require('./currentURL.js'); + +test('Testing currentURL', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof currentURL === 'function', 'currentURL is a Function'); + //t.deepEqual(currentURL(args..), 'Expected'); + //t.equal(currentURL(args..), 'Expected'); + //t.false(currentURL(args..), 'Expected'); + //t.throws(currentURL(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/curry/curry.js b/test/curry/curry.js new file mode 100644 index 000000000..461c172d9 --- /dev/null +++ b/test/curry/curry.js @@ -0,0 +1,2 @@ +module.exports = (fn, arity = fn.length, ...args) => +arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args); \ No newline at end of file diff --git a/test/curry/curry.test.js b/test/curry/curry.test.js new file mode 100644 index 000000000..e8cd9e274 --- /dev/null +++ b/test/curry/curry.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const curry = require('./curry.js'); + +test('Testing curry', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof curry === 'function', 'curry is a Function'); + //t.deepEqual(curry(args..), 'Expected'); + //t.equal(curry(args..), 'Expected'); + //t.false(curry(args..), 'Expected'); + //t.throws(curry(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/deepFlatten/deepFlatten.js b/test/deepFlatten/deepFlatten.js new file mode 100644 index 000000000..115c1c402 --- /dev/null +++ b/test/deepFlatten/deepFlatten.js @@ -0,0 +1 @@ +module.exports = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); \ No newline at end of file diff --git a/test/deepFlatten/deepFlatten.test.js b/test/deepFlatten/deepFlatten.test.js new file mode 100644 index 000000000..8bab8107d --- /dev/null +++ b/test/deepFlatten/deepFlatten.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const deepFlatten = require('./deepFlatten.js'); + +test('Testing deepFlatten', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof deepFlatten === 'function', 'deepFlatten is a Function'); + //t.deepEqual(deepFlatten(args..), 'Expected'); + //t.equal(deepFlatten(args..), 'Expected'); + //t.false(deepFlatten(args..), 'Expected'); + //t.throws(deepFlatten(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/defer/defer.js b/test/defer/defer.js new file mode 100644 index 000000000..81b0661aa --- /dev/null +++ b/test/defer/defer.js @@ -0,0 +1 @@ +module.exports = (fn, ...args) => setTimeout(fn, 1, ...args); \ No newline at end of file diff --git a/test/defer/defer.test.js b/test/defer/defer.test.js new file mode 100644 index 000000000..b019474ba --- /dev/null +++ b/test/defer/defer.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const defer = require('./defer.js'); + +test('Testing defer', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof defer === 'function', 'defer is a Function'); + //t.deepEqual(defer(args..), 'Expected'); + //t.equal(defer(args..), 'Expected'); + //t.false(defer(args..), 'Expected'); + //t.throws(defer(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/detectDeviceType/detectDeviceType.js b/test/detectDeviceType/detectDeviceType.js new file mode 100644 index 000000000..2b81aec62 --- /dev/null +++ b/test/detectDeviceType/detectDeviceType.js @@ -0,0 +1,4 @@ +module.exports = () => +/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) +? 'Mobile' +: 'Desktop'; \ No newline at end of file diff --git a/test/detectDeviceType/detectDeviceType.test.js b/test/detectDeviceType/detectDeviceType.test.js new file mode 100644 index 000000000..8795d1650 --- /dev/null +++ b/test/detectDeviceType/detectDeviceType.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const detectDeviceType = require('./detectDeviceType.js'); + +test('Testing detectDeviceType', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof detectDeviceType === 'function', 'detectDeviceType is a Function'); + //t.deepEqual(detectDeviceType(args..), 'Expected'); + //t.equal(detectDeviceType(args..), 'Expected'); + //t.false(detectDeviceType(args..), 'Expected'); + //t.throws(detectDeviceType(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/difference/difference.js b/test/difference/difference.js new file mode 100644 index 000000000..fbf6ec7d1 --- /dev/null +++ b/test/difference/difference.js @@ -0,0 +1,4 @@ +module.exports = (a, b) => { +const s = new Set(b); +return a.filter(x => !s.has(x)); +}; \ No newline at end of file diff --git a/test/difference/difference.test.js b/test/difference/difference.test.js new file mode 100644 index 000000000..94a7dc151 --- /dev/null +++ b/test/difference/difference.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const difference = require('./difference.js'); + +test('Testing difference', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof difference === 'function', 'difference is a Function'); + //t.deepEqual(difference(args..), 'Expected'); + //t.equal(difference(args..), 'Expected'); + //t.false(difference(args..), 'Expected'); + //t.throws(difference(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/differenceWith/differenceWith.js b/test/differenceWith/differenceWith.js new file mode 100644 index 000000000..27b530bef --- /dev/null +++ b/test/differenceWith/differenceWith.js @@ -0,0 +1 @@ +module.exports = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1); \ No newline at end of file diff --git a/test/differenceWith/differenceWith.test.js b/test/differenceWith/differenceWith.test.js new file mode 100644 index 000000000..61b34fa4b --- /dev/null +++ b/test/differenceWith/differenceWith.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const differenceWith = require('./differenceWith.js'); + +test('Testing differenceWith', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof differenceWith === 'function', 'differenceWith is a Function'); + //t.deepEqual(differenceWith(args..), 'Expected'); + //t.equal(differenceWith(args..), 'Expected'); + //t.false(differenceWith(args..), 'Expected'); + //t.throws(differenceWith(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/digitize/digitize.js b/test/digitize/digitize.js new file mode 100644 index 000000000..1726a01ee --- /dev/null +++ b/test/digitize/digitize.js @@ -0,0 +1 @@ +module.exports = n => [...`${n}`].map(i => parseInt(i)); \ No newline at end of file diff --git a/test/digitize/digitize.test.js b/test/digitize/digitize.test.js new file mode 100644 index 000000000..435a8b71e --- /dev/null +++ b/test/digitize/digitize.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const digitize = require('./digitize.js'); + +test('Testing digitize', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof digitize === 'function', 'digitize is a Function'); + //t.deepEqual(digitize(args..), 'Expected'); + //t.equal(digitize(args..), 'Expected'); + //t.false(digitize(args..), 'Expected'); + //t.throws(digitize(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/distance/distance.js b/test/distance/distance.js new file mode 100644 index 000000000..6d166a541 --- /dev/null +++ b/test/distance/distance.js @@ -0,0 +1 @@ +module.exports = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); \ No newline at end of file diff --git a/test/distance/distance.test.js b/test/distance/distance.test.js new file mode 100644 index 000000000..ace1084cb --- /dev/null +++ b/test/distance/distance.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const distance = require('./distance.js'); + +test('Testing distance', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof distance === 'function', 'distance is a Function'); + //t.deepEqual(distance(args..), 'Expected'); + //t.equal(distance(args..), 'Expected'); + //t.false(distance(args..), 'Expected'); + //t.throws(distance(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/distinctValuesOfArray/distinctValuesOfArray.js b/test/distinctValuesOfArray/distinctValuesOfArray.js new file mode 100644 index 000000000..0d8915e71 --- /dev/null +++ b/test/distinctValuesOfArray/distinctValuesOfArray.js @@ -0,0 +1 @@ +module.exports = arr => [...new Set(arr)]; \ No newline at end of file diff --git a/test/distinctValuesOfArray/distinctValuesOfArray.test.js b/test/distinctValuesOfArray/distinctValuesOfArray.test.js new file mode 100644 index 000000000..527ba8722 --- /dev/null +++ b/test/distinctValuesOfArray/distinctValuesOfArray.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const distinctValuesOfArray = require('./distinctValuesOfArray.js'); + +test('Testing distinctValuesOfArray', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof distinctValuesOfArray === 'function', 'distinctValuesOfArray is a Function'); + //t.deepEqual(distinctValuesOfArray(args..), 'Expected'); + //t.equal(distinctValuesOfArray(args..), 'Expected'); + //t.false(distinctValuesOfArray(args..), 'Expected'); + //t.throws(distinctValuesOfArray(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/dropElements/dropElements.js b/test/dropElements/dropElements.js new file mode 100644 index 000000000..8df4c8544 --- /dev/null +++ b/test/dropElements/dropElements.js @@ -0,0 +1,4 @@ +module.exports = (arr, func) => { +while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1); +return arr; +}; \ No newline at end of file diff --git a/test/dropElements/dropElements.test.js b/test/dropElements/dropElements.test.js new file mode 100644 index 000000000..79c82af44 --- /dev/null +++ b/test/dropElements/dropElements.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const dropElements = require('./dropElements.js'); + +test('Testing dropElements', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof dropElements === 'function', 'dropElements is a Function'); + //t.deepEqual(dropElements(args..), 'Expected'); + //t.equal(dropElements(args..), 'Expected'); + //t.false(dropElements(args..), 'Expected'); + //t.throws(dropElements(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/dropRight/dropRight.js b/test/dropRight/dropRight.js new file mode 100644 index 000000000..5007edbd9 --- /dev/null +++ b/test/dropRight/dropRight.js @@ -0,0 +1 @@ +module.exports = (arr, n = 1) => arr.slice(0, -n); \ No newline at end of file diff --git a/test/dropRight/dropRight.test.js b/test/dropRight/dropRight.test.js new file mode 100644 index 000000000..058378e8c --- /dev/null +++ b/test/dropRight/dropRight.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const dropRight = require('./dropRight.js'); + +test('Testing dropRight', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof dropRight === 'function', 'dropRight is a Function'); + //t.deepEqual(dropRight(args..), 'Expected'); + //t.equal(dropRight(args..), 'Expected'); + //t.false(dropRight(args..), 'Expected'); + //t.throws(dropRight(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js new file mode 100644 index 000000000..1b5b376db --- /dev/null +++ b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.js @@ -0,0 +1,8 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js new file mode 100644 index 000000000..6fd276aef --- /dev/null +++ b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const elementIsVisibleInViewport = require('./elementIsVisibleInViewport.js'); + +test('Testing elementIsVisibleInViewport', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof elementIsVisibleInViewport === 'function', 'elementIsVisibleInViewport is a Function'); + //t.deepEqual(elementIsVisibleInViewport(args..), 'Expected'); + //t.equal(elementIsVisibleInViewport(args..), 'Expected'); + //t.false(elementIsVisibleInViewport(args..), 'Expected'); + //t.throws(elementIsVisibleInViewport(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/elo/elo.js b/test/elo/elo.js new file mode 100644 index 000000000..b7f39409d --- /dev/null +++ b/test/elo/elo.js @@ -0,0 +1,18 @@ +module.exports = ([...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)]; +} else { +for (let i = 0; i < ratings.length; i++) { +let j = i; +while (j < ratings.length - 1) { +[ratings[i], ratings[j + 1]] = elo([ratings[i], ratings[j + 1]], kFactor); +j++; +} +} +} +return ratings; +}; \ No newline at end of file diff --git a/test/elo/elo.test.js b/test/elo/elo.test.js new file mode 100644 index 000000000..510d324d4 --- /dev/null +++ b/test/elo/elo.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const elo = require('./elo.js'); + +test('Testing elo', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof elo === 'function', 'elo is a Function'); + //t.deepEqual(elo(args..), 'Expected'); + //t.equal(elo(args..), 'Expected'); + //t.false(elo(args..), 'Expected'); + //t.throws(elo(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/escapeHTML/escapeHTML.js b/test/escapeHTML/escapeHTML.js new file mode 100644 index 000000000..7684850bc --- /dev/null +++ b/test/escapeHTML/escapeHTML.js @@ -0,0 +1,12 @@ +module.exports = str => +str.replace( +/[&<>'"]/g, +tag => +({ +'&': '&', +'<': '<', +'>': '>', +"'": ''', +'"': '"' +}[tag] || tag) +); \ No newline at end of file diff --git a/test/escapeHTML/escapeHTML.test.js b/test/escapeHTML/escapeHTML.test.js new file mode 100644 index 000000000..593de146e --- /dev/null +++ b/test/escapeHTML/escapeHTML.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const escapeHTML = require('./escapeHTML.js'); + +test('Testing escapeHTML', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof escapeHTML === 'function', 'escapeHTML is a Function'); + //t.deepEqual(escapeHTML(args..), 'Expected'); + //t.equal(escapeHTML(args..), 'Expected'); + //t.false(escapeHTML(args..), 'Expected'); + //t.throws(escapeHTML(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/escapeRegExp/escapeRegExp.js b/test/escapeRegExp/escapeRegExp.js new file mode 100644 index 000000000..008ca053b --- /dev/null +++ b/test/escapeRegExp/escapeRegExp.js @@ -0,0 +1 @@ +module.exports = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); \ No newline at end of file diff --git a/test/escapeRegExp/escapeRegExp.test.js b/test/escapeRegExp/escapeRegExp.test.js new file mode 100644 index 000000000..17a65e25d --- /dev/null +++ b/test/escapeRegExp/escapeRegExp.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const escapeRegExp = require('./escapeRegExp.js'); + +test('Testing escapeRegExp', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof escapeRegExp === 'function', 'escapeRegExp is a Function'); + //t.deepEqual(escapeRegExp(args..), 'Expected'); + //t.equal(escapeRegExp(args..), 'Expected'); + //t.false(escapeRegExp(args..), 'Expected'); + //t.throws(escapeRegExp(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/everyNth/everyNth.js b/test/everyNth/everyNth.js new file mode 100644 index 000000000..27666f7bf --- /dev/null +++ b/test/everyNth/everyNth.js @@ -0,0 +1 @@ +module.exports = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1); \ No newline at end of file diff --git a/test/everyNth/everyNth.test.js b/test/everyNth/everyNth.test.js new file mode 100644 index 000000000..0bb8368eb --- /dev/null +++ b/test/everyNth/everyNth.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const everyNth = require('./everyNth.js'); + +test('Testing everyNth', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof everyNth === 'function', 'everyNth is a Function'); + //t.deepEqual(everyNth(args..), 'Expected'); + //t.equal(everyNth(args..), 'Expected'); + //t.false(everyNth(args..), 'Expected'); + //t.throws(everyNth(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/extendHex/extendHex.js b/test/extendHex/extendHex.js new file mode 100644 index 000000000..653c083d2 --- /dev/null +++ b/test/extendHex/extendHex.js @@ -0,0 +1,7 @@ +module.exports = shortHex => +'#' + +shortHex +.slice(shortHex.startsWith('#') ? 1 : 0) +.split('') +.map(x => x + x) +.join(''); \ No newline at end of file diff --git a/test/extendHex/extendHex.test.js b/test/extendHex/extendHex.test.js new file mode 100644 index 000000000..eebd42754 --- /dev/null +++ b/test/extendHex/extendHex.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const extendHex = require('./extendHex.js'); + +test('Testing extendHex', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof extendHex === 'function', 'extendHex is a Function'); + //t.deepEqual(extendHex(args..), 'Expected'); + //t.equal(extendHex(args..), 'Expected'); + //t.false(extendHex(args..), 'Expected'); + //t.throws(extendHex(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/factorial/factorial.js b/test/factorial/factorial.js new file mode 100644 index 000000000..54182894d --- /dev/null +++ b/test/factorial/factorial.js @@ -0,0 +1,6 @@ +module.exports = n => +n < 0 +? (() => { +throw new TypeError('Negative numbers are not allowed!'); +})() +: n <= 1 ? 1 : n * factorial(n - 1); \ No newline at end of file diff --git a/test/factorial/factorial.test.js b/test/factorial/factorial.test.js new file mode 100644 index 000000000..57b5b86d9 --- /dev/null +++ b/test/factorial/factorial.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const factorial = require('./factorial.js'); + +test('Testing factorial', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof factorial === 'function', 'factorial is a Function'); + //t.deepEqual(factorial(args..), 'Expected'); + //t.equal(factorial(args..), 'Expected'); + //t.false(factorial(args..), 'Expected'); + //t.throws(factorial(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/factors/factors.js b/test/factors/factors.js new file mode 100644 index 000000000..4a70e86ba --- /dev/null +++ b/test/factors/factors.js @@ -0,0 +1,19 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/factors/factors.test.js b/test/factors/factors.test.js new file mode 100644 index 000000000..b2058c3e1 --- /dev/null +++ b/test/factors/factors.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const factors = require('./factors.js'); + +test('Testing factors', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof factors === 'function', 'factors is a Function'); + //t.deepEqual(factors(args..), 'Expected'); + //t.equal(factors(args..), 'Expected'); + //t.false(factors(args..), 'Expected'); + //t.throws(factors(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/fibonacci/fibonacci.js b/test/fibonacci/fibonacci.js new file mode 100644 index 000000000..3d01534fe --- /dev/null +++ b/test/fibonacci/fibonacci.js @@ -0,0 +1,5 @@ +module.exports = n => +Array.from({ length: n }).reduce( +(acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), +[] +); \ No newline at end of file diff --git a/test/fibonacci/fibonacci.test.js b/test/fibonacci/fibonacci.test.js new file mode 100644 index 000000000..ee8c3fcf0 --- /dev/null +++ b/test/fibonacci/fibonacci.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const fibonacci = require('./fibonacci.js'); + +test('Testing fibonacci', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof fibonacci === 'function', 'fibonacci is a Function'); + //t.deepEqual(fibonacci(args..), 'Expected'); + //t.equal(fibonacci(args..), 'Expected'); + //t.false(fibonacci(args..), 'Expected'); + //t.throws(fibonacci(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js new file mode 100644 index 000000000..a12f28e88 --- /dev/null +++ b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.js @@ -0,0 +1,2 @@ +module.exports = num => +Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2)); \ No newline at end of file diff --git a/test/fibonacciCountUntilNum/fibonacciCountUntilNum.test.js b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.test.js new file mode 100644 index 000000000..b8aa2498d --- /dev/null +++ b/test/fibonacciCountUntilNum/fibonacciCountUntilNum.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const fibonacciCountUntilNum = require('./fibonacciCountUntilNum.js'); + +test('Testing fibonacciCountUntilNum', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof fibonacciCountUntilNum === 'function', 'fibonacciCountUntilNum is a Function'); + //t.deepEqual(fibonacciCountUntilNum(args..), 'Expected'); + //t.equal(fibonacciCountUntilNum(args..), 'Expected'); + //t.false(fibonacciCountUntilNum(args..), 'Expected'); + //t.throws(fibonacciCountUntilNum(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/fibonacciUntilNum/fibonacciUntilNum.js b/test/fibonacciUntilNum/fibonacciUntilNum.js new file mode 100644 index 000000000..9966b1222 --- /dev/null +++ b/test/fibonacciUntilNum/fibonacciUntilNum.js @@ -0,0 +1,7 @@ +module.exports = 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), +[] +); +}; \ No newline at end of file diff --git a/test/fibonacciUntilNum/fibonacciUntilNum.test.js b/test/fibonacciUntilNum/fibonacciUntilNum.test.js new file mode 100644 index 000000000..603df0935 --- /dev/null +++ b/test/fibonacciUntilNum/fibonacciUntilNum.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const fibonacciUntilNum = require('./fibonacciUntilNum.js'); + +test('Testing fibonacciUntilNum', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof fibonacciUntilNum === 'function', 'fibonacciUntilNum is a Function'); + //t.deepEqual(fibonacciUntilNum(args..), 'Expected'); + //t.equal(fibonacciUntilNum(args..), 'Expected'); + //t.false(fibonacciUntilNum(args..), 'Expected'); + //t.throws(fibonacciUntilNum(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/filterNonUnique/filterNonUnique.js b/test/filterNonUnique/filterNonUnique.js new file mode 100644 index 000000000..ff9cc3257 --- /dev/null +++ b/test/filterNonUnique/filterNonUnique.js @@ -0,0 +1 @@ +module.exports = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i)); \ No newline at end of file diff --git a/test/filterNonUnique/filterNonUnique.test.js b/test/filterNonUnique/filterNonUnique.test.js new file mode 100644 index 000000000..6f2ecc9b8 --- /dev/null +++ b/test/filterNonUnique/filterNonUnique.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const filterNonUnique = require('./filterNonUnique.js'); + +test('Testing filterNonUnique', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof filterNonUnique === 'function', 'filterNonUnique is a Function'); + //t.deepEqual(filterNonUnique(args..), 'Expected'); + //t.equal(filterNonUnique(args..), 'Expected'); + //t.false(filterNonUnique(args..), 'Expected'); + //t.throws(filterNonUnique(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/flatten/flatten.js b/test/flatten/flatten.js new file mode 100644 index 000000000..0f37bc778 --- /dev/null +++ b/test/flatten/flatten.js @@ -0,0 +1 @@ +module.exports = arr => [].concat(...arr); \ No newline at end of file diff --git a/test/flatten/flatten.test.js b/test/flatten/flatten.test.js new file mode 100644 index 000000000..d6a3d03bd --- /dev/null +++ b/test/flatten/flatten.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const flatten = require('./flatten.js'); + +test('Testing flatten', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof flatten === 'function', 'flatten is a Function'); + //t.deepEqual(flatten(args..), 'Expected'); + //t.equal(flatten(args..), 'Expected'); + //t.false(flatten(args..), 'Expected'); + //t.throws(flatten(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/flattenDepth/flattenDepth.js b/test/flattenDepth/flattenDepth.js new file mode 100644 index 000000000..1ab16665a --- /dev/null +++ b/test/flattenDepth/flattenDepth.js @@ -0,0 +1,4 @@ +module.exports = (arr, depth = 1) => +depth != 1 +? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flattenDepth(v, depth - 1) : v), []) +: arr.reduce((a, v) => a.concat(v), []); \ No newline at end of file diff --git a/test/flattenDepth/flattenDepth.test.js b/test/flattenDepth/flattenDepth.test.js new file mode 100644 index 000000000..113fbce1e --- /dev/null +++ b/test/flattenDepth/flattenDepth.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const flattenDepth = require('./flattenDepth.js'); + +test('Testing flattenDepth', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof flattenDepth === 'function', 'flattenDepth is a Function'); + //t.deepEqual(flattenDepth(args..), 'Expected'); + //t.equal(flattenDepth(args..), 'Expected'); + //t.false(flattenDepth(args..), 'Expected'); + //t.throws(flattenDepth(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/flip/flip.js b/test/flip/flip.js new file mode 100644 index 000000000..4bac0428c --- /dev/null +++ b/test/flip/flip.js @@ -0,0 +1 @@ +module.exports = fn => (...args) => fn(args.pop(), ...args); \ No newline at end of file diff --git a/test/flip/flip.test.js b/test/flip/flip.test.js new file mode 100644 index 000000000..664c5df50 --- /dev/null +++ b/test/flip/flip.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const flip = require('./flip.js'); + +test('Testing flip', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof flip === 'function', 'flip is a Function'); + //t.deepEqual(flip(args..), 'Expected'); + //t.equal(flip(args..), 'Expected'); + //t.false(flip(args..), 'Expected'); + //t.throws(flip(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/forEachRight/forEachRight.js b/test/forEachRight/forEachRight.js new file mode 100644 index 000000000..2b8b0a526 --- /dev/null +++ b/test/forEachRight/forEachRight.js @@ -0,0 +1,5 @@ +module.exports = (arr, callback) => +arr +.slice(0) +.reverse() +.forEach(callback); \ No newline at end of file diff --git a/test/forEachRight/forEachRight.test.js b/test/forEachRight/forEachRight.test.js new file mode 100644 index 000000000..286035dd6 --- /dev/null +++ b/test/forEachRight/forEachRight.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const forEachRight = require('./forEachRight.js'); + +test('Testing forEachRight', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof forEachRight === 'function', 'forEachRight is a Function'); + //t.deepEqual(forEachRight(args..), 'Expected'); + //t.equal(forEachRight(args..), 'Expected'); + //t.false(forEachRight(args..), 'Expected'); + //t.throws(forEachRight(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/formatDuration/formatDuration.js b/test/formatDuration/formatDuration.js new file mode 100644 index 000000000..fe543e7fa --- /dev/null +++ b/test/formatDuration/formatDuration.js @@ -0,0 +1,14 @@ +module.exports = ms => { +if (ms < 0) ms = -ms; +const time = { +day: Math.floor(ms / 86400000), +hour: Math.floor(ms / 3600000) % 24, +minute: Math.floor(ms / 60000) % 60, +second: Math.floor(ms / 1000) % 60, +millisecond: Math.floor(ms) % 1000 +}; +return Object.entries(time) +.filter(val => val[1] !== 0) +.map(val => val[1] + ' ' + (val[1] !== 1 ? val[0] + 's' : val[0])) +.join(', '); +}; \ No newline at end of file diff --git a/test/formatDuration/formatDuration.test.js b/test/formatDuration/formatDuration.test.js new file mode 100644 index 000000000..2f78da56c --- /dev/null +++ b/test/formatDuration/formatDuration.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const formatDuration = require('./formatDuration.js'); + +test('Testing formatDuration', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof formatDuration === 'function', 'formatDuration is a Function'); + //t.deepEqual(formatDuration(args..), 'Expected'); + //t.equal(formatDuration(args..), 'Expected'); + //t.false(formatDuration(args..), 'Expected'); + //t.throws(formatDuration(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/fromCamelCase/fromCamelCase.js b/test/fromCamelCase/fromCamelCase.js new file mode 100644 index 000000000..811857bf2 --- /dev/null +++ b/test/fromCamelCase/fromCamelCase.js @@ -0,0 +1,5 @@ +module.exports = (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(); \ No newline at end of file diff --git a/test/fromCamelCase/fromCamelCase.test.js b/test/fromCamelCase/fromCamelCase.test.js new file mode 100644 index 000000000..54ce49502 --- /dev/null +++ b/test/fromCamelCase/fromCamelCase.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const fromCamelCase = require('./fromCamelCase.js'); + +test('Testing fromCamelCase', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof fromCamelCase === 'function', 'fromCamelCase is a Function'); + //t.deepEqual(fromCamelCase(args..), 'Expected'); + //t.equal(fromCamelCase(args..), 'Expected'); + //t.false(fromCamelCase(args..), 'Expected'); + //t.throws(fromCamelCase(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/functionName/functionName.js b/test/functionName/functionName.js new file mode 100644 index 000000000..a5248da94 --- /dev/null +++ b/test/functionName/functionName.js @@ -0,0 +1 @@ +module.exports = fn => (console.debug(fn.name), fn); \ No newline at end of file diff --git a/test/functionName/functionName.test.js b/test/functionName/functionName.test.js new file mode 100644 index 000000000..f377cb49f --- /dev/null +++ b/test/functionName/functionName.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const functionName = require('./functionName.js'); + +test('Testing functionName', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof functionName === 'function', 'functionName is a Function'); + //t.deepEqual(functionName(args..), 'Expected'); + //t.equal(functionName(args..), 'Expected'); + //t.false(functionName(args..), 'Expected'); + //t.throws(functionName(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/gcd/gcd.js b/test/gcd/gcd.js new file mode 100644 index 000000000..29e92d63f --- /dev/null +++ b/test/gcd/gcd.js @@ -0,0 +1,4 @@ +module.exports = (...arr) => { +const _gcd = (x, y) => (!y ? x : gcd(y, x % y)); +return [...arr].reduce((a, b) => _gcd(a, b)); +}; \ No newline at end of file diff --git a/test/gcd/gcd.test.js b/test/gcd/gcd.test.js new file mode 100644 index 000000000..e1904173d --- /dev/null +++ b/test/gcd/gcd.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const gcd = require('./gcd.js'); + +test('Testing gcd', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof gcd === 'function', 'gcd is a Function'); + //t.deepEqual(gcd(args..), 'Expected'); + //t.equal(gcd(args..), 'Expected'); + //t.false(gcd(args..), 'Expected'); + //t.throws(gcd(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/geometricProgression/geometricProgression.js b/test/geometricProgression/geometricProgression.js new file mode 100644 index 000000000..246fb224b --- /dev/null +++ b/test/geometricProgression/geometricProgression.js @@ -0,0 +1,4 @@ +module.exports = (end, start = 1, step = 2) => +Array.from({ length: Math.floor(Math.log(end / start) / Math.log(step)) + 1 }).map( +(v, i) => start * step ** i +); \ No newline at end of file diff --git a/test/geometricProgression/geometricProgression.test.js b/test/geometricProgression/geometricProgression.test.js new file mode 100644 index 000000000..d0f8d1e8e --- /dev/null +++ b/test/geometricProgression/geometricProgression.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const geometricProgression = require('./geometricProgression.js'); + +test('Testing geometricProgression', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof geometricProgression === 'function', 'geometricProgression is a Function'); + //t.deepEqual(geometricProgression(args..), 'Expected'); + //t.equal(geometricProgression(args..), 'Expected'); + //t.false(geometricProgression(args..), 'Expected'); + //t.throws(geometricProgression(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js new file mode 100644 index 000000000..a8abc567f --- /dev/null +++ b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.js @@ -0,0 +1,2 @@ +module.exports = (dateInitial, dateFinal) => +(dateFinal - dateInitial) / (1000 * 3600 * 24); \ No newline at end of file diff --git a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js new file mode 100644 index 000000000..212843605 --- /dev/null +++ b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const getDaysDiffBetweenDates = require('./getDaysDiffBetweenDates.js'); + +test('Testing getDaysDiffBetweenDates', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof getDaysDiffBetweenDates === 'function', 'getDaysDiffBetweenDates is a Function'); + //t.deepEqual(getDaysDiffBetweenDates(args..), 'Expected'); + //t.equal(getDaysDiffBetweenDates(args..), 'Expected'); + //t.false(getDaysDiffBetweenDates(args..), 'Expected'); + //t.throws(getDaysDiffBetweenDates(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/getScrollPosition/getScrollPosition.js b/test/getScrollPosition/getScrollPosition.js new file mode 100644 index 000000000..89fcdc0f8 --- /dev/null +++ b/test/getScrollPosition/getScrollPosition.js @@ -0,0 +1,4 @@ +module.exports = (el = window) => ({ +x: el.pageXOffset !== undefined ? el.pageXOffset : el.scrollLeft, +y: el.pageYOffset !== undefined ? el.pageYOffset : el.scrollTop +}); \ No newline at end of file diff --git a/test/getScrollPosition/getScrollPosition.test.js b/test/getScrollPosition/getScrollPosition.test.js new file mode 100644 index 000000000..ef46dac55 --- /dev/null +++ b/test/getScrollPosition/getScrollPosition.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const getScrollPosition = require('./getScrollPosition.js'); + +test('Testing getScrollPosition', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof getScrollPosition === 'function', 'getScrollPosition is a Function'); + //t.deepEqual(getScrollPosition(args..), 'Expected'); + //t.equal(getScrollPosition(args..), 'Expected'); + //t.false(getScrollPosition(args..), 'Expected'); + //t.throws(getScrollPosition(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/getStyle/getStyle.js b/test/getStyle/getStyle.js new file mode 100644 index 000000000..8291b4cbc --- /dev/null +++ b/test/getStyle/getStyle.js @@ -0,0 +1 @@ +module.exports = (el, ruleName) => getComputedStyle(el)[ruleName]; \ No newline at end of file diff --git a/test/getStyle/getStyle.test.js b/test/getStyle/getStyle.test.js new file mode 100644 index 000000000..6fed01e98 --- /dev/null +++ b/test/getStyle/getStyle.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const getStyle = require('./getStyle.js'); + +test('Testing getStyle', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof getStyle === 'function', 'getStyle is a Function'); + //t.deepEqual(getStyle(args..), 'Expected'); + //t.equal(getStyle(args..), 'Expected'); + //t.false(getStyle(args..), 'Expected'); + //t.throws(getStyle(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/getType/getType.js b/test/getType/getType.js new file mode 100644 index 000000000..757470fbb --- /dev/null +++ b/test/getType/getType.js @@ -0,0 +1,2 @@ +module.exports = v => +v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); \ No newline at end of file diff --git a/test/getType/getType.test.js b/test/getType/getType.test.js new file mode 100644 index 000000000..18d277ff7 --- /dev/null +++ b/test/getType/getType.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const getType = require('./getType.js'); + +test('Testing getType', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof getType === 'function', 'getType is a Function'); + //t.deepEqual(getType(args..), 'Expected'); + //t.equal(getType(args..), 'Expected'); + //t.false(getType(args..), 'Expected'); + //t.throws(getType(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/getURLParameters/getURLParameters.js b/test/getURLParameters/getURLParameters.js new file mode 100644 index 000000000..326bf6a0d --- /dev/null +++ b/test/getURLParameters/getURLParameters.js @@ -0,0 +1,4 @@ +module.exports = url => +url +.match(/([^?=&]+)(=([^&]*))/g) +.reduce((a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), {}); \ No newline at end of file diff --git a/test/getURLParameters/getURLParameters.test.js b/test/getURLParameters/getURLParameters.test.js new file mode 100644 index 000000000..26c16be40 --- /dev/null +++ b/test/getURLParameters/getURLParameters.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const getURLParameters = require('./getURLParameters.js'); + +test('Testing getURLParameters', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof getURLParameters === 'function', 'getURLParameters is a Function'); + //t.deepEqual(getURLParameters(args..), 'Expected'); + //t.equal(getURLParameters(args..), 'Expected'); + //t.false(getURLParameters(args..), 'Expected'); + //t.throws(getURLParameters(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/groupBy/groupBy.js b/test/groupBy/groupBy.js new file mode 100644 index 000000000..bf9b8ff36 --- /dev/null +++ b/test/groupBy/groupBy.js @@ -0,0 +1,5 @@ +module.exports = (arr, func) => +arr.map(typeof func === 'function' ? func : val => val[func]).reduce((acc, val, i) => { +acc[val] = (acc[val] || []).concat(arr[i]); +return acc; +}, {}); \ No newline at end of file diff --git a/test/groupBy/groupBy.test.js b/test/groupBy/groupBy.test.js new file mode 100644 index 000000000..5cea893b4 --- /dev/null +++ b/test/groupBy/groupBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const groupBy = require('./groupBy.js'); + +test('Testing groupBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof groupBy === 'function', 'groupBy is a Function'); + //t.deepEqual(groupBy(args..), 'Expected'); + //t.equal(groupBy(args..), 'Expected'); + //t.false(groupBy(args..), 'Expected'); + //t.throws(groupBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/hammingDistance/hammingDistance.js b/test/hammingDistance/hammingDistance.js new file mode 100644 index 000000000..3d97f1bd9 --- /dev/null +++ b/test/hammingDistance/hammingDistance.js @@ -0,0 +1 @@ +module.exports = (num1, num2) => ((num1 ^ num2).toString(2).match(/1/g) || '').length; \ No newline at end of file diff --git a/test/hammingDistance/hammingDistance.test.js b/test/hammingDistance/hammingDistance.test.js new file mode 100644 index 000000000..7c6c2bf55 --- /dev/null +++ b/test/hammingDistance/hammingDistance.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const hammingDistance = require('./hammingDistance.js'); + +test('Testing hammingDistance', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof hammingDistance === 'function', 'hammingDistance is a Function'); + //t.deepEqual(hammingDistance(args..), 'Expected'); + //t.equal(hammingDistance(args..), 'Expected'); + //t.false(hammingDistance(args..), 'Expected'); + //t.throws(hammingDistance(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/hasClass/hasClass.js b/test/hasClass/hasClass.js new file mode 100644 index 000000000..66a974af3 --- /dev/null +++ b/test/hasClass/hasClass.js @@ -0,0 +1 @@ +module.exports = (el, className) => el.classList.contains(className); \ No newline at end of file diff --git a/test/hasClass/hasClass.test.js b/test/hasClass/hasClass.test.js new file mode 100644 index 000000000..f70f22d73 --- /dev/null +++ b/test/hasClass/hasClass.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const hasClass = require('./hasClass.js'); + +test('Testing hasClass', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof hasClass === 'function', 'hasClass is a Function'); + //t.deepEqual(hasClass(args..), 'Expected'); + //t.equal(hasClass(args..), 'Expected'); + //t.false(hasClass(args..), 'Expected'); + //t.throws(hasClass(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/hasFlags/hasFlags.js b/test/hasFlags/hasFlags.js new file mode 100644 index 000000000..7ea90bb31 --- /dev/null +++ b/test/hasFlags/hasFlags.js @@ -0,0 +1,2 @@ +module.exports = (...flags) => +flags.every(flag => process.argv.includes(/^-{1,2}/.test(flag) ? flag : '--' + flag)); \ No newline at end of file diff --git a/test/hasFlags/hasFlags.test.js b/test/hasFlags/hasFlags.test.js new file mode 100644 index 000000000..9425e55d9 --- /dev/null +++ b/test/hasFlags/hasFlags.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const hasFlags = require('./hasFlags.js'); + +test('Testing hasFlags', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof hasFlags === 'function', 'hasFlags is a Function'); + //t.deepEqual(hasFlags(args..), 'Expected'); + //t.equal(hasFlags(args..), 'Expected'); + //t.false(hasFlags(args..), 'Expected'); + //t.throws(hasFlags(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/head/head.js b/test/head/head.js new file mode 100644 index 000000000..9d7a9c835 --- /dev/null +++ b/test/head/head.js @@ -0,0 +1 @@ +module.exports = arr => arr[0]; \ No newline at end of file diff --git a/test/head/head.test.js b/test/head/head.test.js new file mode 100644 index 000000000..6fa71f79e --- /dev/null +++ b/test/head/head.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const head = require('./head.js'); + +test('Testing head', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof head === 'function', 'head is a Function'); + //t.deepEqual(head(args..), 'Expected'); + //t.equal(head(args..), 'Expected'); + //t.false(head(args..), 'Expected'); + //t.throws(head(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/hexToRGB/hexToRGB.js b/test/hexToRGB/hexToRGB.js new file mode 100644 index 000000000..9565014b3 --- /dev/null +++ b/test/hexToRGB/hexToRGB.js @@ -0,0 +1,19 @@ +module.exports = 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}` : '') + +')' +); +}; \ No newline at end of file diff --git a/test/hexToRGB/hexToRGB.test.js b/test/hexToRGB/hexToRGB.test.js new file mode 100644 index 000000000..2fb77b200 --- /dev/null +++ b/test/hexToRGB/hexToRGB.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const hexToRGB = require('./hexToRGB.js'); + +test('Testing hexToRGB', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof hexToRGB === 'function', 'hexToRGB is a Function'); + //t.deepEqual(hexToRGB(args..), 'Expected'); + //t.equal(hexToRGB(args..), 'Expected'); + //t.false(hexToRGB(args..), 'Expected'); + //t.throws(hexToRGB(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/hide/hide.js b/test/hide/hide.js new file mode 100644 index 000000000..eab52028f --- /dev/null +++ b/test/hide/hide.js @@ -0,0 +1 @@ +module.exports = (...el) => [...el].forEach(e => (e.style.display = 'none')); \ No newline at end of file diff --git a/test/hide/hide.test.js b/test/hide/hide.test.js new file mode 100644 index 000000000..9746171a3 --- /dev/null +++ b/test/hide/hide.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const hide = require('./hide.js'); + +test('Testing hide', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof hide === 'function', 'hide is a Function'); + //t.deepEqual(hide(args..), 'Expected'); + //t.equal(hide(args..), 'Expected'); + //t.false(hide(args..), 'Expected'); + //t.throws(hide(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/howManyTimes/howManyTimes.js b/test/howManyTimes/howManyTimes.js new file mode 100644 index 000000000..7eefb7ecd --- /dev/null +++ b/test/howManyTimes/howManyTimes.js @@ -0,0 +1,10 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/howManyTimes/howManyTimes.test.js b/test/howManyTimes/howManyTimes.test.js new file mode 100644 index 000000000..98fc00b85 --- /dev/null +++ b/test/howManyTimes/howManyTimes.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const howManyTimes = require('./howManyTimes.js'); + +test('Testing howManyTimes', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof howManyTimes === 'function', 'howManyTimes is a Function'); + //t.deepEqual(howManyTimes(args..), 'Expected'); + //t.equal(howManyTimes(args..), 'Expected'); + //t.false(howManyTimes(args..), 'Expected'); + //t.throws(howManyTimes(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/httpsRedirect/httpsRedirect.js b/test/httpsRedirect/httpsRedirect.js new file mode 100644 index 000000000..a84e98245 --- /dev/null +++ b/test/httpsRedirect/httpsRedirect.js @@ -0,0 +1,3 @@ +module.exports = () => { +if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]); +}; \ No newline at end of file diff --git a/test/httpsRedirect/httpsRedirect.test.js b/test/httpsRedirect/httpsRedirect.test.js new file mode 100644 index 000000000..dbd08805a --- /dev/null +++ b/test/httpsRedirect/httpsRedirect.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const httpsRedirect = require('./httpsRedirect.js'); + +test('Testing httpsRedirect', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof httpsRedirect === 'function', 'httpsRedirect is a Function'); + //t.deepEqual(httpsRedirect(args..), 'Expected'); + //t.equal(httpsRedirect(args..), 'Expected'); + //t.false(httpsRedirect(args..), 'Expected'); + //t.throws(httpsRedirect(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/inRange/inRange.js b/test/inRange/inRange.js new file mode 100644 index 000000000..aa644918e --- /dev/null +++ b/test/inRange/inRange.js @@ -0,0 +1,4 @@ +module.exports = (n, start, end = null) => { +if (end && start > end) end = [start, (start = end)][0]; +return end == null ? n >= 0 && n < start : n >= start && n < end; +}; \ No newline at end of file diff --git a/test/inRange/inRange.test.js b/test/inRange/inRange.test.js new file mode 100644 index 000000000..b3b5220dd --- /dev/null +++ b/test/inRange/inRange.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const inRange = require('./inRange.js'); + +test('Testing inRange', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof inRange === 'function', 'inRange is a Function'); + //t.deepEqual(inRange(args..), 'Expected'); + //t.equal(inRange(args..), 'Expected'); + //t.false(inRange(args..), 'Expected'); + //t.throws(inRange(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/indexOfAll/indexOfAll.js b/test/indexOfAll/indexOfAll.js new file mode 100644 index 000000000..f0a31bf3d --- /dev/null +++ b/test/indexOfAll/indexOfAll.js @@ -0,0 +1,5 @@ +module.exports = (arr, val) => { +const indices = []; +arr.forEach((el, i) => el === val && indices.push(i)); +return indices; +}; \ No newline at end of file diff --git a/test/indexOfAll/indexOfAll.test.js b/test/indexOfAll/indexOfAll.test.js new file mode 100644 index 000000000..e1d7bd4ce --- /dev/null +++ b/test/indexOfAll/indexOfAll.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const indexOfAll = require('./indexOfAll.js'); + +test('Testing indexOfAll', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof indexOfAll === 'function', 'indexOfAll is a Function'); + //t.deepEqual(indexOfAll(args..), 'Expected'); + //t.equal(indexOfAll(args..), 'Expected'); + //t.false(indexOfAll(args..), 'Expected'); + //t.throws(indexOfAll(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/initial/initial.js b/test/initial/initial.js new file mode 100644 index 000000000..070dfca5f --- /dev/null +++ b/test/initial/initial.js @@ -0,0 +1 @@ +module.exports = arr => arr.slice(0, -1); \ No newline at end of file diff --git a/test/initial/initial.test.js b/test/initial/initial.test.js new file mode 100644 index 000000000..aab9bfc6c --- /dev/null +++ b/test/initial/initial.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const initial = require('./initial.js'); + +test('Testing initial', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof initial === 'function', 'initial is a Function'); + //t.deepEqual(initial(args..), 'Expected'); + //t.equal(initial(args..), 'Expected'); + //t.false(initial(args..), 'Expected'); + //t.throws(initial(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/initialize2DArray/initialize2DArray.js b/test/initialize2DArray/initialize2DArray.js new file mode 100644 index 000000000..e699b90d5 --- /dev/null +++ b/test/initialize2DArray/initialize2DArray.js @@ -0,0 +1,4 @@ +module.exports = (w, h, val = null) => +Array(h) +.fill() +.map(() => Array(w).fill(val)); \ No newline at end of file diff --git a/test/initialize2DArray/initialize2DArray.test.js b/test/initialize2DArray/initialize2DArray.test.js new file mode 100644 index 000000000..d6446233f --- /dev/null +++ b/test/initialize2DArray/initialize2DArray.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const initialize2DArray = require('./initialize2DArray.js'); + +test('Testing initialize2DArray', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof initialize2DArray === 'function', 'initialize2DArray is a Function'); + //t.deepEqual(initialize2DArray(args..), 'Expected'); + //t.equal(initialize2DArray(args..), 'Expected'); + //t.false(initialize2DArray(args..), 'Expected'); + //t.throws(initialize2DArray(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.js b/test/initializeArrayWithRange/initializeArrayWithRange.js new file mode 100644 index 000000000..2873d15ae --- /dev/null +++ b/test/initializeArrayWithRange/initializeArrayWithRange.js @@ -0,0 +1,2 @@ +module.exports = (end, start = 0, step = 1) => +Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i) => i * step + start); \ No newline at end of file diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.test.js b/test/initializeArrayWithRange/initializeArrayWithRange.test.js new file mode 100644 index 000000000..324765aea --- /dev/null +++ b/test/initializeArrayWithRange/initializeArrayWithRange.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const initializeArrayWithRange = require('./initializeArrayWithRange.js'); + +test('Testing initializeArrayWithRange', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof initializeArrayWithRange === 'function', 'initializeArrayWithRange is a Function'); + //t.deepEqual(initializeArrayWithRange(args..), 'Expected'); + //t.equal(initializeArrayWithRange(args..), 'Expected'); + //t.false(initializeArrayWithRange(args..), 'Expected'); + //t.throws(initializeArrayWithRange(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.js b/test/initializeArrayWithValues/initializeArrayWithValues.js new file mode 100644 index 000000000..0d2bbce4b --- /dev/null +++ b/test/initializeArrayWithValues/initializeArrayWithValues.js @@ -0,0 +1 @@ +module.exports = (n, val = 0) => Array(n).fill(val); \ No newline at end of file diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.test.js b/test/initializeArrayWithValues/initializeArrayWithValues.test.js new file mode 100644 index 000000000..4ce38dab5 --- /dev/null +++ b/test/initializeArrayWithValues/initializeArrayWithValues.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const initializeArrayWithValues = require('./initializeArrayWithValues.js'); + +test('Testing initializeArrayWithValues', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof initializeArrayWithValues === 'function', 'initializeArrayWithValues is a Function'); + //t.deepEqual(initializeArrayWithValues(args..), 'Expected'); + //t.equal(initializeArrayWithValues(args..), 'Expected'); + //t.false(initializeArrayWithValues(args..), 'Expected'); + //t.throws(initializeArrayWithValues(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/intersection/intersection.js b/test/intersection/intersection.js new file mode 100644 index 000000000..c2b3f0a01 --- /dev/null +++ b/test/intersection/intersection.js @@ -0,0 +1,4 @@ +module.exports = (a, b) => { +const s = new Set(b); +return a.filter(x => s.has(x)); +}; \ No newline at end of file diff --git a/test/intersection/intersection.test.js b/test/intersection/intersection.test.js new file mode 100644 index 000000000..a0ca3cf05 --- /dev/null +++ b/test/intersection/intersection.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const intersection = require('./intersection.js'); + +test('Testing intersection', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof intersection === 'function', 'intersection is a Function'); + //t.deepEqual(intersection(args..), 'Expected'); + //t.equal(intersection(args..), 'Expected'); + //t.false(intersection(args..), 'Expected'); + //t.throws(intersection(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/invertKeyValues/invertKeyValues.js b/test/invertKeyValues/invertKeyValues.js new file mode 100644 index 000000000..3023d7018 --- /dev/null +++ b/test/invertKeyValues/invertKeyValues.js @@ -0,0 +1,5 @@ +module.exports = obj => +Object.keys(obj).reduce((acc, key) => { +acc[obj[key]] = key; +return acc; +}, {}); \ No newline at end of file diff --git a/test/invertKeyValues/invertKeyValues.test.js b/test/invertKeyValues/invertKeyValues.test.js new file mode 100644 index 000000000..86d78ec71 --- /dev/null +++ b/test/invertKeyValues/invertKeyValues.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const invertKeyValues = require('./invertKeyValues.js'); + +test('Testing invertKeyValues', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof invertKeyValues === 'function', 'invertKeyValues is a Function'); + //t.deepEqual(invertKeyValues(args..), 'Expected'); + //t.equal(invertKeyValues(args..), 'Expected'); + //t.false(invertKeyValues(args..), 'Expected'); + //t.throws(invertKeyValues(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isAbsoluteURL/isAbsoluteURL.js b/test/isAbsoluteURL/isAbsoluteURL.js new file mode 100644 index 000000000..edec7af0b --- /dev/null +++ b/test/isAbsoluteURL/isAbsoluteURL.js @@ -0,0 +1 @@ +module.exports = str => /^[a-z][a-z0-9+.-]*:/.test(str); \ No newline at end of file diff --git a/test/isAbsoluteURL/isAbsoluteURL.test.js b/test/isAbsoluteURL/isAbsoluteURL.test.js new file mode 100644 index 000000000..b19acb143 --- /dev/null +++ b/test/isAbsoluteURL/isAbsoluteURL.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isAbsoluteURL = require('./isAbsoluteURL.js'); + +test('Testing isAbsoluteURL', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isAbsoluteURL === 'function', 'isAbsoluteURL is a Function'); + //t.deepEqual(isAbsoluteURL(args..), 'Expected'); + //t.equal(isAbsoluteURL(args..), 'Expected'); + //t.false(isAbsoluteURL(args..), 'Expected'); + //t.throws(isAbsoluteURL(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isArmstrongNumber/isArmstrongNumber.js b/test/isArmstrongNumber/isArmstrongNumber.js new file mode 100644 index 000000000..916550639 --- /dev/null +++ b/test/isArmstrongNumber/isArmstrongNumber.js @@ -0,0 +1,4 @@ +module.exports = digits => +(arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)( +(digits + '').split('') +); \ No newline at end of file diff --git a/test/isArmstrongNumber/isArmstrongNumber.test.js b/test/isArmstrongNumber/isArmstrongNumber.test.js new file mode 100644 index 000000000..d3e32e507 --- /dev/null +++ b/test/isArmstrongNumber/isArmstrongNumber.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isArmstrongNumber = require('./isArmstrongNumber.js'); + +test('Testing isArmstrongNumber', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isArmstrongNumber === 'function', 'isArmstrongNumber is a Function'); + //t.deepEqual(isArmstrongNumber(args..), 'Expected'); + //t.equal(isArmstrongNumber(args..), 'Expected'); + //t.false(isArmstrongNumber(args..), 'Expected'); + //t.throws(isArmstrongNumber(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isArray/isArray.js b/test/isArray/isArray.js new file mode 100644 index 000000000..771748c70 --- /dev/null +++ b/test/isArray/isArray.js @@ -0,0 +1 @@ +module.exports = val => Array.isArray(val); \ No newline at end of file diff --git a/test/isArray/isArray.test.js b/test/isArray/isArray.test.js new file mode 100644 index 000000000..c225d3bf1 --- /dev/null +++ b/test/isArray/isArray.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isArray = require('./isArray.js'); + +test('Testing isArray', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isArray === 'function', 'isArray is a Function'); + //t.deepEqual(isArray(args..), 'Expected'); + //t.equal(isArray(args..), 'Expected'); + //t.false(isArray(args..), 'Expected'); + //t.throws(isArray(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isArrayLike/isArrayLike.js b/test/isArrayLike/isArrayLike.js new file mode 100644 index 000000000..2844bc0ee --- /dev/null +++ b/test/isArrayLike/isArrayLike.js @@ -0,0 +1,7 @@ +module.exports = val => { +try { +return [...val], true; +} catch (e) { +return false; +} +}; \ No newline at end of file diff --git a/test/isArrayLike/isArrayLike.test.js b/test/isArrayLike/isArrayLike.test.js new file mode 100644 index 000000000..d8a528c05 --- /dev/null +++ b/test/isArrayLike/isArrayLike.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isArrayLike = require('./isArrayLike.js'); + +test('Testing isArrayLike', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isArrayLike === 'function', 'isArrayLike is a Function'); + //t.deepEqual(isArrayLike(args..), 'Expected'); + //t.equal(isArrayLike(args..), 'Expected'); + //t.false(isArrayLike(args..), 'Expected'); + //t.throws(isArrayLike(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isBoolean/isBoolean.js b/test/isBoolean/isBoolean.js new file mode 100644 index 000000000..e716ff21f --- /dev/null +++ b/test/isBoolean/isBoolean.js @@ -0,0 +1 @@ +module.exports = val => typeof val === 'boolean'; \ No newline at end of file diff --git a/test/isBoolean/isBoolean.test.js b/test/isBoolean/isBoolean.test.js new file mode 100644 index 000000000..bc0f09b3d --- /dev/null +++ b/test/isBoolean/isBoolean.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isBoolean = require('./isBoolean.js'); + +test('Testing isBoolean', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isBoolean === 'function', 'isBoolean is a Function'); + //t.deepEqual(isBoolean(args..), 'Expected'); + //t.equal(isBoolean(args..), 'Expected'); + //t.false(isBoolean(args..), 'Expected'); + //t.throws(isBoolean(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isDivisible/isDivisible.js b/test/isDivisible/isDivisible.js new file mode 100644 index 000000000..d2adb8267 --- /dev/null +++ b/test/isDivisible/isDivisible.js @@ -0,0 +1 @@ +module.exports = (dividend, divisor) => dividend % divisor === 0; \ No newline at end of file diff --git a/test/isDivisible/isDivisible.test.js b/test/isDivisible/isDivisible.test.js new file mode 100644 index 000000000..be73cdba5 --- /dev/null +++ b/test/isDivisible/isDivisible.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isDivisible = require('./isDivisible.js'); + +test('Testing isDivisible', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isDivisible === 'function', 'isDivisible is a Function'); + //t.deepEqual(isDivisible(args..), 'Expected'); + //t.equal(isDivisible(args..), 'Expected'); + //t.false(isDivisible(args..), 'Expected'); + //t.throws(isDivisible(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isEven/isEven.js b/test/isEven/isEven.js new file mode 100644 index 000000000..bdbcc7967 --- /dev/null +++ b/test/isEven/isEven.js @@ -0,0 +1 @@ +module.exports = num => num % 2 === 0; \ No newline at end of file diff --git a/test/isEven/isEven.test.js b/test/isEven/isEven.test.js new file mode 100644 index 000000000..d6a540d56 --- /dev/null +++ b/test/isEven/isEven.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isEven = require('./isEven.js'); + +test('Testing isEven', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isEven === 'function', 'isEven is a Function'); + //t.deepEqual(isEven(args..), 'Expected'); + //t.equal(isEven(args..), 'Expected'); + //t.false(isEven(args..), 'Expected'); + //t.throws(isEven(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isFunction/isFunction.js b/test/isFunction/isFunction.js new file mode 100644 index 000000000..5a4f96273 --- /dev/null +++ b/test/isFunction/isFunction.js @@ -0,0 +1 @@ +module.exports = val => typeof val === 'function'; \ No newline at end of file diff --git a/test/isFunction/isFunction.test.js b/test/isFunction/isFunction.test.js new file mode 100644 index 000000000..749f79665 --- /dev/null +++ b/test/isFunction/isFunction.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isFunction = require('./isFunction.js'); + +test('Testing isFunction', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isFunction === 'function', 'isFunction is a Function'); + //t.deepEqual(isFunction(args..), 'Expected'); + //t.equal(isFunction(args..), 'Expected'); + //t.false(isFunction(args..), 'Expected'); + //t.throws(isFunction(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isLowerCase/isLowerCase.js b/test/isLowerCase/isLowerCase.js new file mode 100644 index 000000000..1bf9ed7d9 --- /dev/null +++ b/test/isLowerCase/isLowerCase.js @@ -0,0 +1 @@ +module.exports = str => str === str.toLowerCase(); \ No newline at end of file diff --git a/test/isLowerCase/isLowerCase.test.js b/test/isLowerCase/isLowerCase.test.js new file mode 100644 index 000000000..c18cd36c1 --- /dev/null +++ b/test/isLowerCase/isLowerCase.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isLowerCase = require('./isLowerCase.js'); + +test('Testing isLowerCase', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isLowerCase === 'function', 'isLowerCase is a Function'); + //t.deepEqual(isLowerCase(args..), 'Expected'); + //t.equal(isLowerCase(args..), 'Expected'); + //t.false(isLowerCase(args..), 'Expected'); + //t.throws(isLowerCase(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isNull/isNull.js b/test/isNull/isNull.js new file mode 100644 index 000000000..3f1ce4693 --- /dev/null +++ b/test/isNull/isNull.js @@ -0,0 +1 @@ +module.exports = val => val === null; \ No newline at end of file diff --git a/test/isNull/isNull.test.js b/test/isNull/isNull.test.js new file mode 100644 index 000000000..74ae0ff89 --- /dev/null +++ b/test/isNull/isNull.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isNull = require('./isNull.js'); + +test('Testing isNull', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isNull === 'function', 'isNull is a Function'); + //t.deepEqual(isNull(args..), 'Expected'); + //t.equal(isNull(args..), 'Expected'); + //t.false(isNull(args..), 'Expected'); + //t.throws(isNull(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isNumber/isNumber.js b/test/isNumber/isNumber.js new file mode 100644 index 000000000..ae05b7b27 --- /dev/null +++ b/test/isNumber/isNumber.js @@ -0,0 +1 @@ +module.exports = val => typeof val === 'number'; \ No newline at end of file diff --git a/test/isNumber/isNumber.test.js b/test/isNumber/isNumber.test.js new file mode 100644 index 000000000..5a88f88bd --- /dev/null +++ b/test/isNumber/isNumber.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isNumber = require('./isNumber.js'); + +test('Testing isNumber', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isNumber === 'function', 'isNumber is a Function'); + //t.deepEqual(isNumber(args..), 'Expected'); + //t.equal(isNumber(args..), 'Expected'); + //t.false(isNumber(args..), 'Expected'); + //t.throws(isNumber(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isPrime/isPrime.js b/test/isPrime/isPrime.js new file mode 100644 index 000000000..afcc919c4 --- /dev/null +++ b/test/isPrime/isPrime.js @@ -0,0 +1,5 @@ +module.exports = num => { +const boundary = Math.floor(Math.sqrt(num)); +for (var i = 2; i <= boundary; i++) if (num % i == 0) return false; +return num >= 2; +}; \ No newline at end of file diff --git a/test/isPrime/isPrime.test.js b/test/isPrime/isPrime.test.js new file mode 100644 index 000000000..38f26e3df --- /dev/null +++ b/test/isPrime/isPrime.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isPrime = require('./isPrime.js'); + +test('Testing isPrime', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isPrime === 'function', 'isPrime is a Function'); + //t.deepEqual(isPrime(args..), 'Expected'); + //t.equal(isPrime(args..), 'Expected'); + //t.false(isPrime(args..), 'Expected'); + //t.throws(isPrime(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isPrimitive/isPrimitive.js b/test/isPrimitive/isPrimitive.js new file mode 100644 index 000000000..2dea7dc1f --- /dev/null +++ b/test/isPrimitive/isPrimitive.js @@ -0,0 +1 @@ +module.exports = val => !['object', 'function'].includes(typeof val) || val === null; \ No newline at end of file diff --git a/test/isPrimitive/isPrimitive.test.js b/test/isPrimitive/isPrimitive.test.js new file mode 100644 index 000000000..dfc8df348 --- /dev/null +++ b/test/isPrimitive/isPrimitive.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isPrimitive = require('./isPrimitive.js'); + +test('Testing isPrimitive', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isPrimitive === 'function', 'isPrimitive is a Function'); + //t.deepEqual(isPrimitive(args..), 'Expected'); + //t.equal(isPrimitive(args..), 'Expected'); + //t.false(isPrimitive(args..), 'Expected'); + //t.throws(isPrimitive(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isPromiseLike/isPromiseLike.js b/test/isPromiseLike/isPromiseLike.js new file mode 100644 index 000000000..7887a0663 --- /dev/null +++ b/test/isPromiseLike/isPromiseLike.js @@ -0,0 +1,4 @@ +module.exports = obj => +obj !== null && +(typeof obj === 'object' || typeof obj === 'function') && +typeof obj.then === 'function'; \ No newline at end of file diff --git a/test/isPromiseLike/isPromiseLike.test.js b/test/isPromiseLike/isPromiseLike.test.js new file mode 100644 index 000000000..2a8234343 --- /dev/null +++ b/test/isPromiseLike/isPromiseLike.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isPromiseLike = require('./isPromiseLike.js'); + +test('Testing isPromiseLike', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isPromiseLike === 'function', 'isPromiseLike is a Function'); + //t.deepEqual(isPromiseLike(args..), 'Expected'); + //t.equal(isPromiseLike(args..), 'Expected'); + //t.false(isPromiseLike(args..), 'Expected'); + //t.throws(isPromiseLike(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isSorted/isSorted.js b/test/isSorted/isSorted.js new file mode 100644 index 000000000..214ee8f17 --- /dev/null +++ b/test/isSorted/isSorted.js @@ -0,0 +1,6 @@ +module.exports = arr => { +const direction = arr[0] > arr[1] ? -1 : 1; +for (let [i, val] of arr.entries()) +if (i === arr.length - 1) return direction; +else if ((val - arr[i + 1]) * direction > 0) return 0; +}; \ No newline at end of file diff --git a/test/isSorted/isSorted.test.js b/test/isSorted/isSorted.test.js new file mode 100644 index 000000000..b41aef9ef --- /dev/null +++ b/test/isSorted/isSorted.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isSorted = require('./isSorted.js'); + +test('Testing isSorted', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isSorted === 'function', 'isSorted is a Function'); + //t.deepEqual(isSorted(args..), 'Expected'); + //t.equal(isSorted(args..), 'Expected'); + //t.false(isSorted(args..), 'Expected'); + //t.throws(isSorted(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isString/isString.js b/test/isString/isString.js new file mode 100644 index 000000000..be1377c7b --- /dev/null +++ b/test/isString/isString.js @@ -0,0 +1 @@ +module.exports = val => typeof val === 'string'; \ No newline at end of file diff --git a/test/isString/isString.test.js b/test/isString/isString.test.js new file mode 100644 index 000000000..c3b892e27 --- /dev/null +++ b/test/isString/isString.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isString = require('./isString.js'); + +test('Testing isString', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isString === 'function', 'isString is a Function'); + //t.deepEqual(isString(args..), 'Expected'); + //t.equal(isString(args..), 'Expected'); + //t.false(isString(args..), 'Expected'); + //t.throws(isString(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isSymbol/isSymbol.js b/test/isSymbol/isSymbol.js new file mode 100644 index 000000000..63d623028 --- /dev/null +++ b/test/isSymbol/isSymbol.js @@ -0,0 +1 @@ +module.exports = val => typeof val === 'symbol'; \ No newline at end of file diff --git a/test/isSymbol/isSymbol.test.js b/test/isSymbol/isSymbol.test.js new file mode 100644 index 000000000..cb7deda3e --- /dev/null +++ b/test/isSymbol/isSymbol.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isSymbol = require('./isSymbol.js'); + +test('Testing isSymbol', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isSymbol === 'function', 'isSymbol is a Function'); + //t.deepEqual(isSymbol(args..), 'Expected'); + //t.equal(isSymbol(args..), 'Expected'); + //t.false(isSymbol(args..), 'Expected'); + //t.throws(isSymbol(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isTravisCI/isTravisCI.js b/test/isTravisCI/isTravisCI.js new file mode 100644 index 000000000..6fb689900 --- /dev/null +++ b/test/isTravisCI/isTravisCI.js @@ -0,0 +1 @@ +module.exports = () => 'TRAVIS' in process.env && 'CI' in process.env; \ No newline at end of file diff --git a/test/isTravisCI/isTravisCI.test.js b/test/isTravisCI/isTravisCI.test.js new file mode 100644 index 000000000..e6278bcaf --- /dev/null +++ b/test/isTravisCI/isTravisCI.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isTravisCI = require('./isTravisCI.js'); + +test('Testing isTravisCI', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isTravisCI === 'function', 'isTravisCI is a Function'); + //t.deepEqual(isTravisCI(args..), 'Expected'); + //t.equal(isTravisCI(args..), 'Expected'); + //t.false(isTravisCI(args..), 'Expected'); + //t.throws(isTravisCI(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isUpperCase/isUpperCase.js b/test/isUpperCase/isUpperCase.js new file mode 100644 index 000000000..374a20638 --- /dev/null +++ b/test/isUpperCase/isUpperCase.js @@ -0,0 +1 @@ +module.exports = str => str === str.toUpperCase(); \ No newline at end of file diff --git a/test/isUpperCase/isUpperCase.test.js b/test/isUpperCase/isUpperCase.test.js new file mode 100644 index 000000000..9bc274be5 --- /dev/null +++ b/test/isUpperCase/isUpperCase.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isUpperCase = require('./isUpperCase.js'); + +test('Testing isUpperCase', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isUpperCase === 'function', 'isUpperCase is a Function'); + //t.deepEqual(isUpperCase(args..), 'Expected'); + //t.equal(isUpperCase(args..), 'Expected'); + //t.false(isUpperCase(args..), 'Expected'); + //t.throws(isUpperCase(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/isValidJSON/isValidJSON.js b/test/isValidJSON/isValidJSON.js new file mode 100644 index 000000000..348383c7a --- /dev/null +++ b/test/isValidJSON/isValidJSON.js @@ -0,0 +1,8 @@ +module.exports = obj => { +try { +JSON.parse(obj); +return true; +} catch (e) { +return false; +} +}; \ No newline at end of file diff --git a/test/isValidJSON/isValidJSON.test.js b/test/isValidJSON/isValidJSON.test.js new file mode 100644 index 000000000..31bb543a6 --- /dev/null +++ b/test/isValidJSON/isValidJSON.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isValidJSON = require('./isValidJSON.js'); + +test('Testing isValidJSON', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isValidJSON === 'function', 'isValidJSON is a Function'); + //t.deepEqual(isValidJSON(args..), 'Expected'); + //t.equal(isValidJSON(args..), 'Expected'); + //t.false(isValidJSON(args..), 'Expected'); + //t.throws(isValidJSON(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/join/join.js b/test/join/join.js new file mode 100644 index 000000000..e1e873e9e --- /dev/null +++ b/test/join/join.js @@ -0,0 +1,8 @@ +module.exports = (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, +'' +); \ No newline at end of file diff --git a/test/join/join.test.js b/test/join/join.test.js new file mode 100644 index 000000000..fb3529360 --- /dev/null +++ b/test/join/join.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const join = require('./join.js'); + +test('Testing join', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof join === 'function', 'join is a Function'); + //t.deepEqual(join(args..), 'Expected'); + //t.equal(join(args..), 'Expected'); + //t.false(join(args..), 'Expected'); + //t.throws(join(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/last/last.js b/test/last/last.js new file mode 100644 index 000000000..0e2664931 --- /dev/null +++ b/test/last/last.js @@ -0,0 +1 @@ +module.exports = arr => arr[arr.length - 1]; \ No newline at end of file diff --git a/test/last/last.test.js b/test/last/last.test.js new file mode 100644 index 000000000..d077c6806 --- /dev/null +++ b/test/last/last.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const last = require('./last.js'); + +test('Testing last', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof last === 'function', 'last is a Function'); + //t.deepEqual(last(args..), 'Expected'); + //t.equal(last(args..), 'Expected'); + //t.false(last(args..), 'Expected'); + //t.throws(last(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/lcm/lcm.js b/test/lcm/lcm.js new file mode 100644 index 000000000..642c1b88c --- /dev/null +++ b/test/lcm/lcm.js @@ -0,0 +1,5 @@ +module.exports = (...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)); +}; \ No newline at end of file diff --git a/test/lcm/lcm.test.js b/test/lcm/lcm.test.js new file mode 100644 index 000000000..a0278b76e --- /dev/null +++ b/test/lcm/lcm.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const lcm = require('./lcm.js'); + +test('Testing lcm', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof lcm === 'function', 'lcm is a Function'); + //t.deepEqual(lcm(args..), 'Expected'); + //t.equal(lcm(args..), 'Expected'); + //t.false(lcm(args..), 'Expected'); + //t.throws(lcm(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/longestItem/longestItem.js b/test/longestItem/longestItem.js new file mode 100644 index 000000000..fcbeea74d --- /dev/null +++ b/test/longestItem/longestItem.js @@ -0,0 +1 @@ +module.exports = (...vals) => [...vals].sort((a, b) => b.length - a.length)[0]; \ No newline at end of file diff --git a/test/longestItem/longestItem.test.js b/test/longestItem/longestItem.test.js new file mode 100644 index 000000000..3a12097f9 --- /dev/null +++ b/test/longestItem/longestItem.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const longestItem = require('./longestItem.js'); + +test('Testing longestItem', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof longestItem === 'function', 'longestItem is a Function'); + //t.deepEqual(longestItem(args..), 'Expected'); + //t.equal(longestItem(args..), 'Expected'); + //t.false(longestItem(args..), 'Expected'); + //t.throws(longestItem(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/lowercaseKeys/lowercaseKeys.js b/test/lowercaseKeys/lowercaseKeys.js new file mode 100644 index 000000000..7c36e1798 --- /dev/null +++ b/test/lowercaseKeys/lowercaseKeys.js @@ -0,0 +1,5 @@ +module.exports = obj => +Object.keys(obj).reduce((acc, key) => { +acc[key.toLowerCase()] = obj[key]; +return acc; +}, {}); \ No newline at end of file diff --git a/test/lowercaseKeys/lowercaseKeys.test.js b/test/lowercaseKeys/lowercaseKeys.test.js new file mode 100644 index 000000000..a3a697e00 --- /dev/null +++ b/test/lowercaseKeys/lowercaseKeys.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const lowercaseKeys = require('./lowercaseKeys.js'); + +test('Testing lowercaseKeys', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof lowercaseKeys === 'function', 'lowercaseKeys is a Function'); + //t.deepEqual(lowercaseKeys(args..), 'Expected'); + //t.equal(lowercaseKeys(args..), 'Expected'); + //t.false(lowercaseKeys(args..), 'Expected'); + //t.throws(lowercaseKeys(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/luhnCheck/luhnCheck.js b/test/luhnCheck/luhnCheck.js new file mode 100644 index 000000000..929caae58 --- /dev/null +++ b/test/luhnCheck/luhnCheck.js @@ -0,0 +1,10 @@ +module.exports = 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; +}; \ No newline at end of file diff --git a/test/luhnCheck/luhnCheck.test.js b/test/luhnCheck/luhnCheck.test.js new file mode 100644 index 000000000..856cf427c --- /dev/null +++ b/test/luhnCheck/luhnCheck.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const luhnCheck = require('./luhnCheck.js'); + +test('Testing luhnCheck', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof luhnCheck === 'function', 'luhnCheck is a Function'); + //t.deepEqual(luhnCheck(args..), 'Expected'); + //t.equal(luhnCheck(args..), 'Expected'); + //t.false(luhnCheck(args..), 'Expected'); + //t.throws(luhnCheck(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/mapObject/mapObject.js b/test/mapObject/mapObject.js new file mode 100644 index 000000000..81276a042 --- /dev/null +++ b/test/mapObject/mapObject.js @@ -0,0 +1,4 @@ +module.exports = (arr, fn) => +(a => ( +(a = [arr, arr.map(fn)]), a[0].reduce((acc, val, ind) => ((acc[val] = a[1][ind]), acc), {}) +))(); \ No newline at end of file diff --git a/test/mapObject/mapObject.test.js b/test/mapObject/mapObject.test.js new file mode 100644 index 000000000..bc853fcb0 --- /dev/null +++ b/test/mapObject/mapObject.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const mapObject = require('./mapObject.js'); + +test('Testing mapObject', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof mapObject === 'function', 'mapObject is a Function'); + //t.deepEqual(mapObject(args..), 'Expected'); + //t.equal(mapObject(args..), 'Expected'); + //t.false(mapObject(args..), 'Expected'); + //t.throws(mapObject(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/mask/mask.js b/test/mask/mask.js new file mode 100644 index 000000000..55abe89df --- /dev/null +++ b/test/mask/mask.js @@ -0,0 +1,2 @@ +module.exports = (cc, num = 4, mask = '*') => +('' + cc).slice(0, -num).replace(/./g, mask) + ('' + cc).slice(-num); \ No newline at end of file diff --git a/test/mask/mask.test.js b/test/mask/mask.test.js new file mode 100644 index 000000000..33b85141e --- /dev/null +++ b/test/mask/mask.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const mask = require('./mask.js'); + +test('Testing mask', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof mask === 'function', 'mask is a Function'); + //t.deepEqual(mask(args..), 'Expected'); + //t.equal(mask(args..), 'Expected'); + //t.false(mask(args..), 'Expected'); + //t.throws(mask(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/maxN/maxN.js b/test/maxN/maxN.js new file mode 100644 index 000000000..38b3de656 --- /dev/null +++ b/test/maxN/maxN.js @@ -0,0 +1 @@ +module.exports = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n); \ No newline at end of file diff --git a/test/maxN/maxN.test.js b/test/maxN/maxN.test.js new file mode 100644 index 000000000..dfbae1441 --- /dev/null +++ b/test/maxN/maxN.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const maxN = require('./maxN.js'); + +test('Testing maxN', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof maxN === 'function', 'maxN is a Function'); + //t.deepEqual(maxN(args..), 'Expected'); + //t.equal(maxN(args..), 'Expected'); + //t.false(maxN(args..), 'Expected'); + //t.throws(maxN(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/median/median.js b/test/median/median.js new file mode 100644 index 000000000..b81efe090 --- /dev/null +++ b/test/median/median.js @@ -0,0 +1,5 @@ +module.exports = 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; +}; \ No newline at end of file diff --git a/test/median/median.test.js b/test/median/median.test.js new file mode 100644 index 000000000..f55f1df78 --- /dev/null +++ b/test/median/median.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const median = require('./median.js'); + +test('Testing median', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof median === 'function', 'median is a Function'); + //t.deepEqual(median(args..), 'Expected'); + //t.equal(median(args..), 'Expected'); + //t.false(median(args..), 'Expected'); + //t.throws(median(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/memoize/memoize.js b/test/memoize/memoize.js new file mode 100644 index 000000000..38ac9d810 --- /dev/null +++ b/test/memoize/memoize.js @@ -0,0 +1,8 @@ +module.exports = 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; +}; \ No newline at end of file diff --git a/test/memoize/memoize.test.js b/test/memoize/memoize.test.js new file mode 100644 index 000000000..cf045ba86 --- /dev/null +++ b/test/memoize/memoize.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const memoize = require('./memoize.js'); + +test('Testing memoize', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof memoize === 'function', 'memoize is a Function'); + //t.deepEqual(memoize(args..), 'Expected'); + //t.equal(memoize(args..), 'Expected'); + //t.false(memoize(args..), 'Expected'); + //t.throws(memoize(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/minN/minN.js b/test/minN/minN.js new file mode 100644 index 000000000..7f9610c9d --- /dev/null +++ b/test/minN/minN.js @@ -0,0 +1 @@ +module.exports = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n); \ No newline at end of file diff --git a/test/minN/minN.test.js b/test/minN/minN.test.js new file mode 100644 index 000000000..65c948814 --- /dev/null +++ b/test/minN/minN.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const minN = require('./minN.js'); + +test('Testing minN', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof minN === 'function', 'minN is a Function'); + //t.deepEqual(minN(args..), 'Expected'); + //t.equal(minN(args..), 'Expected'); + //t.false(minN(args..), 'Expected'); + //t.throws(minN(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/negate/negate.js b/test/negate/negate.js new file mode 100644 index 000000000..b58091648 --- /dev/null +++ b/test/negate/negate.js @@ -0,0 +1 @@ +module.exports = func => (...args) => !func(...args); \ No newline at end of file diff --git a/test/negate/negate.test.js b/test/negate/negate.test.js new file mode 100644 index 000000000..bdae567ce --- /dev/null +++ b/test/negate/negate.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const negate = require('./negate.js'); + +test('Testing negate', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof negate === 'function', 'negate is a Function'); + //t.deepEqual(negate(args..), 'Expected'); + //t.equal(negate(args..), 'Expected'); + //t.false(negate(args..), 'Expected'); + //t.throws(negate(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/nthElement/nthElement.js b/test/nthElement/nthElement.js new file mode 100644 index 000000000..a4df58e32 --- /dev/null +++ b/test/nthElement/nthElement.js @@ -0,0 +1 @@ +module.exports = (arr, n = 0) => (n > 0 ? arr.slice(n, n + 1) : arr.slice(n))[0]; \ No newline at end of file diff --git a/test/nthElement/nthElement.test.js b/test/nthElement/nthElement.test.js new file mode 100644 index 000000000..4c615ee7b --- /dev/null +++ b/test/nthElement/nthElement.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const nthElement = require('./nthElement.js'); + +test('Testing nthElement', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof nthElement === 'function', 'nthElement is a Function'); + //t.deepEqual(nthElement(args..), 'Expected'); + //t.equal(nthElement(args..), 'Expected'); + //t.false(nthElement(args..), 'Expected'); + //t.throws(nthElement(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/objectFromPairs/objectFromPairs.js b/test/objectFromPairs/objectFromPairs.js new file mode 100644 index 000000000..edebbda46 --- /dev/null +++ b/test/objectFromPairs/objectFromPairs.js @@ -0,0 +1 @@ +module.exports = arr => arr.reduce((a, v) => ((a[v[0]] = v[1]), a), {}); \ No newline at end of file diff --git a/test/objectFromPairs/objectFromPairs.test.js b/test/objectFromPairs/objectFromPairs.test.js new file mode 100644 index 000000000..a978cd279 --- /dev/null +++ b/test/objectFromPairs/objectFromPairs.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const objectFromPairs = require('./objectFromPairs.js'); + +test('Testing objectFromPairs', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof objectFromPairs === 'function', 'objectFromPairs is a Function'); + //t.deepEqual(objectFromPairs(args..), 'Expected'); + //t.equal(objectFromPairs(args..), 'Expected'); + //t.false(objectFromPairs(args..), 'Expected'); + //t.throws(objectFromPairs(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/objectToPairs/objectToPairs.js b/test/objectToPairs/objectToPairs.js new file mode 100644 index 000000000..453b58370 --- /dev/null +++ b/test/objectToPairs/objectToPairs.js @@ -0,0 +1 @@ +module.exports = obj => Object.keys(obj).map(k => [k, obj[k]]); \ No newline at end of file diff --git a/test/objectToPairs/objectToPairs.test.js b/test/objectToPairs/objectToPairs.test.js new file mode 100644 index 000000000..2f15ae40f --- /dev/null +++ b/test/objectToPairs/objectToPairs.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const objectToPairs = require('./objectToPairs.js'); + +test('Testing objectToPairs', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof objectToPairs === 'function', 'objectToPairs is a Function'); + //t.deepEqual(objectToPairs(args..), 'Expected'); + //t.equal(objectToPairs(args..), 'Expected'); + //t.false(objectToPairs(args..), 'Expected'); + //t.throws(objectToPairs(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/off/off.js b/test/off/off.js new file mode 100644 index 000000000..4e8c82b29 --- /dev/null +++ b/test/off/off.js @@ -0,0 +1 @@ +module.exports = (el, evt, fn, opts = false) => el.removeEventListener(evt, fn, opts); \ No newline at end of file diff --git a/test/off/off.test.js b/test/off/off.test.js new file mode 100644 index 000000000..b2cbbde08 --- /dev/null +++ b/test/off/off.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const off = require('./off.js'); + +test('Testing off', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof off === 'function', 'off is a Function'); + //t.deepEqual(off(args..), 'Expected'); + //t.equal(off(args..), 'Expected'); + //t.false(off(args..), 'Expected'); + //t.throws(off(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/on/on.js b/test/on/on.js new file mode 100644 index 000000000..b138585e4 --- /dev/null +++ b/test/on/on.js @@ -0,0 +1,5 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/on/on.test.js b/test/on/on.test.js new file mode 100644 index 000000000..15a242fa9 --- /dev/null +++ b/test/on/on.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const on = require('./on.js'); + +test('Testing on', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof on === 'function', 'on is a Function'); + //t.deepEqual(on(args..), 'Expected'); + //t.equal(on(args..), 'Expected'); + //t.false(on(args..), 'Expected'); + //t.throws(on(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/onUserInputChange/onUserInputChange.js b/test/onUserInputChange/onUserInputChange.js new file mode 100644 index 000000000..635148849 --- /dev/null +++ b/test/onUserInputChange/onUserInputChange.js @@ -0,0 +1,14 @@ +module.exports = 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); +}); +}; \ No newline at end of file diff --git a/test/onUserInputChange/onUserInputChange.test.js b/test/onUserInputChange/onUserInputChange.test.js new file mode 100644 index 000000000..ee4b3dc14 --- /dev/null +++ b/test/onUserInputChange/onUserInputChange.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const onUserInputChange = require('./onUserInputChange.js'); + +test('Testing onUserInputChange', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof onUserInputChange === 'function', 'onUserInputChange is a Function'); + //t.deepEqual(onUserInputChange(args..), 'Expected'); + //t.equal(onUserInputChange(args..), 'Expected'); + //t.false(onUserInputChange(args..), 'Expected'); + //t.throws(onUserInputChange(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/once/once.js b/test/once/once.js new file mode 100644 index 000000000..08e0cd3ef --- /dev/null +++ b/test/once/once.js @@ -0,0 +1,8 @@ +module.exports = fn => { +let called = false; +return function(...args) { +if (called) return; +called = true; +return fn.apply(this, args); +}; +}; \ No newline at end of file diff --git a/test/once/once.test.js b/test/once/once.test.js new file mode 100644 index 000000000..bc0742b89 --- /dev/null +++ b/test/once/once.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const once = require('./once.js'); + +test('Testing once', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof once === 'function', 'once is a Function'); + //t.deepEqual(once(args..), 'Expected'); + //t.equal(once(args..), 'Expected'); + //t.false(once(args..), 'Expected'); + //t.throws(once(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/orderBy/orderBy.js b/test/orderBy/orderBy.js new file mode 100644 index 000000000..396d5c372 --- /dev/null +++ b/test/orderBy/orderBy.js @@ -0,0 +1,10 @@ +module.exports = (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) +); \ No newline at end of file diff --git a/test/orderBy/orderBy.test.js b/test/orderBy/orderBy.test.js new file mode 100644 index 000000000..8b7435e03 --- /dev/null +++ b/test/orderBy/orderBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const orderBy = require('./orderBy.js'); + +test('Testing orderBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof orderBy === 'function', 'orderBy is a Function'); + //t.deepEqual(orderBy(args..), 'Expected'); + //t.equal(orderBy(args..), 'Expected'); + //t.false(orderBy(args..), 'Expected'); + //t.throws(orderBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/palindrome/palindrome.js b/test/palindrome/palindrome.js new file mode 100644 index 000000000..59d0bcd95 --- /dev/null +++ b/test/palindrome/palindrome.js @@ -0,0 +1,10 @@ +module.exports = str => { +const s = str.toLowerCase().replace(/[\W_]/g, ''); +return ( +s === +s +.split('') +.reverse() +.join('') +); +}; \ No newline at end of file diff --git a/test/palindrome/palindrome.test.js b/test/palindrome/palindrome.test.js new file mode 100644 index 000000000..1c164230f --- /dev/null +++ b/test/palindrome/palindrome.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const palindrome = require('./palindrome.js'); + +test('Testing palindrome', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof palindrome === 'function', 'palindrome is a Function'); + //t.deepEqual(palindrome(args..), 'Expected'); + //t.equal(palindrome(args..), 'Expected'); + //t.false(palindrome(args..), 'Expected'); + //t.throws(palindrome(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/partition/partition.js b/test/partition/partition.js new file mode 100644 index 000000000..1c03df53f --- /dev/null +++ b/test/partition/partition.js @@ -0,0 +1,8 @@ +module.exports = (arr, fn) => +arr.reduce( +(acc, val, i, arr) => { +acc[fn(val, i, arr) ? 0 : 1].push(val); +return acc; +}, +[[], []] +); \ No newline at end of file diff --git a/test/partition/partition.test.js b/test/partition/partition.test.js new file mode 100644 index 000000000..1d663a8b7 --- /dev/null +++ b/test/partition/partition.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const partition = require('./partition.js'); + +test('Testing partition', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof partition === 'function', 'partition is a Function'); + //t.deepEqual(partition(args..), 'Expected'); + //t.equal(partition(args..), 'Expected'); + //t.false(partition(args..), 'Expected'); + //t.throws(partition(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/percentile/percentile.js b/test/percentile/percentile.js new file mode 100644 index 000000000..b71944f82 --- /dev/null +++ b/test/percentile/percentile.js @@ -0,0 +1,2 @@ +module.exports = (arr, val) => +100 * arr.reduce((acc, v) => acc + (v < val ? 1 : 0) + (v === val ? 0.5 : 0), 0) / arr.length; \ No newline at end of file diff --git a/test/percentile/percentile.test.js b/test/percentile/percentile.test.js new file mode 100644 index 000000000..f24dd94bc --- /dev/null +++ b/test/percentile/percentile.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const percentile = require('./percentile.js'); + +test('Testing percentile', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof percentile === 'function', 'percentile is a Function'); + //t.deepEqual(percentile(args..), 'Expected'); + //t.equal(percentile(args..), 'Expected'); + //t.false(percentile(args..), 'Expected'); + //t.throws(percentile(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/pick/pick.js b/test/pick/pick.js new file mode 100644 index 000000000..05e97c5b7 --- /dev/null +++ b/test/pick/pick.js @@ -0,0 +1,2 @@ +module.exports = (obj, arr) => +arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); \ No newline at end of file diff --git a/test/pick/pick.test.js b/test/pick/pick.test.js new file mode 100644 index 000000000..18833daa9 --- /dev/null +++ b/test/pick/pick.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const pick = require('./pick.js'); + +test('Testing pick', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof pick === 'function', 'pick is a Function'); + //t.deepEqual(pick(args..), 'Expected'); + //t.equal(pick(args..), 'Expected'); + //t.false(pick(args..), 'Expected'); + //t.throws(pick(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/pipeFunctions/pipeFunctions.js b/test/pipeFunctions/pipeFunctions.js new file mode 100644 index 000000000..eabdf74b2 --- /dev/null +++ b/test/pipeFunctions/pipeFunctions.js @@ -0,0 +1 @@ +module.exports = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args))); \ No newline at end of file diff --git a/test/pipeFunctions/pipeFunctions.test.js b/test/pipeFunctions/pipeFunctions.test.js new file mode 100644 index 000000000..61d1285c9 --- /dev/null +++ b/test/pipeFunctions/pipeFunctions.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const pipeFunctions = require('./pipeFunctions.js'); + +test('Testing pipeFunctions', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof pipeFunctions === 'function', 'pipeFunctions is a Function'); + //t.deepEqual(pipeFunctions(args..), 'Expected'); + //t.equal(pipeFunctions(args..), 'Expected'); + //t.false(pipeFunctions(args..), 'Expected'); + //t.throws(pipeFunctions(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/pluralize/pluralize.js b/test/pluralize/pluralize.js new file mode 100644 index 000000000..1ace8fda7 --- /dev/null +++ b/test/pluralize/pluralize.js @@ -0,0 +1,6 @@ +module.exports = (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); +}; \ No newline at end of file diff --git a/test/pluralize/pluralize.test.js b/test/pluralize/pluralize.test.js new file mode 100644 index 000000000..a78180d7a --- /dev/null +++ b/test/pluralize/pluralize.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const pluralize = require('./pluralize.js'); + +test('Testing pluralize', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof pluralize === 'function', 'pluralize is a Function'); + //t.deepEqual(pluralize(args..), 'Expected'); + //t.equal(pluralize(args..), 'Expected'); + //t.false(pluralize(args..), 'Expected'); + //t.throws(pluralize(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/powerset/powerset.js b/test/powerset/powerset.js new file mode 100644 index 000000000..dbe4afaf8 --- /dev/null +++ b/test/powerset/powerset.js @@ -0,0 +1 @@ +module.exports = arr => arr.reduce((a, v) => a.concat(a.map(r => [v].concat(r))), [[]]); \ No newline at end of file diff --git a/test/powerset/powerset.test.js b/test/powerset/powerset.test.js new file mode 100644 index 000000000..7663ba313 --- /dev/null +++ b/test/powerset/powerset.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const powerset = require('./powerset.js'); + +test('Testing powerset', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof powerset === 'function', 'powerset is a Function'); + //t.deepEqual(powerset(args..), 'Expected'); + //t.equal(powerset(args..), 'Expected'); + //t.false(powerset(args..), 'Expected'); + //t.throws(powerset(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/prettyBytes/prettyBytes.js b/test/prettyBytes/prettyBytes.js new file mode 100644 index 000000000..0e7b54eb6 --- /dev/null +++ b/test/prettyBytes/prettyBytes.js @@ -0,0 +1,7 @@ +module.exports = (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]; +}; \ No newline at end of file diff --git a/test/prettyBytes/prettyBytes.test.js b/test/prettyBytes/prettyBytes.test.js new file mode 100644 index 000000000..667e35f96 --- /dev/null +++ b/test/prettyBytes/prettyBytes.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const prettyBytes = require('./prettyBytes.js'); + +test('Testing prettyBytes', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof prettyBytes === 'function', 'prettyBytes is a Function'); + //t.deepEqual(prettyBytes(args..), 'Expected'); + //t.equal(prettyBytes(args..), 'Expected'); + //t.false(prettyBytes(args..), 'Expected'); + //t.throws(prettyBytes(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/primes/primes.js b/test/primes/primes.js new file mode 100644 index 000000000..6498f2eb7 --- /dev/null +++ b/test/primes/primes.js @@ -0,0 +1,7 @@ +module.exports = 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; +}; \ No newline at end of file diff --git a/test/primes/primes.test.js b/test/primes/primes.test.js new file mode 100644 index 000000000..e016b610a --- /dev/null +++ b/test/primes/primes.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const primes = require('./primes.js'); + +test('Testing primes', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof primes === 'function', 'primes is a Function'); + //t.deepEqual(primes(args..), 'Expected'); + //t.equal(primes(args..), 'Expected'); + //t.false(primes(args..), 'Expected'); + //t.throws(primes(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/promisify/promisify.js b/test/promisify/promisify.js new file mode 100644 index 000000000..6536d3883 --- /dev/null +++ b/test/promisify/promisify.js @@ -0,0 +1,4 @@ +module.exports = func => (...args) => +new Promise((resolve, reject) => +func(...args, (err, result) => (err ? reject(err) : resolve(result))) +); \ No newline at end of file diff --git a/test/promisify/promisify.test.js b/test/promisify/promisify.test.js new file mode 100644 index 000000000..0ef7c8465 --- /dev/null +++ b/test/promisify/promisify.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const promisify = require('./promisify.js'); + +test('Testing promisify', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof promisify === 'function', 'promisify is a Function'); + //t.deepEqual(promisify(args..), 'Expected'); + //t.equal(promisify(args..), 'Expected'); + //t.false(promisify(args..), 'Expected'); + //t.throws(promisify(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/pull/pull.js b/test/pull/pull.js new file mode 100644 index 000000000..9e8db9b76 --- /dev/null +++ b/test/pull/pull.js @@ -0,0 +1,6 @@ +module.exports = (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)); +}; \ No newline at end of file diff --git a/test/pull/pull.test.js b/test/pull/pull.test.js new file mode 100644 index 000000000..e067e10b6 --- /dev/null +++ b/test/pull/pull.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const pull = require('./pull.js'); + +test('Testing pull', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof pull === 'function', 'pull is a Function'); + //t.deepEqual(pull(args..), 'Expected'); + //t.equal(pull(args..), 'Expected'); + //t.false(pull(args..), 'Expected'); + //t.throws(pull(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/pullAtIndex/pullAtIndex.js b/test/pullAtIndex/pullAtIndex.js new file mode 100644 index 000000000..d294f5db6 --- /dev/null +++ b/test/pullAtIndex/pullAtIndex.js @@ -0,0 +1,9 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/pullAtIndex/pullAtIndex.test.js b/test/pullAtIndex/pullAtIndex.test.js new file mode 100644 index 000000000..0fd62bedc --- /dev/null +++ b/test/pullAtIndex/pullAtIndex.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const pullAtIndex = require('./pullAtIndex.js'); + +test('Testing pullAtIndex', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof pullAtIndex === 'function', 'pullAtIndex is a Function'); + //t.deepEqual(pullAtIndex(args..), 'Expected'); + //t.equal(pullAtIndex(args..), 'Expected'); + //t.false(pullAtIndex(args..), 'Expected'); + //t.throws(pullAtIndex(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/pullAtValue/pullAtValue.js b/test/pullAtValue/pullAtValue.js new file mode 100644 index 000000000..0aee77a64 --- /dev/null +++ b/test/pullAtValue/pullAtValue.js @@ -0,0 +1,8 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/pullAtValue/pullAtValue.test.js b/test/pullAtValue/pullAtValue.test.js new file mode 100644 index 000000000..10f6b09d0 --- /dev/null +++ b/test/pullAtValue/pullAtValue.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const pullAtValue = require('./pullAtValue.js'); + +test('Testing pullAtValue', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof pullAtValue === 'function', 'pullAtValue is a Function'); + //t.deepEqual(pullAtValue(args..), 'Expected'); + //t.equal(pullAtValue(args..), 'Expected'); + //t.false(pullAtValue(args..), 'Expected'); + //t.throws(pullAtValue(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/quickSort/quickSort.js b/test/quickSort/quickSort.js new file mode 100644 index 000000000..0e01c23d0 --- /dev/null +++ b/test/quickSort/quickSort.js @@ -0,0 +1,8 @@ +module.exports = ([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) +]; \ No newline at end of file diff --git a/test/quickSort/quickSort.test.js b/test/quickSort/quickSort.test.js new file mode 100644 index 000000000..691226205 --- /dev/null +++ b/test/quickSort/quickSort.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const quickSort = require('./quickSort.js'); + +test('Testing quickSort', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof quickSort === 'function', 'quickSort is a Function'); + //t.deepEqual(quickSort(args..), 'Expected'); + //t.equal(quickSort(args..), 'Expected'); + //t.false(quickSort(args..), 'Expected'); + //t.throws(quickSort(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/randomHexColorCode/randomHexColorCode.js b/test/randomHexColorCode/randomHexColorCode.js new file mode 100644 index 000000000..ff0186633 --- /dev/null +++ b/test/randomHexColorCode/randomHexColorCode.js @@ -0,0 +1,4 @@ +module.exports = () => { +let n = ((Math.random() * 0xfffff) | 0).toString(16); +return '#' + (n.length !== 6 ? ((Math.random() * 0xf) | 0).toString(16) + n : n); +}; \ No newline at end of file diff --git a/test/randomHexColorCode/randomHexColorCode.test.js b/test/randomHexColorCode/randomHexColorCode.test.js new file mode 100644 index 000000000..39b41b2a7 --- /dev/null +++ b/test/randomHexColorCode/randomHexColorCode.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const randomHexColorCode = require('./randomHexColorCode.js'); + +test('Testing randomHexColorCode', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof randomHexColorCode === 'function', 'randomHexColorCode is a Function'); + //t.deepEqual(randomHexColorCode(args..), 'Expected'); + //t.equal(randomHexColorCode(args..), 'Expected'); + //t.false(randomHexColorCode(args..), 'Expected'); + //t.throws(randomHexColorCode(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/randomIntegerInRange/randomIntegerInRange.js b/test/randomIntegerInRange/randomIntegerInRange.js new file mode 100644 index 000000000..395e81002 --- /dev/null +++ b/test/randomIntegerInRange/randomIntegerInRange.js @@ -0,0 +1 @@ +module.exports = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; \ No newline at end of file diff --git a/test/randomIntegerInRange/randomIntegerInRange.test.js b/test/randomIntegerInRange/randomIntegerInRange.test.js new file mode 100644 index 000000000..3e821c31f --- /dev/null +++ b/test/randomIntegerInRange/randomIntegerInRange.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const randomIntegerInRange = require('./randomIntegerInRange.js'); + +test('Testing randomIntegerInRange', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof randomIntegerInRange === 'function', 'randomIntegerInRange is a Function'); + //t.deepEqual(randomIntegerInRange(args..), 'Expected'); + //t.equal(randomIntegerInRange(args..), 'Expected'); + //t.false(randomIntegerInRange(args..), 'Expected'); + //t.throws(randomIntegerInRange(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/randomNumberInRange/randomNumberInRange.js b/test/randomNumberInRange/randomNumberInRange.js new file mode 100644 index 000000000..efafeaa04 --- /dev/null +++ b/test/randomNumberInRange/randomNumberInRange.js @@ -0,0 +1 @@ +module.exports = (min, max) => Math.random() * (max - min) + min; \ No newline at end of file diff --git a/test/randomNumberInRange/randomNumberInRange.test.js b/test/randomNumberInRange/randomNumberInRange.test.js new file mode 100644 index 000000000..4cc797080 --- /dev/null +++ b/test/randomNumberInRange/randomNumberInRange.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const randomNumberInRange = require('./randomNumberInRange.js'); + +test('Testing randomNumberInRange', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof randomNumberInRange === 'function', 'randomNumberInRange is a Function'); + //t.deepEqual(randomNumberInRange(args..), 'Expected'); + //t.equal(randomNumberInRange(args..), 'Expected'); + //t.false(randomNumberInRange(args..), 'Expected'); + //t.throws(randomNumberInRange(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/redirect/redirect.js b/test/redirect/redirect.js new file mode 100644 index 000000000..38870dc52 --- /dev/null +++ b/test/redirect/redirect.js @@ -0,0 +1,2 @@ +module.exports = (url, asLink = true) => +asLink ? (window.location.href = url) : window.location.replace(url); \ No newline at end of file diff --git a/test/redirect/redirect.test.js b/test/redirect/redirect.test.js new file mode 100644 index 000000000..12dee47dd --- /dev/null +++ b/test/redirect/redirect.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const redirect = require('./redirect.js'); + +test('Testing redirect', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof redirect === 'function', 'redirect is a Function'); + //t.deepEqual(redirect(args..), 'Expected'); + //t.equal(redirect(args..), 'Expected'); + //t.false(redirect(args..), 'Expected'); + //t.throws(redirect(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/reducedFilter/reducedFilter.js b/test/reducedFilter/reducedFilter.js new file mode 100644 index 000000000..4df25b5ae --- /dev/null +++ b/test/reducedFilter/reducedFilter.js @@ -0,0 +1,7 @@ +module.exports = (data, keys, fn) => +data.filter(fn).map(el => +keys.reduce((acc, key) => { +acc[key] = el[key]; +return acc; +}, {}) +); \ No newline at end of file diff --git a/test/reducedFilter/reducedFilter.test.js b/test/reducedFilter/reducedFilter.test.js new file mode 100644 index 000000000..5e7c488fe --- /dev/null +++ b/test/reducedFilter/reducedFilter.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const reducedFilter = require('./reducedFilter.js'); + +test('Testing reducedFilter', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof reducedFilter === 'function', 'reducedFilter is a Function'); + //t.deepEqual(reducedFilter(args..), 'Expected'); + //t.equal(reducedFilter(args..), 'Expected'); + //t.false(reducedFilter(args..), 'Expected'); + //t.throws(reducedFilter(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/remove/remove.js b/test/remove/remove.js new file mode 100644 index 000000000..8e73d0fa1 --- /dev/null +++ b/test/remove/remove.js @@ -0,0 +1,7 @@ +module.exports = (arr, func) => +Array.isArray(arr) +? arr.filter(func).reduce((acc, val) => { +arr.splice(arr.indexOf(val), 1); +return acc.concat(val); +}, []) +: []; \ No newline at end of file diff --git a/test/remove/remove.test.js b/test/remove/remove.test.js new file mode 100644 index 000000000..77b699103 --- /dev/null +++ b/test/remove/remove.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const remove = require('./remove.js'); + +test('Testing remove', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof remove === 'function', 'remove is a Function'); + //t.deepEqual(remove(args..), 'Expected'); + //t.equal(remove(args..), 'Expected'); + //t.false(remove(args..), 'Expected'); + //t.throws(remove(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/reverseString/reverseString.js b/test/reverseString/reverseString.js new file mode 100644 index 000000000..d9ba44226 --- /dev/null +++ b/test/reverseString/reverseString.js @@ -0,0 +1 @@ +module.exports = str => [...str].reverse().join(''); \ No newline at end of file diff --git a/test/reverseString/reverseString.test.js b/test/reverseString/reverseString.test.js new file mode 100644 index 000000000..f12aba959 --- /dev/null +++ b/test/reverseString/reverseString.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const reverseString = require('./reverseString.js'); + +test('Testing reverseString', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof reverseString === 'function', 'reverseString is a Function'); + //t.deepEqual(reverseString(args..), 'Expected'); + //t.equal(reverseString(args..), 'Expected'); + //t.false(reverseString(args..), 'Expected'); + //t.throws(reverseString(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/round/round.js b/test/round/round.js new file mode 100644 index 000000000..f5466934c --- /dev/null +++ b/test/round/round.js @@ -0,0 +1 @@ +module.exports = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`); \ No newline at end of file diff --git a/test/round/round.test.js b/test/round/round.test.js new file mode 100644 index 000000000..24eeaf91a --- /dev/null +++ b/test/round/round.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const round = require('./round.js'); + +test('Testing round', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof round === 'function', 'round is a Function'); + //t.deepEqual(round(args..), 'Expected'); + //t.equal(round(args..), 'Expected'); + //t.false(round(args..), 'Expected'); + //t.throws(round(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/runAsync/runAsync.js b/test/runAsync/runAsync.js new file mode 100644 index 000000000..09b16fe54 --- /dev/null +++ b/test/runAsync/runAsync.js @@ -0,0 +1,16 @@ +module.exports = fn => { +const blob = `var fn = ${fn.toString()}; postMessage(fn());`; +const worker = new Worker( +URL.createObjectURL(new Blob([blob]), { +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(); +}; +}); +}; \ No newline at end of file diff --git a/test/runAsync/runAsync.test.js b/test/runAsync/runAsync.test.js new file mode 100644 index 000000000..5d6a24c56 --- /dev/null +++ b/test/runAsync/runAsync.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const runAsync = require('./runAsync.js'); + +test('Testing runAsync', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof runAsync === 'function', 'runAsync is a Function'); + //t.deepEqual(runAsync(args..), 'Expected'); + //t.equal(runAsync(args..), 'Expected'); + //t.false(runAsync(args..), 'Expected'); + //t.throws(runAsync(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/runPromisesInSeries/runPromisesInSeries.js b/test/runPromisesInSeries/runPromisesInSeries.js new file mode 100644 index 000000000..8bed23ec5 --- /dev/null +++ b/test/runPromisesInSeries/runPromisesInSeries.js @@ -0,0 +1 @@ +module.exports = ps => ps.reduce((p, next) => p.then(next), Promise.resolve()); \ No newline at end of file diff --git a/test/runPromisesInSeries/runPromisesInSeries.test.js b/test/runPromisesInSeries/runPromisesInSeries.test.js new file mode 100644 index 000000000..78a7b13e9 --- /dev/null +++ b/test/runPromisesInSeries/runPromisesInSeries.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const runPromisesInSeries = require('./runPromisesInSeries.js'); + +test('Testing runPromisesInSeries', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof runPromisesInSeries === 'function', 'runPromisesInSeries is a Function'); + //t.deepEqual(runPromisesInSeries(args..), 'Expected'); + //t.equal(runPromisesInSeries(args..), 'Expected'); + //t.false(runPromisesInSeries(args..), 'Expected'); + //t.throws(runPromisesInSeries(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sample/sample.js b/test/sample/sample.js new file mode 100644 index 000000000..116d6de83 --- /dev/null +++ b/test/sample/sample.js @@ -0,0 +1 @@ +module.exports = arr => arr[Math.floor(Math.random() * arr.length)]; \ No newline at end of file diff --git a/test/sample/sample.test.js b/test/sample/sample.test.js new file mode 100644 index 000000000..6f2e5ee2c --- /dev/null +++ b/test/sample/sample.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sample = require('./sample.js'); + +test('Testing sample', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sample === 'function', 'sample is a Function'); + //t.deepEqual(sample(args..), 'Expected'); + //t.equal(sample(args..), 'Expected'); + //t.false(sample(args..), 'Expected'); + //t.throws(sample(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sampleSize/sampleSize.js b/test/sampleSize/sampleSize.js new file mode 100644 index 000000000..6ded2b389 --- /dev/null +++ b/test/sampleSize/sampleSize.js @@ -0,0 +1,8 @@ +module.exports = ([...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); +}; \ No newline at end of file diff --git a/test/sampleSize/sampleSize.test.js b/test/sampleSize/sampleSize.test.js new file mode 100644 index 000000000..5527d8304 --- /dev/null +++ b/test/sampleSize/sampleSize.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sampleSize = require('./sampleSize.js'); + +test('Testing sampleSize', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sampleSize === 'function', 'sampleSize is a Function'); + //t.deepEqual(sampleSize(args..), 'Expected'); + //t.equal(sampleSize(args..), 'Expected'); + //t.false(sampleSize(args..), 'Expected'); + //t.throws(sampleSize(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/scrollToTop/scrollToTop.js b/test/scrollToTop/scrollToTop.js new file mode 100644 index 000000000..4aa1c1dde --- /dev/null +++ b/test/scrollToTop/scrollToTop.js @@ -0,0 +1,7 @@ +module.exports = () => { +const c = document.documentElement.scrollTop || document.body.scrollTop; +if (c > 0) { +window.requestAnimationFrame(scrollToTop); +window.scrollTo(0, c - c / 8); +} +}; \ No newline at end of file diff --git a/test/scrollToTop/scrollToTop.test.js b/test/scrollToTop/scrollToTop.test.js new file mode 100644 index 000000000..acc2ff3a2 --- /dev/null +++ b/test/scrollToTop/scrollToTop.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const scrollToTop = require('./scrollToTop.js'); + +test('Testing scrollToTop', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof scrollToTop === 'function', 'scrollToTop is a Function'); + //t.deepEqual(scrollToTop(args..), 'Expected'); + //t.equal(scrollToTop(args..), 'Expected'); + //t.false(scrollToTop(args..), 'Expected'); + //t.throws(scrollToTop(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sdbm/sdbm.js b/test/sdbm/sdbm.js new file mode 100644 index 000000000..c3ad8ec64 --- /dev/null +++ b/test/sdbm/sdbm.js @@ -0,0 +1,8 @@ +module.exports = str => { +let arr = str.split(''); +return arr.reduce( +(hashCode, currentVal) => +(hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode), +0 +); +}; \ No newline at end of file diff --git a/test/sdbm/sdbm.test.js b/test/sdbm/sdbm.test.js new file mode 100644 index 000000000..48bf84917 --- /dev/null +++ b/test/sdbm/sdbm.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sdbm = require('./sdbm.js'); + +test('Testing sdbm', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sdbm === 'function', 'sdbm is a Function'); + //t.deepEqual(sdbm(args..), 'Expected'); + //t.equal(sdbm(args..), 'Expected'); + //t.false(sdbm(args..), 'Expected'); + //t.throws(sdbm(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/select/select.js b/test/select/select.js new file mode 100644 index 000000000..adc0c5240 --- /dev/null +++ b/test/select/select.js @@ -0,0 +1,2 @@ +module.exports = (from, selector) => +selector.split('.').reduce((prev, cur) => prev && prev[cur], from); \ No newline at end of file diff --git a/test/select/select.test.js b/test/select/select.test.js new file mode 100644 index 000000000..1400c15f7 --- /dev/null +++ b/test/select/select.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const select = require('./select.js'); + +test('Testing select', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof select === 'function', 'select is a Function'); + //t.deepEqual(select(args..), 'Expected'); + //t.equal(select(args..), 'Expected'); + //t.false(select(args..), 'Expected'); + //t.throws(select(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/setStyle/setStyle.js b/test/setStyle/setStyle.js new file mode 100644 index 000000000..9e6d93c0e --- /dev/null +++ b/test/setStyle/setStyle.js @@ -0,0 +1 @@ +module.exports = (el, ruleName, val) => (el.style[ruleName] = val); \ No newline at end of file diff --git a/test/setStyle/setStyle.test.js b/test/setStyle/setStyle.test.js new file mode 100644 index 000000000..9ccaea787 --- /dev/null +++ b/test/setStyle/setStyle.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const setStyle = require('./setStyle.js'); + +test('Testing setStyle', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof setStyle === 'function', 'setStyle is a Function'); + //t.deepEqual(setStyle(args..), 'Expected'); + //t.equal(setStyle(args..), 'Expected'); + //t.false(setStyle(args..), 'Expected'); + //t.throws(setStyle(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/shallowClone/shallowClone.js b/test/shallowClone/shallowClone.js new file mode 100644 index 000000000..3fe063166 --- /dev/null +++ b/test/shallowClone/shallowClone.js @@ -0,0 +1 @@ +module.exports = obj => Object.assign({}, obj); \ No newline at end of file diff --git a/test/shallowClone/shallowClone.test.js b/test/shallowClone/shallowClone.test.js new file mode 100644 index 000000000..b62b37998 --- /dev/null +++ b/test/shallowClone/shallowClone.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const shallowClone = require('./shallowClone.js'); + +test('Testing shallowClone', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof shallowClone === 'function', 'shallowClone is a Function'); + //t.deepEqual(shallowClone(args..), 'Expected'); + //t.equal(shallowClone(args..), 'Expected'); + //t.false(shallowClone(args..), 'Expected'); + //t.throws(shallowClone(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/show/show.js b/test/show/show.js new file mode 100644 index 000000000..52121e7d7 --- /dev/null +++ b/test/show/show.js @@ -0,0 +1 @@ +module.exports = (...el) => [...el].forEach(e => (e.style.display = '')); \ No newline at end of file diff --git a/test/show/show.test.js b/test/show/show.test.js new file mode 100644 index 000000000..f8e81e7a5 --- /dev/null +++ b/test/show/show.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const show = require('./show.js'); + +test('Testing show', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof show === 'function', 'show is a Function'); + //t.deepEqual(show(args..), 'Expected'); + //t.equal(show(args..), 'Expected'); + //t.false(show(args..), 'Expected'); + //t.throws(show(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/shuffle/shuffle.js b/test/shuffle/shuffle.js new file mode 100644 index 000000000..cd22089d4 --- /dev/null +++ b/test/shuffle/shuffle.js @@ -0,0 +1,8 @@ +module.exports = ([...arr]) => { +let m = arr.length; +while (m) { +const i = Math.floor(Math.random() * m--); +[arr[m], arr[i]] = [arr[i], arr[m]]; +} +return arr; +}; \ No newline at end of file diff --git a/test/shuffle/shuffle.test.js b/test/shuffle/shuffle.test.js new file mode 100644 index 000000000..ebb1921f6 --- /dev/null +++ b/test/shuffle/shuffle.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const shuffle = require('./shuffle.js'); + +test('Testing shuffle', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof shuffle === 'function', 'shuffle is a Function'); + //t.deepEqual(shuffle(args..), 'Expected'); + //t.equal(shuffle(args..), 'Expected'); + //t.false(shuffle(args..), 'Expected'); + //t.throws(shuffle(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/similarity/similarity.js b/test/similarity/similarity.js new file mode 100644 index 000000000..f9bd00dd5 --- /dev/null +++ b/test/similarity/similarity.js @@ -0,0 +1 @@ +module.exports = (arr, values) => arr.filter(v => values.includes(v)); \ No newline at end of file diff --git a/test/similarity/similarity.test.js b/test/similarity/similarity.test.js new file mode 100644 index 000000000..d74648e25 --- /dev/null +++ b/test/similarity/similarity.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const similarity = require('./similarity.js'); + +test('Testing similarity', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof similarity === 'function', 'similarity is a Function'); + //t.deepEqual(similarity(args..), 'Expected'); + //t.equal(similarity(args..), 'Expected'); + //t.false(similarity(args..), 'Expected'); + //t.throws(similarity(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/size/size.js b/test/size/size.js new file mode 100644 index 000000000..10644d5ca --- /dev/null +++ b/test/size/size.js @@ -0,0 +1,6 @@ +module.exports = 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; \ No newline at end of file diff --git a/test/size/size.test.js b/test/size/size.test.js new file mode 100644 index 000000000..ea293b319 --- /dev/null +++ b/test/size/size.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const size = require('./size.js'); + +test('Testing size', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof size === 'function', 'size is a Function'); + //t.deepEqual(size(args..), 'Expected'); + //t.equal(size(args..), 'Expected'); + //t.false(size(args..), 'Expected'); + //t.throws(size(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sleep/sleep.js b/test/sleep/sleep.js new file mode 100644 index 000000000..10732ba83 --- /dev/null +++ b/test/sleep/sleep.js @@ -0,0 +1 @@ +module.exports = ms => new Promise(resolve => setTimeout(resolve, ms)); \ No newline at end of file diff --git a/test/sleep/sleep.test.js b/test/sleep/sleep.test.js new file mode 100644 index 000000000..7b56c9c77 --- /dev/null +++ b/test/sleep/sleep.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sleep = require('./sleep.js'); + +test('Testing sleep', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sleep === 'function', 'sleep is a Function'); + //t.deepEqual(sleep(args..), 'Expected'); + //t.equal(sleep(args..), 'Expected'); + //t.false(sleep(args..), 'Expected'); + //t.throws(sleep(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/solveRPN/solveRPN.js b/test/solveRPN/solveRPN.js new file mode 100644 index 000000000..4b25f9e9d --- /dev/null +++ b/test/solveRPN/solveRPN.js @@ -0,0 +1,28 @@ +module.exports = 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`; +}; \ No newline at end of file diff --git a/test/solveRPN/solveRPN.test.js b/test/solveRPN/solveRPN.test.js new file mode 100644 index 000000000..aa288918d --- /dev/null +++ b/test/solveRPN/solveRPN.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const solveRPN = require('./solveRPN.js'); + +test('Testing solveRPN', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof solveRPN === 'function', 'solveRPN is a Function'); + //t.deepEqual(solveRPN(args..), 'Expected'); + //t.equal(solveRPN(args..), 'Expected'); + //t.false(solveRPN(args..), 'Expected'); + //t.throws(solveRPN(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sortCharactersInString/sortCharactersInString.js b/test/sortCharactersInString/sortCharactersInString.js new file mode 100644 index 000000000..08db6a93a --- /dev/null +++ b/test/sortCharactersInString/sortCharactersInString.js @@ -0,0 +1 @@ +module.exports = str => [...str].sort((a, b) => a.localeCompare(b)).join(''); \ No newline at end of file diff --git a/test/sortCharactersInString/sortCharactersInString.test.js b/test/sortCharactersInString/sortCharactersInString.test.js new file mode 100644 index 000000000..f652d7a93 --- /dev/null +++ b/test/sortCharactersInString/sortCharactersInString.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sortCharactersInString = require('./sortCharactersInString.js'); + +test('Testing sortCharactersInString', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sortCharactersInString === 'function', 'sortCharactersInString is a Function'); + //t.deepEqual(sortCharactersInString(args..), 'Expected'); + //t.equal(sortCharactersInString(args..), 'Expected'); + //t.false(sortCharactersInString(args..), 'Expected'); + //t.throws(sortCharactersInString(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sortedIndex/sortedIndex.js b/test/sortedIndex/sortedIndex.js new file mode 100644 index 000000000..806ce2959 --- /dev/null +++ b/test/sortedIndex/sortedIndex.js @@ -0,0 +1,5 @@ +module.exports = (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; +}; \ No newline at end of file diff --git a/test/sortedIndex/sortedIndex.test.js b/test/sortedIndex/sortedIndex.test.js new file mode 100644 index 000000000..bdbb9eb63 --- /dev/null +++ b/test/sortedIndex/sortedIndex.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sortedIndex = require('./sortedIndex.js'); + +test('Testing sortedIndex', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sortedIndex === 'function', 'sortedIndex is a Function'); + //t.deepEqual(sortedIndex(args..), 'Expected'); + //t.equal(sortedIndex(args..), 'Expected'); + //t.false(sortedIndex(args..), 'Expected'); + //t.throws(sortedIndex(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/speechSynthesis/speechSynthesis.js b/test/speechSynthesis/speechSynthesis.js new file mode 100644 index 000000000..71f114c74 --- /dev/null +++ b/test/speechSynthesis/speechSynthesis.js @@ -0,0 +1,5 @@ +module.exports = message => { +const msg = new SpeechSynthesisUtterance(message); +msg.voice = window.speechSynthesis.getVoices()[0]; +window.speechSynthesis.speak(msg); +}; \ No newline at end of file diff --git a/test/speechSynthesis/speechSynthesis.test.js b/test/speechSynthesis/speechSynthesis.test.js new file mode 100644 index 000000000..81b4547f4 --- /dev/null +++ b/test/speechSynthesis/speechSynthesis.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const speechSynthesis = require('./speechSynthesis.js'); + +test('Testing speechSynthesis', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof speechSynthesis === 'function', 'speechSynthesis is a Function'); + //t.deepEqual(speechSynthesis(args..), 'Expected'); + //t.equal(speechSynthesis(args..), 'Expected'); + //t.false(speechSynthesis(args..), 'Expected'); + //t.throws(speechSynthesis(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/splitLines/splitLines.js b/test/splitLines/splitLines.js new file mode 100644 index 000000000..b6a0085e7 --- /dev/null +++ b/test/splitLines/splitLines.js @@ -0,0 +1 @@ +module.exports = str => str.split(/\r?\n/); \ No newline at end of file diff --git a/test/splitLines/splitLines.test.js b/test/splitLines/splitLines.test.js new file mode 100644 index 000000000..b06691bff --- /dev/null +++ b/test/splitLines/splitLines.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const splitLines = require('./splitLines.js'); + +test('Testing splitLines', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof splitLines === 'function', 'splitLines is a Function'); + //t.deepEqual(splitLines(args..), 'Expected'); + //t.equal(splitLines(args..), 'Expected'); + //t.false(splitLines(args..), 'Expected'); + //t.throws(splitLines(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/spreadOver/spreadOver.js b/test/spreadOver/spreadOver.js new file mode 100644 index 000000000..2f5986d58 --- /dev/null +++ b/test/spreadOver/spreadOver.js @@ -0,0 +1 @@ +module.exports = fn => argsArr => fn(...argsArr); \ No newline at end of file diff --git a/test/spreadOver/spreadOver.test.js b/test/spreadOver/spreadOver.test.js new file mode 100644 index 000000000..c1858bd83 --- /dev/null +++ b/test/spreadOver/spreadOver.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const spreadOver = require('./spreadOver.js'); + +test('Testing spreadOver', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof spreadOver === 'function', 'spreadOver is a Function'); + //t.deepEqual(spreadOver(args..), 'Expected'); + //t.equal(spreadOver(args..), 'Expected'); + //t.false(spreadOver(args..), 'Expected'); + //t.throws(spreadOver(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/standardDeviation/standardDeviation.js b/test/standardDeviation/standardDeviation.js new file mode 100644 index 000000000..cf81acc29 --- /dev/null +++ b/test/standardDeviation/standardDeviation.js @@ -0,0 +1,7 @@ +module.exports = (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)) +); +}; \ No newline at end of file diff --git a/test/standardDeviation/standardDeviation.test.js b/test/standardDeviation/standardDeviation.test.js new file mode 100644 index 000000000..7a18822e1 --- /dev/null +++ b/test/standardDeviation/standardDeviation.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const standardDeviation = require('./standardDeviation.js'); + +test('Testing standardDeviation', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof standardDeviation === 'function', 'standardDeviation is a Function'); + //t.deepEqual(standardDeviation(args..), 'Expected'); + //t.equal(standardDeviation(args..), 'Expected'); + //t.false(standardDeviation(args..), 'Expected'); + //t.throws(standardDeviation(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sum/sum.js b/test/sum/sum.js new file mode 100644 index 000000000..45cd30bad --- /dev/null +++ b/test/sum/sum.js @@ -0,0 +1 @@ +module.exports = (...arr) => [...arr].reduce((acc, val) => acc + val, 0); \ No newline at end of file diff --git a/test/sum/sum.test.js b/test/sum/sum.test.js new file mode 100644 index 000000000..e85b4c0c5 --- /dev/null +++ b/test/sum/sum.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sum = require('./sum.js'); + +test('Testing sum', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sum === 'function', 'sum is a Function'); + //t.deepEqual(sum(args..), 'Expected'); + //t.equal(sum(args..), 'Expected'); + //t.false(sum(args..), 'Expected'); + //t.throws(sum(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sumPower/sumPower.js b/test/sumPower/sumPower.js new file mode 100644 index 000000000..d74e25e7c --- /dev/null +++ b/test/sumPower/sumPower.js @@ -0,0 +1,5 @@ +module.exports = (end, power = 2, start = 1) => +Array(end + 1 - start) +.fill(0) +.map((x, i) => (i + start) ** power) +.reduce((a, b) => a + b, 0); \ No newline at end of file diff --git a/test/sumPower/sumPower.test.js b/test/sumPower/sumPower.test.js new file mode 100644 index 000000000..bf66f1173 --- /dev/null +++ b/test/sumPower/sumPower.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sumPower = require('./sumPower.js'); + +test('Testing sumPower', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sumPower === 'function', 'sumPower is a Function'); + //t.deepEqual(sumPower(args..), 'Expected'); + //t.equal(sumPower(args..), 'Expected'); + //t.false(sumPower(args..), 'Expected'); + //t.throws(sumPower(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/symmetricDifference/symmetricDifference.js b/test/symmetricDifference/symmetricDifference.js new file mode 100644 index 000000000..a8847e9ff --- /dev/null +++ b/test/symmetricDifference/symmetricDifference.js @@ -0,0 +1,5 @@ +module.exports = (a, b) => { +const sA = new Set(a), +sB = new Set(b); +return [...a.filter(x => !sB.has(x)), ...b.filter(x => !sA.has(x))]; +}; \ No newline at end of file diff --git a/test/symmetricDifference/symmetricDifference.test.js b/test/symmetricDifference/symmetricDifference.test.js new file mode 100644 index 000000000..f890ac9e5 --- /dev/null +++ b/test/symmetricDifference/symmetricDifference.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const symmetricDifference = require('./symmetricDifference.js'); + +test('Testing symmetricDifference', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof symmetricDifference === 'function', 'symmetricDifference is a Function'); + //t.deepEqual(symmetricDifference(args..), 'Expected'); + //t.equal(symmetricDifference(args..), 'Expected'); + //t.false(symmetricDifference(args..), 'Expected'); + //t.throws(symmetricDifference(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/tail/tail.js b/test/tail/tail.js new file mode 100644 index 000000000..c4bf70328 --- /dev/null +++ b/test/tail/tail.js @@ -0,0 +1 @@ +module.exports = arr => (arr.length > 1 ? arr.slice(1) : arr); \ No newline at end of file diff --git a/test/tail/tail.test.js b/test/tail/tail.test.js new file mode 100644 index 000000000..600ee2a7e --- /dev/null +++ b/test/tail/tail.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const tail = require('./tail.js'); + +test('Testing tail', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof tail === 'function', 'tail is a Function'); + //t.deepEqual(tail(args..), 'Expected'); + //t.equal(tail(args..), 'Expected'); + //t.false(tail(args..), 'Expected'); + //t.throws(tail(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/take/take.js b/test/take/take.js new file mode 100644 index 000000000..cd43d2548 --- /dev/null +++ b/test/take/take.js @@ -0,0 +1 @@ +module.exports = (arr, n = 1) => arr.slice(0, n); \ No newline at end of file diff --git a/test/take/take.test.js b/test/take/take.test.js new file mode 100644 index 000000000..75e8f384f --- /dev/null +++ b/test/take/take.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const take = require('./take.js'); + +test('Testing take', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof take === 'function', 'take is a Function'); + //t.deepEqual(take(args..), 'Expected'); + //t.equal(take(args..), 'Expected'); + //t.false(take(args..), 'Expected'); + //t.throws(take(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/takeRight/takeRight.js b/test/takeRight/takeRight.js new file mode 100644 index 000000000..a3aedc31d --- /dev/null +++ b/test/takeRight/takeRight.js @@ -0,0 +1 @@ +module.exports = (arr, n = 1) => arr.slice(arr.length - n, arr.length); \ No newline at end of file diff --git a/test/takeRight/takeRight.test.js b/test/takeRight/takeRight.test.js new file mode 100644 index 000000000..63f71c511 --- /dev/null +++ b/test/takeRight/takeRight.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const takeRight = require('./takeRight.js'); + +test('Testing takeRight', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof takeRight === 'function', 'takeRight is a Function'); + //t.deepEqual(takeRight(args..), 'Expected'); + //t.equal(takeRight(args..), 'Expected'); + //t.false(takeRight(args..), 'Expected'); + //t.throws(takeRight(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/timeTaken/timeTaken.js b/test/timeTaken/timeTaken.js new file mode 100644 index 000000000..d34042e69 --- /dev/null +++ b/test/timeTaken/timeTaken.js @@ -0,0 +1,6 @@ +module.exports = callback => { +console.time('timeTaken'); +const r = callback(); +console.timeEnd('timeTaken'); +return r; +}; \ No newline at end of file diff --git a/test/timeTaken/timeTaken.test.js b/test/timeTaken/timeTaken.test.js new file mode 100644 index 000000000..7e5201970 --- /dev/null +++ b/test/timeTaken/timeTaken.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const timeTaken = require('./timeTaken.js'); + +test('Testing timeTaken', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof timeTaken === 'function', 'timeTaken is a Function'); + //t.deepEqual(timeTaken(args..), 'Expected'); + //t.equal(timeTaken(args..), 'Expected'); + //t.false(timeTaken(args..), 'Expected'); + //t.throws(timeTaken(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toCamelCase/toCamelCase.js b/test/toCamelCase/toCamelCase.js new file mode 100644 index 000000000..61070be95 --- /dev/null +++ b/test/toCamelCase/toCamelCase.js @@ -0,0 +1,9 @@ +module.exports = 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); +}; \ No newline at end of file diff --git a/test/toCamelCase/toCamelCase.test.js b/test/toCamelCase/toCamelCase.test.js new file mode 100644 index 000000000..93455f442 --- /dev/null +++ b/test/toCamelCase/toCamelCase.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toCamelCase = require('./toCamelCase.js'); + +test('Testing toCamelCase', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toCamelCase === 'function', 'toCamelCase is a Function'); + //t.deepEqual(toCamelCase(args..), 'Expected'); + //t.equal(toCamelCase(args..), 'Expected'); + //t.false(toCamelCase(args..), 'Expected'); + //t.throws(toCamelCase(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toDecimalMark/toDecimalMark.js b/test/toDecimalMark/toDecimalMark.js new file mode 100644 index 000000000..ec3562358 --- /dev/null +++ b/test/toDecimalMark/toDecimalMark.js @@ -0,0 +1 @@ +module.exports = num => num.toLocaleString('en-US'); \ No newline at end of file diff --git a/test/toDecimalMark/toDecimalMark.test.js b/test/toDecimalMark/toDecimalMark.test.js new file mode 100644 index 000000000..c675167e2 --- /dev/null +++ b/test/toDecimalMark/toDecimalMark.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toDecimalMark = require('./toDecimalMark.js'); + +test('Testing toDecimalMark', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toDecimalMark === 'function', 'toDecimalMark is a Function'); + //t.deepEqual(toDecimalMark(args..), 'Expected'); + //t.equal(toDecimalMark(args..), 'Expected'); + //t.false(toDecimalMark(args..), 'Expected'); + //t.throws(toDecimalMark(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toEnglishDate/toEnglishDate.js b/test/toEnglishDate/toEnglishDate.js new file mode 100644 index 000000000..1608ad0c0 --- /dev/null +++ b/test/toEnglishDate/toEnglishDate.js @@ -0,0 +1,8 @@ +module.exports = time => { +try { +return new Date(time) +.toISOString() +.split('T')[0] +.replace(/-/g, '/'); +} catch (e) {} +}; \ No newline at end of file diff --git a/test/toEnglishDate/toEnglishDate.test.js b/test/toEnglishDate/toEnglishDate.test.js new file mode 100644 index 000000000..a4c8d3e37 --- /dev/null +++ b/test/toEnglishDate/toEnglishDate.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toEnglishDate = require('./toEnglishDate.js'); + +test('Testing toEnglishDate', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toEnglishDate === 'function', 'toEnglishDate is a Function'); + //t.deepEqual(toEnglishDate(args..), 'Expected'); + //t.equal(toEnglishDate(args..), 'Expected'); + //t.false(toEnglishDate(args..), 'Expected'); + //t.throws(toEnglishDate(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toKebabCase/toKebabCase.js b/test/toKebabCase/toKebabCase.js new file mode 100644 index 000000000..6132c4a38 --- /dev/null +++ b/test/toKebabCase/toKebabCase.js @@ -0,0 +1,6 @@ +module.exports = 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('-'); \ No newline at end of file diff --git a/test/toKebabCase/toKebabCase.test.js b/test/toKebabCase/toKebabCase.test.js new file mode 100644 index 000000000..28d87d374 --- /dev/null +++ b/test/toKebabCase/toKebabCase.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toKebabCase = require('./toKebabCase.js'); + +test('Testing toKebabCase', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toKebabCase === 'function', 'toKebabCase is a Function'); + //t.deepEqual(toKebabCase(args..), 'Expected'); + //t.equal(toKebabCase(args..), 'Expected'); + //t.false(toKebabCase(args..), 'Expected'); + //t.throws(toKebabCase(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.js b/test/toOrdinalSuffix/toOrdinalSuffix.js new file mode 100644 index 000000000..3a55dba4d --- /dev/null +++ b/test/toOrdinalSuffix/toOrdinalSuffix.js @@ -0,0 +1,10 @@ +module.exports = 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]; +}; \ No newline at end of file diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.test.js b/test/toOrdinalSuffix/toOrdinalSuffix.test.js new file mode 100644 index 000000000..bc261a66c --- /dev/null +++ b/test/toOrdinalSuffix/toOrdinalSuffix.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toOrdinalSuffix = require('./toOrdinalSuffix.js'); + +test('Testing toOrdinalSuffix', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toOrdinalSuffix === 'function', 'toOrdinalSuffix is a Function'); + //t.deepEqual(toOrdinalSuffix(args..), 'Expected'); + //t.equal(toOrdinalSuffix(args..), 'Expected'); + //t.false(toOrdinalSuffix(args..), 'Expected'); + //t.throws(toOrdinalSuffix(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toSafeInteger/toSafeInteger.js b/test/toSafeInteger/toSafeInteger.js new file mode 100644 index 000000000..fce9922a8 --- /dev/null +++ b/test/toSafeInteger/toSafeInteger.js @@ -0,0 +1,2 @@ +module.exports = num => +Math.round(Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER)); \ No newline at end of file diff --git a/test/toSafeInteger/toSafeInteger.test.js b/test/toSafeInteger/toSafeInteger.test.js new file mode 100644 index 000000000..d60c7a9d9 --- /dev/null +++ b/test/toSafeInteger/toSafeInteger.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toSafeInteger = require('./toSafeInteger.js'); + +test('Testing toSafeInteger', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toSafeInteger === 'function', 'toSafeInteger is a Function'); + //t.deepEqual(toSafeInteger(args..), 'Expected'); + //t.equal(toSafeInteger(args..), 'Expected'); + //t.false(toSafeInteger(args..), 'Expected'); + //t.throws(toSafeInteger(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toSnakeCase/toSnakeCase.js b/test/toSnakeCase/toSnakeCase.js new file mode 100644 index 000000000..b98b314d6 --- /dev/null +++ b/test/toSnakeCase/toSnakeCase.js @@ -0,0 +1,6 @@ +module.exports = 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('_'); \ No newline at end of file diff --git a/test/toSnakeCase/toSnakeCase.test.js b/test/toSnakeCase/toSnakeCase.test.js new file mode 100644 index 000000000..d0fd48975 --- /dev/null +++ b/test/toSnakeCase/toSnakeCase.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toSnakeCase = require('./toSnakeCase.js'); + +test('Testing toSnakeCase', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toSnakeCase === 'function', 'toSnakeCase is a Function'); + //t.deepEqual(toSnakeCase(args..), 'Expected'); + //t.equal(toSnakeCase(args..), 'Expected'); + //t.false(toSnakeCase(args..), 'Expected'); + //t.throws(toSnakeCase(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/toggleClass/toggleClass.js b/test/toggleClass/toggleClass.js new file mode 100644 index 000000000..17f3caa71 --- /dev/null +++ b/test/toggleClass/toggleClass.js @@ -0,0 +1 @@ +module.exports = (el, className) => el.classList.toggle(className); \ No newline at end of file diff --git a/test/toggleClass/toggleClass.test.js b/test/toggleClass/toggleClass.test.js new file mode 100644 index 000000000..a1c97c303 --- /dev/null +++ b/test/toggleClass/toggleClass.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const toggleClass = require('./toggleClass.js'); + +test('Testing toggleClass', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof toggleClass === 'function', 'toggleClass is a Function'); + //t.deepEqual(toggleClass(args..), 'Expected'); + //t.equal(toggleClass(args..), 'Expected'); + //t.false(toggleClass(args..), 'Expected'); + //t.throws(toggleClass(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/tomorrow/tomorrow.js b/test/tomorrow/tomorrow.js new file mode 100644 index 000000000..1e75360fc --- /dev/null +++ b/test/tomorrow/tomorrow.js @@ -0,0 +1 @@ +module.exports = () => new Date(new Date().getTime() + 86400000).toISOString().split('T')[0]; \ No newline at end of file diff --git a/test/tomorrow/tomorrow.test.js b/test/tomorrow/tomorrow.test.js new file mode 100644 index 000000000..0e8ab6edf --- /dev/null +++ b/test/tomorrow/tomorrow.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const tomorrow = require('./tomorrow.js'); + +test('Testing tomorrow', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof tomorrow === 'function', 'tomorrow is a Function'); + //t.deepEqual(tomorrow(args..), 'Expected'); + //t.equal(tomorrow(args..), 'Expected'); + //t.false(tomorrow(args..), 'Expected'); + //t.throws(tomorrow(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/truncateString/truncateString.js b/test/truncateString/truncateString.js new file mode 100644 index 000000000..04a3a6755 --- /dev/null +++ b/test/truncateString/truncateString.js @@ -0,0 +1,2 @@ +module.exports = (str, num) => +str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; \ No newline at end of file diff --git a/test/truncateString/truncateString.test.js b/test/truncateString/truncateString.test.js new file mode 100644 index 000000000..0b6ef0997 --- /dev/null +++ b/test/truncateString/truncateString.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const truncateString = require('./truncateString.js'); + +test('Testing truncateString', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof truncateString === 'function', 'truncateString is a Function'); + //t.deepEqual(truncateString(args..), 'Expected'); + //t.equal(truncateString(args..), 'Expected'); + //t.false(truncateString(args..), 'Expected'); + //t.throws(truncateString(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/truthCheckCollection/truthCheckCollection.js b/test/truthCheckCollection/truthCheckCollection.js new file mode 100644 index 000000000..33c508b15 --- /dev/null +++ b/test/truthCheckCollection/truthCheckCollection.js @@ -0,0 +1 @@ +module.exports = (collection, pre) => collection.every(obj => obj[pre]); \ No newline at end of file diff --git a/test/truthCheckCollection/truthCheckCollection.test.js b/test/truthCheckCollection/truthCheckCollection.test.js new file mode 100644 index 000000000..5e7d6864b --- /dev/null +++ b/test/truthCheckCollection/truthCheckCollection.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const truthCheckCollection = require('./truthCheckCollection.js'); + +test('Testing truthCheckCollection', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof truthCheckCollection === 'function', 'truthCheckCollection is a Function'); + //t.deepEqual(truthCheckCollection(args..), 'Expected'); + //t.equal(truthCheckCollection(args..), 'Expected'); + //t.false(truthCheckCollection(args..), 'Expected'); + //t.throws(truthCheckCollection(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/unescapeHTML/unescapeHTML.js b/test/unescapeHTML/unescapeHTML.js new file mode 100644 index 000000000..d051051d2 --- /dev/null +++ b/test/unescapeHTML/unescapeHTML.js @@ -0,0 +1,12 @@ +module.exports = str => +str.replace( +/&|<|>|'|"/g, +tag => +({ +'&': '&', +'<': '<', +'>': '>', +''': "'", +'"': '"' +}[tag] || tag) +); \ No newline at end of file diff --git a/test/unescapeHTML/unescapeHTML.test.js b/test/unescapeHTML/unescapeHTML.test.js new file mode 100644 index 000000000..3014e5820 --- /dev/null +++ b/test/unescapeHTML/unescapeHTML.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const unescapeHTML = require('./unescapeHTML.js'); + +test('Testing unescapeHTML', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof unescapeHTML === 'function', 'unescapeHTML is a Function'); + //t.deepEqual(unescapeHTML(args..), 'Expected'); + //t.equal(unescapeHTML(args..), 'Expected'); + //t.false(unescapeHTML(args..), 'Expected'); + //t.throws(unescapeHTML(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/union/union.js b/test/union/union.js new file mode 100644 index 000000000..fce73daff --- /dev/null +++ b/test/union/union.js @@ -0,0 +1 @@ +module.exports = (a, b) => Array.from(new Set([...a, ...b])); \ No newline at end of file diff --git a/test/union/union.test.js b/test/union/union.test.js new file mode 100644 index 000000000..40f1db354 --- /dev/null +++ b/test/union/union.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const union = require('./union.js'); + +test('Testing union', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof union === 'function', 'union is a Function'); + //t.deepEqual(union(args..), 'Expected'); + //t.equal(union(args..), 'Expected'); + //t.false(union(args..), 'Expected'); + //t.throws(union(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/untildify/untildify.js b/test/untildify/untildify.js new file mode 100644 index 000000000..d8fdc33fe --- /dev/null +++ b/test/untildify/untildify.js @@ -0,0 +1 @@ +module.exports = str => str.replace(/^~($|\/|\\)/, `${require('os').homedir()}$1`); \ No newline at end of file diff --git a/test/untildify/untildify.test.js b/test/untildify/untildify.test.js new file mode 100644 index 000000000..0777b4917 --- /dev/null +++ b/test/untildify/untildify.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const untildify = require('./untildify.js'); + +test('Testing untildify', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof untildify === 'function', 'untildify is a Function'); + //t.deepEqual(untildify(args..), 'Expected'); + //t.equal(untildify(args..), 'Expected'); + //t.false(untildify(args..), 'Expected'); + //t.throws(untildify(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/validateNumber/validateNumber.js b/test/validateNumber/validateNumber.js new file mode 100644 index 000000000..08913a160 --- /dev/null +++ b/test/validateNumber/validateNumber.js @@ -0,0 +1 @@ +module.exports = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n; \ No newline at end of file diff --git a/test/validateNumber/validateNumber.test.js b/test/validateNumber/validateNumber.test.js new file mode 100644 index 000000000..921edec24 --- /dev/null +++ b/test/validateNumber/validateNumber.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const validateNumber = require('./validateNumber.js'); + +test('Testing validateNumber', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof validateNumber === 'function', 'validateNumber is a Function'); + //t.deepEqual(validateNumber(args..), 'Expected'); + //t.equal(validateNumber(args..), 'Expected'); + //t.false(validateNumber(args..), 'Expected'); + //t.throws(validateNumber(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/without/without.js b/test/without/without.js new file mode 100644 index 000000000..dab9ff155 --- /dev/null +++ b/test/without/without.js @@ -0,0 +1 @@ +module.exports = (arr, ...args) => arr.filter(v => !args.includes(v)); \ No newline at end of file diff --git a/test/without/without.test.js b/test/without/without.test.js new file mode 100644 index 000000000..7d3ff120d --- /dev/null +++ b/test/without/without.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const without = require('./without.js'); + +test('Testing without', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof without === 'function', 'without is a Function'); + //t.deepEqual(without(args..), 'Expected'); + //t.equal(without(args..), 'Expected'); + //t.false(without(args..), 'Expected'); + //t.throws(without(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/words/words.js b/test/words/words.js new file mode 100644 index 000000000..02263bfc1 --- /dev/null +++ b/test/words/words.js @@ -0,0 +1 @@ +module.exports = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean); \ No newline at end of file diff --git a/test/words/words.test.js b/test/words/words.test.js new file mode 100644 index 000000000..c8deb7c41 --- /dev/null +++ b/test/words/words.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const words = require('./words.js'); + +test('Testing words', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof words === 'function', 'words is a Function'); + //t.deepEqual(words(args..), 'Expected'); + //t.equal(words(args..), 'Expected'); + //t.false(words(args..), 'Expected'); + //t.throws(words(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/yesNo/yesNo.js b/test/yesNo/yesNo.js new file mode 100644 index 000000000..0b489bdb4 --- /dev/null +++ b/test/yesNo/yesNo.js @@ -0,0 +1,2 @@ +module.exports = (val, def = false) => +/^(y|yes)$/i.test(val) ? true : /^(n|no)$/i.test(val) ? false : def; \ No newline at end of file diff --git a/test/yesNo/yesNo.test.js b/test/yesNo/yesNo.test.js new file mode 100644 index 000000000..2d49b71a6 --- /dev/null +++ b/test/yesNo/yesNo.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const yesNo = require('./yesNo.js'); + +test('Testing yesNo', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof yesNo === 'function', 'yesNo is a Function'); + //t.deepEqual(yesNo(args..), 'Expected'); + //t.equal(yesNo(args..), 'Expected'); + //t.false(yesNo(args..), 'Expected'); + //t.throws(yesNo(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/zip/zip.js b/test/zip/zip.js new file mode 100644 index 000000000..0ae142bce --- /dev/null +++ b/test/zip/zip.js @@ -0,0 +1,6 @@ +module.exports = (...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]); +}); +}; \ No newline at end of file diff --git a/test/zip/zip.test.js b/test/zip/zip.test.js new file mode 100644 index 000000000..31a138367 --- /dev/null +++ b/test/zip/zip.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const zip = require('./zip.js'); + +test('Testing zip', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof zip === 'function', 'zip is a Function'); + //t.deepEqual(zip(args..), 'Expected'); + //t.equal(zip(args..), 'Expected'); + //t.false(zip(args..), 'Expected'); + //t.throws(zip(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/zipObject/zipObject.js b/test/zipObject/zipObject.js new file mode 100644 index 000000000..9e2e0123d --- /dev/null +++ b/test/zipObject/zipObject.js @@ -0,0 +1,2 @@ +module.exports = (props, values) => +props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); \ No newline at end of file diff --git a/test/zipObject/zipObject.test.js b/test/zipObject/zipObject.test.js new file mode 100644 index 000000000..2aafee4c7 --- /dev/null +++ b/test/zipObject/zipObject.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const zipObject = require('./zipObject.js'); + +test('Testing zipObject', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof zipObject === 'function', 'zipObject is a Function'); + //t.deepEqual(zipObject(args..), 'Expected'); + //t.equal(zipObject(args..), 'Expected'); + //t.false(zipObject(args..), 'Expected'); + //t.throws(zipObject(args..), 'Expected'); + t.end(); +}); \ No newline at end of file