ran npm run tester -> logged invertKeyValues test are invalid
This commit is contained in:
2
test/composeRight/composeRight.js
Normal file
2
test/composeRight/composeRight.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
const composeRight = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));
|
||||||
|
module.exports = composeRight
|
||||||
13
test/composeRight/composeRight.test.js
Normal file
13
test/composeRight/composeRight.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const composeRight = require('./composeRight.js');
|
||||||
|
|
||||||
|
test('Testing composeRight', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof composeRight === 'function', 'composeRight is a Function');
|
||||||
|
//t.deepEqual(composeRight(args..), 'Expected');
|
||||||
|
//t.equal(composeRight(args..), 'Expected');
|
||||||
|
//t.false(composeRight(args..), 'Expected');
|
||||||
|
//t.throws(composeRight(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
5
test/differenceBy/differenceBy.js
Normal file
5
test/differenceBy/differenceBy.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const differenceBy = (a, b, fn) => {
|
||||||
|
const s = new Set(b.map(v => fn(v)));
|
||||||
|
return a.filter(x => !s.has(fn(x)));
|
||||||
|
};
|
||||||
|
module.exports = differenceBy
|
||||||
13
test/differenceBy/differenceBy.test.js
Normal file
13
test/differenceBy/differenceBy.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const differenceBy = require('./differenceBy.js');
|
||||||
|
|
||||||
|
test('Testing differenceBy', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof differenceBy === 'function', 'differenceBy is a Function');
|
||||||
|
//t.deepEqual(differenceBy(args..), 'Expected');
|
||||||
|
//t.equal(differenceBy(args..), 'Expected');
|
||||||
|
//t.false(differenceBy(args..), 'Expected');
|
||||||
|
//t.throws(differenceBy(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
@ -1,2 +1,2 @@
|
|||||||
const findLast = (arr, fn) => arr.filter(fn).slice(-1);
|
const findLast = (arr, fn) => arr.filter(fn).slice(-1)[0];
|
||||||
module.exports = findLast
|
module.exports = findLast
|
||||||
6
test/findLastIndex/findLastIndex.js
Normal file
6
test/findLastIndex/findLastIndex.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
const findLastIndex = (arr, fn) =>
|
||||||
|
arr
|
||||||
|
.map((val, i) => [i, val])
|
||||||
|
.filter(val => fn(val[1], val[0], arr))
|
||||||
|
.slice(-1)[0][0];
|
||||||
|
module.exports = findLastIndex
|
||||||
13
test/findLastIndex/findLastIndex.test.js
Normal file
13
test/findLastIndex/findLastIndex.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const findLastIndex = require('./findLastIndex.js');
|
||||||
|
|
||||||
|
test('Testing findLastIndex', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof findLastIndex === 'function', 'findLastIndex is a Function');
|
||||||
|
//t.deepEqual(findLastIndex(args..), 'Expected');
|
||||||
|
//t.equal(findLastIndex(args..), 'Expected');
|
||||||
|
//t.false(findLastIndex(args..), 'Expected');
|
||||||
|
//t.throws(findLastIndex(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
5
test/intersectionBy/intersectionBy.js
Normal file
5
test/intersectionBy/intersectionBy.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const intersectionBy = (a, b, fn) => {
|
||||||
|
const s = new Set(b.map(x => fn(x)));
|
||||||
|
return a.filter(x => s.has(fn(x)));
|
||||||
|
};
|
||||||
|
module.exports = intersectionBy
|
||||||
13
test/intersectionBy/intersectionBy.test.js
Normal file
13
test/intersectionBy/intersectionBy.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const intersectionBy = require('./intersectionBy.js');
|
||||||
|
|
||||||
|
test('Testing intersectionBy', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof intersectionBy === 'function', 'intersectionBy is a Function');
|
||||||
|
//t.deepEqual(intersectionBy(args..), 'Expected');
|
||||||
|
//t.equal(intersectionBy(args..), 'Expected');
|
||||||
|
//t.false(intersectionBy(args..), 'Expected');
|
||||||
|
//t.throws(intersectionBy(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
2
test/intersectionWith/intersectionWith.js
Normal file
2
test/intersectionWith/intersectionWith.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
const intersectionWith = (a, b, comp) => a.filter(x => b.findIndex(y => comp(x, y)) !== -1);
|
||||||
|
module.exports = intersectionWith
|
||||||
13
test/intersectionWith/intersectionWith.test.js
Normal file
13
test/intersectionWith/intersectionWith.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const intersectionWith = require('./intersectionWith.js');
|
||||||
|
|
||||||
|
test('Testing intersectionWith', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof intersectionWith === 'function', 'intersectionWith is a Function');
|
||||||
|
//t.deepEqual(intersectionWith(args..), 'Expected');
|
||||||
|
//t.equal(intersectionWith(args..), 'Expected');
|
||||||
|
//t.false(intersectionWith(args..), 'Expected');
|
||||||
|
//t.throws(intersectionWith(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
9
test/sortedLastIndex/sortedLastIndex.js
Normal file
9
test/sortedLastIndex/sortedLastIndex.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
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;
|
||||||
|
};
|
||||||
|
module.exports = sortedLastIndex
|
||||||
13
test/sortedLastIndex/sortedLastIndex.test.js
Normal file
13
test/sortedLastIndex/sortedLastIndex.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const sortedLastIndex = require('./sortedLastIndex.js');
|
||||||
|
|
||||||
|
test('Testing sortedLastIndex', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof sortedLastIndex === 'function', 'sortedLastIndex is a Function');
|
||||||
|
//t.deepEqual(sortedLastIndex(args..), 'Expected');
|
||||||
|
//t.equal(sortedLastIndex(args..), 'Expected');
|
||||||
|
//t.false(sortedLastIndex(args..), 'Expected');
|
||||||
|
//t.throws(sortedLastIndex(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
6
test/symmetricDifferenceBy/symmetricDifferenceBy.js
Normal file
6
test/symmetricDifferenceBy/symmetricDifferenceBy.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
const symmetricDifferenceBy = (a, b, fn) => {
|
||||||
|
const sA = new Set(a.map(v => fn(v))),
|
||||||
|
sB = new Set(b.map(v => fn(v)));
|
||||||
|
return [...a.filter(x => !sB.has(fn(x))), ...b.filter(x => !sA.has(fn(x)))];
|
||||||
|
};
|
||||||
|
module.exports = symmetricDifferenceBy
|
||||||
13
test/symmetricDifferenceBy/symmetricDifferenceBy.test.js
Normal file
13
test/symmetricDifferenceBy/symmetricDifferenceBy.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const symmetricDifferenceBy = require('./symmetricDifferenceBy.js');
|
||||||
|
|
||||||
|
test('Testing symmetricDifferenceBy', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof symmetricDifferenceBy === 'function', 'symmetricDifferenceBy is a Function');
|
||||||
|
//t.deepEqual(symmetricDifferenceBy(args..), 'Expected');
|
||||||
|
//t.equal(symmetricDifferenceBy(args..), 'Expected');
|
||||||
|
//t.false(symmetricDifferenceBy(args..), 'Expected');
|
||||||
|
//t.throws(symmetricDifferenceBy(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
5
test/symmetricDifferenceWith/symmetricDifferenceWith.js
Normal file
5
test/symmetricDifferenceWith/symmetricDifferenceWith.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const symmetricDifferenceWith = (arr, val, comp) => [
|
||||||
|
...arr.filter(a => val.findIndex(b => comp(a, b)) === -1),
|
||||||
|
...val.filter(a => arr.findIndex(b => comp(a, b)) === -1)
|
||||||
|
];
|
||||||
|
module.exports = symmetricDifferenceWith
|
||||||
13
test/symmetricDifferenceWith/symmetricDifferenceWith.test.js
Normal file
13
test/symmetricDifferenceWith/symmetricDifferenceWith.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const symmetricDifferenceWith = require('./symmetricDifferenceWith.js');
|
||||||
|
|
||||||
|
test('Testing symmetricDifferenceWith', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof symmetricDifferenceWith === 'function', 'symmetricDifferenceWith is a Function');
|
||||||
|
//t.deepEqual(symmetricDifferenceWith(args..), 'Expected');
|
||||||
|
//t.equal(symmetricDifferenceWith(args..), 'Expected');
|
||||||
|
//t.false(symmetricDifferenceWith(args..), 'Expected');
|
||||||
|
//t.throws(symmetricDifferenceWith(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
1299
test/testlog
1299
test/testlog
File diff suppressed because it is too large
Load Diff
5
test/unionBy/unionBy.js
Normal file
5
test/unionBy/unionBy.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const unionBy = (a, b, fn) => {
|
||||||
|
const s = new Set(a.map(v => fn(v)));
|
||||||
|
return Array.from(new Set([...a, ...b.filter(x => !s.has(fn(x)))]));
|
||||||
|
};
|
||||||
|
module.exports = unionBy
|
||||||
13
test/unionBy/unionBy.test.js
Normal file
13
test/unionBy/unionBy.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const unionBy = require('./unionBy.js');
|
||||||
|
|
||||||
|
test('Testing unionBy', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof unionBy === 'function', 'unionBy is a Function');
|
||||||
|
//t.deepEqual(unionBy(args..), 'Expected');
|
||||||
|
//t.equal(unionBy(args..), 'Expected');
|
||||||
|
//t.false(unionBy(args..), 'Expected');
|
||||||
|
//t.throws(unionBy(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
3
test/unionWith/unionWith.js
Normal file
3
test/unionWith/unionWith.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const unionWith = (a, b, comp) =>
|
||||||
|
Array.from(new Set([...a, ...b.filter(x => a.findIndex(y => comp(x, y)) === -1)]));
|
||||||
|
module.exports = unionWith
|
||||||
13
test/unionWith/unionWith.test.js
Normal file
13
test/unionWith/unionWith.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const unionWith = require('./unionWith.js');
|
||||||
|
|
||||||
|
test('Testing unionWith', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof unionWith === 'function', 'unionWith is a Function');
|
||||||
|
//t.deepEqual(unionWith(args..), 'Expected');
|
||||||
|
//t.equal(unionWith(args..), 'Expected');
|
||||||
|
//t.false(unionWith(args..), 'Expected');
|
||||||
|
//t.throws(unionWith(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
8
test/unzip/unzip.js
Normal file
8
test/unzip/unzip.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const unzip = arr =>
|
||||||
|
arr.reduce(
|
||||||
|
(acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc),
|
||||||
|
Array.from({
|
||||||
|
length: Math.max(...arr.map(x => x.length))
|
||||||
|
}).map(x => [])
|
||||||
|
);
|
||||||
|
module.exports = unzip
|
||||||
13
test/unzip/unzip.test.js
Normal file
13
test/unzip/unzip.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const unzip = require('./unzip.js');
|
||||||
|
|
||||||
|
test('Testing unzip', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof unzip === 'function', 'unzip is a Function');
|
||||||
|
//t.deepEqual(unzip(args..), 'Expected');
|
||||||
|
//t.equal(unzip(args..), 'Expected');
|
||||||
|
//t.false(unzip(args..), 'Expected');
|
||||||
|
//t.throws(unzip(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
10
test/unzipWith/unzipWith.js
Normal file
10
test/unzipWith/unzipWith.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const unzipWith = (arr, fn) =>
|
||||||
|
arr
|
||||||
|
.reduce(
|
||||||
|
(acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc),
|
||||||
|
Array.from({
|
||||||
|
length: Math.max(...arr.map(x => x.length))
|
||||||
|
}).map(x => [])
|
||||||
|
)
|
||||||
|
.map(val => fn(...val));
|
||||||
|
module.exports = unzipWith
|
||||||
13
test/unzipWith/unzipWith.test.js
Normal file
13
test/unzipWith/unzipWith.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const unzipWith = require('./unzipWith.js');
|
||||||
|
|
||||||
|
test('Testing unzipWith', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof unzipWith === 'function', 'unzipWith is a Function');
|
||||||
|
//t.deepEqual(unzipWith(args..), 'Expected');
|
||||||
|
//t.equal(unzipWith(args..), 'Expected');
|
||||||
|
//t.false(unzipWith(args..), 'Expected');
|
||||||
|
//t.throws(unzipWith(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user