Travis build: 1447 [cron]
This commit is contained in:
8
test/bindAll/bindAll.js
Normal file
8
test/bindAll/bindAll.js
Normal file
@ -0,0 +1,8 @@
|
||||
const bindAll = (obj, ...fns) =>
|
||||
fns.forEach(
|
||||
fn =>
|
||||
(obj[fn] = function() {
|
||||
return fn.apply(obj);
|
||||
})
|
||||
);
|
||||
module.exports = bindAll
|
||||
13
test/bindAll/bindAll.test.js
Normal file
13
test/bindAll/bindAll.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const bindAll = require('./bindAll.js');
|
||||
|
||||
test('Testing bindAll', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof bindAll === 'function', 'bindAll is a Function');
|
||||
//t.deepEqual(bindAll(args..), 'Expected');
|
||||
//t.equal(bindAll(args..), 'Expected');
|
||||
//t.false(bindAll(args..), 'Expected');
|
||||
//t.throws(bindAll(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
2
test/drop/drop.js
Normal file
2
test/drop/drop.js
Normal file
@ -0,0 +1,2 @@
|
||||
const drop = (arr, n = 1) => arr.slice(n);
|
||||
module.exports = drop
|
||||
13
test/drop/drop.test.js
Normal file
13
test/drop/drop.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const drop = require('./drop.js');
|
||||
|
||||
test('Testing drop', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof drop === 'function', 'drop is a Function');
|
||||
//t.deepEqual(drop(args..), 'Expected');
|
||||
//t.equal(drop(args..), 'Expected');
|
||||
//t.false(drop(args..), 'Expected');
|
||||
//t.throws(drop(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
5
test/dropRightWhile/dropRightWhile.js
Normal file
5
test/dropRightWhile/dropRightWhile.js
Normal file
@ -0,0 +1,5 @@
|
||||
const dropRightWhile = (arr, func) => {
|
||||
while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1);
|
||||
return arr;
|
||||
};
|
||||
module.exports = dropRightWhile
|
||||
13
test/dropRightWhile/dropRightWhile.test.js
Normal file
13
test/dropRightWhile/dropRightWhile.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const dropRightWhile = require('./dropRightWhile.js');
|
||||
|
||||
test('Testing dropRightWhile', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof dropRightWhile === 'function', 'dropRightWhile is a Function');
|
||||
//t.deepEqual(dropRightWhile(args..), 'Expected');
|
||||
//t.equal(dropRightWhile(args..), 'Expected');
|
||||
//t.false(dropRightWhile(args..), 'Expected');
|
||||
//t.throws(dropRightWhile(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
5
test/dropWhile/dropWhile.js
Normal file
5
test/dropWhile/dropWhile.js
Normal file
@ -0,0 +1,5 @@
|
||||
const dropWhile = (arr, func) => {
|
||||
while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1);
|
||||
return arr;
|
||||
};
|
||||
module.exports = dropWhile
|
||||
13
test/dropWhile/dropWhile.test.js
Normal file
13
test/dropWhile/dropWhile.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const dropWhile = require('./dropWhile.js');
|
||||
|
||||
test('Testing dropWhile', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof dropWhile === 'function', 'dropWhile is a Function');
|
||||
//t.deepEqual(dropWhile(args..), 'Expected');
|
||||
//t.equal(dropWhile(args..), 'Expected');
|
||||
//t.false(dropWhile(args..), 'Expected');
|
||||
//t.throws(dropWhile(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
10
test/pullBy/pullBy.js
Normal file
10
test/pullBy/pullBy.js
Normal file
@ -0,0 +1,10 @@
|
||||
const pullBy = (arr, ...args) => {
|
||||
const length = args.length;
|
||||
let fn = length > 1 ? args[length - 1] : undefined;
|
||||
fn = typeof fn == 'function' ? (args.pop(), fn) : undefined;
|
||||
let argState = (Array.isArray(args[0]) ? args[0] : args).map(val => fn(val));
|
||||
let pulled = arr.filter((v, i) => !argState.includes(fn(v)));
|
||||
arr.length = 0;
|
||||
pulled.forEach(v => arr.push(v));
|
||||
};
|
||||
module.exports = pullBy
|
||||
13
test/pullBy/pullBy.test.js
Normal file
13
test/pullBy/pullBy.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const pullBy = require('./pullBy.js');
|
||||
|
||||
test('Testing pullBy', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof pullBy === 'function', 'pullBy is a Function');
|
||||
//t.deepEqual(pullBy(args..), 'Expected');
|
||||
//t.equal(pullBy(args..), 'Expected');
|
||||
//t.false(pullBy(args..), 'Expected');
|
||||
//t.throws(pullBy(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
2
test/removeNonASCII/removeNonASCII.js
Normal file
2
test/removeNonASCII/removeNonASCII.js
Normal file
@ -0,0 +1,2 @@
|
||||
const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, '');
|
||||
module.exports = removeNonASCII
|
||||
13
test/removeNonASCII/removeNonASCII.test.js
Normal file
13
test/removeNonASCII/removeNonASCII.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const removeNonASCII = require('./removeNonASCII.js');
|
||||
|
||||
test('Testing removeNonASCII', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof removeNonASCII === 'function', 'removeNonASCII is a Function');
|
||||
//t.deepEqual(removeNonASCII(args..), 'Expected');
|
||||
//t.equal(removeNonASCII(args..), 'Expected');
|
||||
//t.false(removeNonASCII(args..), 'Expected');
|
||||
//t.throws(removeNonASCII(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
7
test/sortedIndexBy/sortedIndexBy.js
Normal file
7
test/sortedIndexBy/sortedIndexBy.js
Normal file
@ -0,0 +1,7 @@
|
||||
const sortedIndexBy = (arr, n, fn) => {
|
||||
const isDescending = fn(arr[0]) > fn(arr[arr.length - 1]);
|
||||
const val = fn(n);
|
||||
const index = arr.findIndex(el => (isDescending ? val >= fn(el) : val <= fn(el)));
|
||||
return index === -1 ? arr.length : index;
|
||||
};
|
||||
module.exports = sortedIndexBy
|
||||
13
test/sortedIndexBy/sortedIndexBy.test.js
Normal file
13
test/sortedIndexBy/sortedIndexBy.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const sortedIndexBy = require('./sortedIndexBy.js');
|
||||
|
||||
test('Testing sortedIndexBy', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof sortedIndexBy === 'function', 'sortedIndexBy is a Function');
|
||||
//t.deepEqual(sortedIndexBy(args..), 'Expected');
|
||||
//t.equal(sortedIndexBy(args..), 'Expected');
|
||||
//t.false(sortedIndexBy(args..), 'Expected');
|
||||
//t.throws(sortedIndexBy(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
@ -2,8 +2,8 @@ const sortedLastIndex = (arr, n) => {
|
||||
const isDescending = arr[0] > arr[arr.length - 1];
|
||||
const index = arr
|
||||
.map((val, i) => [i, val])
|
||||
.filter(el => (isDescending ? n >= el[1] : n >= el[1]))
|
||||
.slice(-1)[0][0];
|
||||
return index === -1 ? arr.length : index;
|
||||
.reverse()
|
||||
.findIndex(el => (isDescending ? n <= el[1] : n >= el[1]));
|
||||
return index === -1 ? 0 : arr.length - index - 1;
|
||||
};
|
||||
module.exports = sortedLastIndex
|
||||
10
test/sortedLastIndexBy/sortedLastIndexBy.js
Normal file
10
test/sortedLastIndexBy/sortedLastIndexBy.js
Normal file
@ -0,0 +1,10 @@
|
||||
const sortedLastIndexBy = (arr, n, fn) => {
|
||||
const isDescending = fn(arr[0]) > fn(arr[arr.length - 1]);
|
||||
const val = fn(n);
|
||||
const index = arr
|
||||
.map((val, i) => [i, fn(val)])
|
||||
.reverse()
|
||||
.findIndex(el => (isDescending ? val <= el[1] : val >= el[1]));
|
||||
return index === -1 ? 0 : arr.length - index;
|
||||
};
|
||||
module.exports = sortedLastIndexBy
|
||||
13
test/sortedLastIndexBy/sortedLastIndexBy.test.js
Normal file
13
test/sortedLastIndexBy/sortedLastIndexBy.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const sortedLastIndexBy = require('./sortedLastIndexBy.js');
|
||||
|
||||
test('Testing sortedLastIndexBy', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof sortedLastIndexBy === 'function', 'sortedLastIndexBy is a Function');
|
||||
//t.deepEqual(sortedLastIndexBy(args..), 'Expected');
|
||||
//t.equal(sortedLastIndexBy(args..), 'Expected');
|
||||
//t.false(sortedLastIndexBy(args..), 'Expected');
|
||||
//t.throws(sortedLastIndexBy(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
2
test/stripHTMLTags/stripHTMLTags.js
Normal file
2
test/stripHTMLTags/stripHTMLTags.js
Normal file
@ -0,0 +1,2 @@
|
||||
const stripHTMLTags = str => str.replace(/<[^>]*>/g, '');
|
||||
module.exports = stripHTMLTags
|
||||
13
test/stripHTMLTags/stripHTMLTags.test.js
Normal file
13
test/stripHTMLTags/stripHTMLTags.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const stripHTMLTags = require('./stripHTMLTags.js');
|
||||
|
||||
test('Testing stripHTMLTags', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof stripHTMLTags === 'function', 'stripHTMLTags is a Function');
|
||||
//t.deepEqual(stripHTMLTags(args..), 'Expected');
|
||||
//t.equal(stripHTMLTags(args..), 'Expected');
|
||||
//t.false(stripHTMLTags(args..), 'Expected');
|
||||
//t.throws(stripHTMLTags(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
6
test/takeRightWhile/takeRightWhile.js
Normal file
6
test/takeRightWhile/takeRightWhile.js
Normal file
@ -0,0 +1,6 @@
|
||||
const takeRightWhile = (arr, func) => {
|
||||
for (let i of arr.reverse().keys())
|
||||
if (func(arr[i])) return arr.reverse().slice(arr.length - i, arr.length);
|
||||
return arr;
|
||||
};
|
||||
module.exports = takeRightWhile
|
||||
13
test/takeRightWhile/takeRightWhile.test.js
Normal file
13
test/takeRightWhile/takeRightWhile.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const takeRightWhile = require('./takeRightWhile.js');
|
||||
|
||||
test('Testing takeRightWhile', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof takeRightWhile === 'function', 'takeRightWhile is a Function');
|
||||
//t.deepEqual(takeRightWhile(args..), 'Expected');
|
||||
//t.equal(takeRightWhile(args..), 'Expected');
|
||||
//t.false(takeRightWhile(args..), 'Expected');
|
||||
//t.throws(takeRightWhile(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
5
test/takeWhile/takeWhile.js
Normal file
5
test/takeWhile/takeWhile.js
Normal file
@ -0,0 +1,5 @@
|
||||
const takeWhile = (arr, func) => {
|
||||
for (let i of arr.keys()) if (func(arr[i])) return arr.slice(0, i);
|
||||
return arr;
|
||||
};
|
||||
module.exports = takeWhile
|
||||
13
test/takeWhile/takeWhile.test.js
Normal file
13
test/takeWhile/takeWhile.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const takeWhile = require('./takeWhile.js');
|
||||
|
||||
test('Testing takeWhile', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof takeWhile === 'function', 'takeWhile is a Function');
|
||||
//t.deepEqual(takeWhile(args..), 'Expected');
|
||||
//t.equal(takeWhile(args..), 'Expected');
|
||||
//t.false(takeWhile(args..), 'Expected');
|
||||
//t.throws(takeWhile(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
1485
test/testlog
1485
test/testlog
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user