diff --git a/test/averageBy/averageBy.js b/test/averageBy/averageBy.js new file mode 100644 index 000000000..510263fa7 --- /dev/null +++ b/test/averageBy/averageBy.js @@ -0,0 +1,3 @@ +module.exports = averageBy = (arr, fn) => +arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0) / +arr.length; \ No newline at end of file diff --git a/test/averageBy/averageBy.test.js b/test/averageBy/averageBy.test.js new file mode 100644 index 000000000..60675dfb7 --- /dev/null +++ b/test/averageBy/averageBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const averageBy = require('./averageBy.js'); + +test('Testing averageBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof averageBy === 'function', 'averageBy is a Function'); + //t.deepEqual(averageBy(args..), 'Expected'); + //t.equal(averageBy(args..), 'Expected'); + //t.false(averageBy(args..), 'Expected'); + //t.throws(averageBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/colorize/colorize.js b/test/colorize/colorize.js new file mode 100644 index 000000000..25c23fad7 --- /dev/null +++ b/test/colorize/colorize.js @@ -0,0 +1,18 @@ +module.exports = colorize = (...args) => ({ +black: `\x1b[30m${args.join(' ')}`, +red: `\x1b[31m${args.join(' ')}`, +green: `\x1b[32m${args.join(' ')}`, +yellow: `\x1b[33m${args.join(' ')}`, +blue: `\x1b[34m${args.join(' ')}`, +magenta: `\x1b[35m${args.join(' ')}`, +cyan: `\x1b[36m${args.join(' ')}`, +white: `\x1b[37m${args.join(' ')}`, +bgBlack: `\x1b[40m${args.join(' ')}\x1b[0m`, +bgRed: `\x1b[41m${args.join(' ')}\x1b[0m`, +bgGreen: `\x1b[42m${args.join(' ')}\x1b[0m`, +bgYellow: `\x1b[43m${args.join(' ')}\x1b[0m`, +bgBlue: `\x1b[44m${args.join(' ')}\x1b[0m`, +bgMagenta: `\x1b[45m${args.join(' ')}\x1b[0m`, +bgCyan: `\x1b[46m${args.join(' ')}\x1b[0m`, +bgWhite: `\x1b[47m${args.join(' ')}\x1b[0m` +}); \ No newline at end of file diff --git a/test/colorize/colorize.test.js b/test/colorize/colorize.test.js new file mode 100644 index 000000000..a20fe2a3f --- /dev/null +++ b/test/colorize/colorize.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const colorize = require('./colorize.js'); + +test('Testing colorize', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof colorize === 'function', 'colorize is a Function'); + //t.deepEqual(colorize(args..), 'Expected'); + //t.equal(colorize(args..), 'Expected'); + //t.false(colorize(args..), 'Expected'); + //t.throws(colorize(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/countBy/countBy.js b/test/countBy/countBy.js new file mode 100644 index 000000000..661df57cb --- /dev/null +++ b/test/countBy/countBy.js @@ -0,0 +1,5 @@ +module.exports = countBy = (arr, fn) => +arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => { +acc[val] = (acc[val] || 0) + 1; +return acc; +}, {}); \ No newline at end of file diff --git a/test/countBy/countBy.test.js b/test/countBy/countBy.test.js new file mode 100644 index 000000000..24ca39f7e --- /dev/null +++ b/test/countBy/countBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const countBy = require('./countBy.js'); + +test('Testing countBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof countBy === 'function', 'countBy is a Function'); + //t.deepEqual(countBy(args..), 'Expected'); + //t.equal(countBy(args..), 'Expected'); + //t.false(countBy(args..), 'Expected'); + //t.throws(countBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/findLast/findLast.js b/test/findLast/findLast.js new file mode 100644 index 000000000..cbd294f72 --- /dev/null +++ b/test/findLast/findLast.js @@ -0,0 +1 @@ +module.exports = findLast = (arr, fn) => arr.filter(fn).slice(-1); \ No newline at end of file diff --git a/test/findLast/findLast.test.js b/test/findLast/findLast.test.js new file mode 100644 index 000000000..036d5f313 --- /dev/null +++ b/test/findLast/findLast.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const findLast = require('./findLast.js'); + +test('Testing findLast', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof findLast === 'function', 'findLast is a Function'); + //t.deepEqual(findLast(args..), 'Expected'); + //t.equal(findLast(args..), 'Expected'); + //t.false(findLast(args..), 'Expected'); + //t.throws(findLast(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/functions/functions.js b/test/functions/functions.js new file mode 100644 index 000000000..d0760b8b0 --- /dev/null +++ b/test/functions/functions.js @@ -0,0 +1,5 @@ +module.exports = functions = (obj, inherited = false) => +(inherited +? [...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))] +: Object.keys(obj) +).filter(key => typeof obj[key] === 'function'); \ No newline at end of file diff --git a/test/functions/functions.test.js b/test/functions/functions.test.js new file mode 100644 index 000000000..8590341fb --- /dev/null +++ b/test/functions/functions.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const functions = require('./functions.js'); + +test('Testing functions', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof functions === 'function', 'functions is a Function'); + //t.deepEqual(functions(args..), 'Expected'); + //t.equal(functions(args..), 'Expected'); + //t.false(functions(args..), 'Expected'); + //t.throws(functions(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/mapKeys/mapKeys.js b/test/mapKeys/mapKeys.js new file mode 100644 index 000000000..6105240a7 --- /dev/null +++ b/test/mapKeys/mapKeys.js @@ -0,0 +1,5 @@ +module.exports = mapKeys = (obj, fn) => +Object.keys(obj).reduce((acc, k) => { +acc[fn(obj[k], k, obj)] = obj[k]; +return acc; +}, {}); \ No newline at end of file diff --git a/test/mapKeys/mapKeys.test.js b/test/mapKeys/mapKeys.test.js new file mode 100644 index 000000000..a2b7ea63a --- /dev/null +++ b/test/mapKeys/mapKeys.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const mapKeys = require('./mapKeys.js'); + +test('Testing mapKeys', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof mapKeys === 'function', 'mapKeys is a Function'); + //t.deepEqual(mapKeys(args..), 'Expected'); + //t.equal(mapKeys(args..), 'Expected'); + //t.false(mapKeys(args..), 'Expected'); + //t.throws(mapKeys(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/mapValues/mapValues.js b/test/mapValues/mapValues.js new file mode 100644 index 000000000..80977c929 --- /dev/null +++ b/test/mapValues/mapValues.js @@ -0,0 +1,5 @@ +module.exports = mapValues = (obj, fn) => +Object.keys(obj).reduce((acc, k) => { +acc[k] = fn(obj[k], k, obj); +return acc; +}, {}); \ No newline at end of file diff --git a/test/mapValues/mapValues.test.js b/test/mapValues/mapValues.test.js new file mode 100644 index 000000000..e30e06c66 --- /dev/null +++ b/test/mapValues/mapValues.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const mapValues = require('./mapValues.js'); + +test('Testing mapValues', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof mapValues === 'function', 'mapValues is a Function'); + //t.deepEqual(mapValues(args..), 'Expected'); + //t.equal(mapValues(args..), 'Expected'); + //t.false(mapValues(args..), 'Expected'); + //t.throws(mapValues(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/maxBy/maxBy.js b/test/maxBy/maxBy.js new file mode 100644 index 000000000..546503bd7 --- /dev/null +++ b/test/maxBy/maxBy.js @@ -0,0 +1 @@ +module.exports = maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); \ No newline at end of file diff --git a/test/maxBy/maxBy.test.js b/test/maxBy/maxBy.test.js new file mode 100644 index 000000000..765bb73ec --- /dev/null +++ b/test/maxBy/maxBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const maxBy = require('./maxBy.js'); + +test('Testing maxBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof maxBy === 'function', 'maxBy is a Function'); + //t.deepEqual(maxBy(args..), 'Expected'); + //t.equal(maxBy(args..), 'Expected'); + //t.false(maxBy(args..), 'Expected'); + //t.throws(maxBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/merge/merge.js b/test/merge/merge.js new file mode 100644 index 000000000..0b454216f --- /dev/null +++ b/test/merge/merge.js @@ -0,0 +1,9 @@ +module.exports = merge = (...objs) => +[...objs].reduce( +(acc, obj) => +Object.keys(obj).reduce((a, k) => { +acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k]; +return acc; +}, {}), +{} +); \ No newline at end of file diff --git a/test/merge/merge.test.js b/test/merge/merge.test.js new file mode 100644 index 000000000..28ade12bd --- /dev/null +++ b/test/merge/merge.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const merge = require('./merge.js'); + +test('Testing merge', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof merge === 'function', 'merge is a Function'); + //t.deepEqual(merge(args..), 'Expected'); + //t.equal(merge(args..), 'Expected'); + //t.false(merge(args..), 'Expected'); + //t.throws(merge(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/minBy/minBy.js b/test/minBy/minBy.js new file mode 100644 index 000000000..7d0db026a --- /dev/null +++ b/test/minBy/minBy.js @@ -0,0 +1 @@ +module.exports = minBy = (arr, fn) => Math.min(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); \ No newline at end of file diff --git a/test/minBy/minBy.test.js b/test/minBy/minBy.test.js new file mode 100644 index 000000000..130b2de7e --- /dev/null +++ b/test/minBy/minBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const minBy = require('./minBy.js'); + +test('Testing minBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof minBy === 'function', 'minBy is a Function'); + //t.deepEqual(minBy(args..), 'Expected'); + //t.equal(minBy(args..), 'Expected'); + //t.false(minBy(args..), 'Expected'); + //t.throws(minBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/parseCookie/parseCookie.js b/test/parseCookie/parseCookie.js new file mode 100644 index 000000000..d05ea6cf4 --- /dev/null +++ b/test/parseCookie/parseCookie.js @@ -0,0 +1,8 @@ +module.exports = parseCookie = str => +str +.split(';') +.map(v => v.split('=')) +.reduce((acc, v) => { +acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); +return acc; +}, {}); \ No newline at end of file diff --git a/test/parseCookie/parseCookie.test.js b/test/parseCookie/parseCookie.test.js new file mode 100644 index 000000000..76a02bbe2 --- /dev/null +++ b/test/parseCookie/parseCookie.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const parseCookie = require('./parseCookie.js'); + +test('Testing parseCookie', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof parseCookie === 'function', 'parseCookie is a Function'); + //t.deepEqual(parseCookie(args..), 'Expected'); + //t.equal(parseCookie(args..), 'Expected'); + //t.false(parseCookie(args..), 'Expected'); + //t.throws(parseCookie(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/serializeCookie/serializeCookie.js b/test/serializeCookie/serializeCookie.js new file mode 100644 index 000000000..16467650a --- /dev/null +++ b/test/serializeCookie/serializeCookie.js @@ -0,0 +1 @@ +module.exports = serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`; \ No newline at end of file diff --git a/test/serializeCookie/serializeCookie.test.js b/test/serializeCookie/serializeCookie.test.js new file mode 100644 index 000000000..7e4e3a88a --- /dev/null +++ b/test/serializeCookie/serializeCookie.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const serializeCookie = require('./serializeCookie.js'); + +test('Testing serializeCookie', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof serializeCookie === 'function', 'serializeCookie is a Function'); + //t.deepEqual(serializeCookie(args..), 'Expected'); + //t.equal(serializeCookie(args..), 'Expected'); + //t.false(serializeCookie(args..), 'Expected'); + //t.throws(serializeCookie(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/sumBy/sumBy.js b/test/sumBy/sumBy.js new file mode 100644 index 000000000..f12789d24 --- /dev/null +++ b/test/sumBy/sumBy.js @@ -0,0 +1,2 @@ +module.exports = sumBy = (arr, fn) => +arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => acc + val, 0); \ No newline at end of file diff --git a/test/sumBy/sumBy.test.js b/test/sumBy/sumBy.test.js new file mode 100644 index 000000000..23c6140fe --- /dev/null +++ b/test/sumBy/sumBy.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const sumBy = require('./sumBy.js'); + +test('Testing sumBy', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof sumBy === 'function', 'sumBy is a Function'); + //t.deepEqual(sumBy(args..), 'Expected'); + //t.equal(sumBy(args..), 'Expected'); + //t.false(sumBy(args..), 'Expected'); + //t.throws(sumBy(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/transform/transform.js b/test/transform/transform.js new file mode 100644 index 000000000..d6cf8a9ab --- /dev/null +++ b/test/transform/transform.js @@ -0,0 +1 @@ +module.exports = transform = (obj, fn, acc) => Object.keys(obj).reduce((a, k) => fn(a, obj[k], k, obj), acc); \ No newline at end of file diff --git a/test/transform/transform.test.js b/test/transform/transform.test.js new file mode 100644 index 000000000..d32739d4a --- /dev/null +++ b/test/transform/transform.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const transform = require('./transform.js'); + +test('Testing transform', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof transform === 'function', 'transform is a Function'); + //t.deepEqual(transform(args..), 'Expected'); + //t.equal(transform(args..), 'Expected'); + //t.false(transform(args..), 'Expected'); + //t.throws(transform(args..), 'Expected'); + t.end(); +}); \ No newline at end of file