-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #516 from kingdavidmartins/tdd-update
Resolves #78
- Loading branch information
Showing
388 changed files
with
3,291 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ node_modules/ | |
currentSnippet\.js | ||
*.md.temp.js | ||
.idea | ||
test.sh | ||
test/ | ||
test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = arr => { | ||
const dt = new Date(parseInt(arr.toString().substr(6))); | ||
return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)), | ||
[] | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module.exports = (arr, listID) => | ||
arr.map(item => (document.querySelector('#' + listID).innerHTML += `<li>${item}</li>`)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = (...nums) => [...nums].reduce((acc, val) => acc + val, 0) / nums.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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.equal(average(9, 1), 5, 'The average of 1 & 9 is 5'); | ||
//t.deepEqual(average(args..), 'Expected'); | ||
//t.equal(average(args..), 'Expected'); | ||
//t.false(average(args..), 'Expected'); | ||
//t.throws(average(args..), 'Expected'); | ||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = () => | ||
document.documentElement.clientHeight + window.scrollY >= | ||
(document.documentElement.scrollHeight || document.documentElement.clientHeight); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = str => new Blob([str]).size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = (key, ...args) => context => context[key](...args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module.exports = ([first, ...rest], lowerRest = false) => | ||
first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join('')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = str => str.replace(/\b[a-z]/g, char => char.toUpperCase()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = fns => { | ||
let curr = 0; | ||
const next = () => fns[curr++](next); | ||
next(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = regExp => new RegExp(regExp.source, regExp.flags); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
Oops, something went wrong.