vest-utils 0.1.1 → 1.0.0-dev-9c596e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/cjs/vest-utils.development.js +102 -136
  2. package/dist/cjs/vest-utils.production.js +1 -1
  3. package/dist/es/vest-utils.development.js +100 -136
  4. package/dist/es/vest-utils.production.js +1 -1
  5. package/dist/umd/vest-utils.development.js +102 -136
  6. package/dist/umd/vest-utils.production.js +1 -1
  7. package/package.json +1 -1
  8. package/types/vest-utils.d.ts +32 -20
  9. package/types/vest-utils.d.ts.map +1 -1
  10. package/src/__tests__/bindNot.test.ts +0 -37
  11. package/src/__tests__/bus.test.ts +0 -81
  12. package/src/__tests__/cache.test.ts +0 -113
  13. package/src/__tests__/defaultTo.test.ts +0 -50
  14. package/src/__tests__/deferThrow.test.ts +0 -24
  15. package/src/__tests__/greaterThan.test.ts +0 -59
  16. package/src/__tests__/invariant.test.ts +0 -45
  17. package/src/__tests__/isArray.test.ts +0 -15
  18. package/src/__tests__/isNull.test.ts +0 -25
  19. package/src/__tests__/isNumeric.test.ts +0 -26
  20. package/src/__tests__/isUndefined.test.ts +0 -26
  21. package/src/__tests__/lengthEquals.test.ts +0 -56
  22. package/src/__tests__/longerThan.test.ts +0 -56
  23. package/src/__tests__/mapFirst.test.ts +0 -29
  24. package/src/__tests__/numberEquals.test.ts +0 -59
  25. package/src/__tests__/optionalFunctionValue.test.ts +0 -27
  26. package/src/__tests__/seq.test.ts +0 -28
  27. package/src/asArray.ts +0 -3
  28. package/src/assign.ts +0 -1
  29. package/src/bindNot.ts +0 -3
  30. package/src/bus.ts +0 -32
  31. package/src/cache.ts +0 -57
  32. package/src/callEach.ts +0 -5
  33. package/src/defaultTo.ts +0 -8
  34. package/src/deferThrow.ts +0 -5
  35. package/src/either.ts +0 -3
  36. package/src/globals.d.ts +0 -3
  37. package/src/greaterThan.ts +0 -8
  38. package/src/hasOwnProperty.ts +0 -9
  39. package/src/invariant.ts +0 -24
  40. package/src/isArrayValue.ts +0 -11
  41. package/src/isBooleanValue.ts +0 -3
  42. package/src/isEmpty.ts +0 -17
  43. package/src/isFunction.ts +0 -5
  44. package/src/isNull.ts +0 -7
  45. package/src/isNullish.ts +0 -9
  46. package/src/isNumeric.ts +0 -11
  47. package/src/isPositive.ts +0 -5
  48. package/src/isPromise.ts +0 -5
  49. package/src/isStringValue.ts +0 -3
  50. package/src/isUndefined.ts +0 -7
  51. package/src/last.ts +0 -7
  52. package/src/lengthEquals.ts +0 -11
  53. package/src/longerThan.ts +0 -8
  54. package/src/mapFirst.ts +0 -25
  55. package/src/nestedArray.ts +0 -69
  56. package/src/numberEquals.ts +0 -11
  57. package/src/optionalFunctionValue.ts +0 -8
  58. package/src/seq.ts +0 -14
  59. package/src/utilityTypes.ts +0 -9
  60. package/src/vest-utils.ts +0 -36
  61. package/tsconfig.json +0 -46
@@ -1,113 +0,0 @@
1
- import _ from 'lodash';
2
-
3
- import { cache } from 'vest-utils';
4
-
5
- describe('lib: cache', () => {
6
- let c: ReturnType<typeof cache>;
7
-
8
- beforeEach(() => {
9
- c = cache();
10
- });
11
- it('should return a function', () => {
12
- expect(typeof cache()).toBe('function');
13
- });
14
-
15
- it('Should create a new function on each call', () => {
16
- expect(cache()).not.toBe(cache());
17
- });
18
-
19
- describe('on cache miss', () => {
20
- it('Should call passed cache action function and return its value', () => {
21
- const cacheAction = jest.fn(() => ({}));
22
- const res = c([{}], cacheAction);
23
- expect(cacheAction).toHaveBeenCalledTimes(1);
24
- expect(res).toBe(cacheAction.mock.results[0].value);
25
- });
26
- });
27
-
28
- describe('On cache hit', () => {
29
- it('Should return cached result', () => {
30
- const cacheAction = jest.fn(() => {
31
- Math.random();
32
- });
33
- const depsArray = [true, false, {}];
34
- const res1 = c(depsArray, cacheAction);
35
- expect(res1).toBe(cacheAction.mock.results[0].value);
36
- const res2 = c(depsArray, cacheAction);
37
- expect(res2).toBe(res1);
38
- });
39
-
40
- it('Should return without calling the cache action', () => {
41
- const cacheAction = jest.fn();
42
- const depsArray = [Math.random()];
43
- c(depsArray, cacheAction);
44
- expect(cacheAction).toHaveBeenCalledTimes(1);
45
- c(depsArray, cacheAction);
46
- expect(cacheAction).toHaveBeenCalledTimes(1);
47
- });
48
-
49
- it('Should limit cache results to `maxSize`', () => {
50
- const cacheSize = _.random(5, 10);
51
- const callCount = _.random(cacheSize, cacheSize + 10);
52
- const diff = callCount - cacheSize;
53
- /**
54
- * Doing a nested check to combat the auto cleanup of the cache.
55
- * Otherwise, each access to the cache would purge the oldest results
56
- * and we wouldn't get an accurate read - so instantiating a new cache
57
- * for each index is a good workaround.
58
- */
59
- Array.from({ length: callCount }, (_, i) => {
60
- const c = cache(/*maxSize*/ cacheSize);
61
- const results = Array.from({ length: callCount }, (_, j) =>
62
- c([j], Math.random)
63
- );
64
-
65
- if (i < diff) {
66
- // Here we generate a fresh `null` result
67
- expect(c([i], () => null)).toBeNull();
68
- } else {
69
- // Here we retrieve an existing result
70
- expect(c([i], () => null)).toBe(results[i]);
71
- }
72
- });
73
- });
74
- });
75
- it('Should take into account the deps array in its entirety', () => {
76
- const deps = Array.from({ length: 100 }, () =>
77
- _.sample([{}, false, Math.random(), true, () => null])
78
- );
79
- const c = cache();
80
- const res = c([...deps], Math.random);
81
- expect(c([...deps], () => undefined)).toBe(res);
82
- const sliced = deps.slice(0, -1);
83
- expect(c(sliced, () => null)).toBeNull();
84
- });
85
-
86
- describe('cache.get', () => {
87
- describe('On cache miss', () => {
88
- it('Should return null', () => {
89
- expect(c.get([1, 2, 3])).toBeNull();
90
- c([1, 2, 3], Math.random);
91
- expect(c.get([1, 2, '3'])).toBeNull();
92
- });
93
- });
94
-
95
- describe('On cache hit', () => {
96
- it('Should return cached key and item from cache storage', () => {
97
- const res = c([1, 2, 3], Math.random);
98
- expect(c.get([1, 2, 3])?.[0]).toEqual([1, 2, 3]);
99
- expect(c.get([1, 2, 3])?.[1]).toEqual(res);
100
- });
101
- });
102
- });
103
-
104
- describe('cache.invalidate', () => {
105
- it('Should remove cached item from cache storage by its dependcies', () => {
106
- const deps = [1, 2, 3];
107
- c(deps, Math.random);
108
- expect(c.get(deps)).not.toBeNull();
109
- c.invalidate(deps);
110
- expect(c.get(deps)).toBeNull();
111
- });
112
- });
113
- });
@@ -1,50 +0,0 @@
1
- import { defaultTo } from 'vest-utils';
2
-
3
- describe('defaultTo', () => {
4
- describe('When value is a function', () => {
5
- it('Should call the function', () => {
6
- const value = jest.fn(() => 'return value');
7
-
8
- expect(defaultTo(value, 'fallback value')).toBe('return value');
9
- expect(value).toHaveBeenCalled();
10
- });
11
- describe('When value is nullish', () => {
12
- it('Should return fallback value', () => {
13
- expect(defaultTo(null, 'fallback value')).toBe('fallback value');
14
- expect(defaultTo(undefined, 'fallback value')).toBe('fallback value');
15
- });
16
- });
17
-
18
- describe('When value is not nullish', () => {
19
- it('Should use value', () => {
20
- expect(defaultTo('value', 'fallback value')).toBe('value');
21
- });
22
- });
23
- });
24
-
25
- describe('When value is not a function', () => {
26
- describe('When the value is nullish', () => {
27
- it('Should return fallback value', () => {
28
- expect(defaultTo(null, 'fallback value')).toBe('fallback value');
29
- expect(defaultTo(undefined, 'fallback value')).toBe('fallback value');
30
- });
31
- });
32
- describe('When the value is not nullish', () => {
33
- it.each([0, false, true, 1, [], {}, NaN])(
34
- 'Should return the same value',
35
- value => {
36
- expect(defaultTo(value, 'fallback value')).toBe(value);
37
- }
38
- );
39
- });
40
- });
41
-
42
- describe('When the fallback value is a function', () => {
43
- it('Should call the function and return its return value', () => {
44
- const fallbackValue = jest.fn(() => 'fallback value');
45
-
46
- expect(defaultTo(null, fallbackValue)).toBe('fallback value');
47
- expect(fallbackValue).toHaveBeenCalled();
48
- });
49
- });
50
- });
@@ -1,24 +0,0 @@
1
- import { deferThrow } from 'vest-utils';
2
-
3
- // @ts-ignore
4
- const _to = global.setTimeout;
5
- describe('deferThrow', () => {
6
- beforeEach(() => {
7
- // @ts-ignore
8
- global.setTimeout = jest.fn();
9
- });
10
-
11
- afterEach(() => {
12
- global.setTimeout = _to;
13
- });
14
- it('Should start a timer', () => {
15
- deferThrow();
16
- expect(global.setTimeout).toHaveBeenCalled();
17
- });
18
-
19
- it('Should throw a timed out error with the provided message', () => {
20
- deferThrow('message');
21
- const timeoutCB = global.setTimeout.mock.calls[0][0];
22
- expect(() => timeoutCB()).toThrow('message');
23
- });
24
- });
@@ -1,59 +0,0 @@
1
- import { random, datatype } from 'faker';
2
-
3
- import { greaterThan } from 'greaterThan';
4
-
5
- describe('Tests greaterThan rule', () => {
6
- let arg0;
7
-
8
- describe('Arguments are numbers', () => {
9
- beforeEach(() => {
10
- arg0 = datatype.number();
11
- });
12
-
13
- describe('When first argument is larger', () => {
14
- it('Should return true', () => {
15
- expect(greaterThan(arg0, arg0 - 1)).toBe(true);
16
- });
17
- });
18
-
19
- describe('When first argument is smaller', () => {
20
- it('Should return true', () => {
21
- expect(greaterThan(arg0, arg0 + 1)).toBe(false);
22
- });
23
- });
24
-
25
- describe('When values are equal', () => {
26
- it('Should return false', () => {
27
- expect(greaterThan(arg0, arg0)).toBe(false);
28
- });
29
- });
30
- });
31
-
32
- describe('Arguments are numeric strings', () => {
33
- describe('When first argument is larger', () => {
34
- it('Should return true', () => {
35
- expect(greaterThan(`${arg0}`, `${arg0 - 1}`)).toBe(true);
36
- });
37
- });
38
-
39
- describe('When first argument is smaller', () => {
40
- it('Should return true', () => {
41
- expect(greaterThan(`${arg0}`, `${arg0 + 1}`)).toBe(false);
42
- });
43
- });
44
-
45
- describe('When values are equal', () => {
46
- it('Should return false', () => {
47
- expect(greaterThan(arg0, arg0)).toBe(false);
48
- });
49
- });
50
- });
51
-
52
- describe('Arguments are non numeric', () => {
53
- [random.word(), `${datatype.number()}`.split(''), {}].forEach(element => {
54
- it('Should return false', () => {
55
- expect(greaterThan(element, 0)).toBe(false);
56
- });
57
- });
58
- });
59
- });
@@ -1,45 +0,0 @@
1
- import { invariant } from 'vest-utils';
2
-
3
- describe('invariant', () => {
4
- it('should throw an error when condition is false', () => {
5
- expect(() => {
6
- invariant(false, 'message');
7
- }).toThrow(Error);
8
- });
9
-
10
- it("Should throw an error with the message if it's a string", () => {
11
- expect(() => {
12
- invariant(false, 'message');
13
- }).toThrow('message');
14
- });
15
-
16
- it('should contintue when condition is true', () => {
17
- expect(() => {
18
- invariant(true, 'message');
19
- }).not.toThrow();
20
- });
21
-
22
- describe('When passed message is a string object', () => {
23
- it('should throw the value of the string object', () => {
24
- expect(() => {
25
- invariant(false, new String('message'));
26
- }).toThrow('message');
27
- });
28
- });
29
-
30
- describe('Shen passed message is a function', () => {
31
- it('should throw the value of the function', () => {
32
- expect(() => {
33
- invariant(false, () => 'message');
34
- }).toThrow('message');
35
- });
36
- });
37
-
38
- describe('When message is falsy', () => {
39
- it('should throw an error with the message', () => {
40
- expect(() => {
41
- invariant(false, '');
42
- }).toThrow('');
43
- });
44
- });
45
- });
@@ -1,15 +0,0 @@
1
- import { isArray } from 'isArrayValue';
2
-
3
- describe('Tests isArray rule', () => {
4
- it('Should return true for an empty array', () => {
5
- expect(isArray([])).toBe(true);
6
- });
7
-
8
- it('Should return true for an array with elements', () => {
9
- expect(isArray([1, 2, 3])).toBe(true);
10
- });
11
-
12
- it('Should return false a string', () => {
13
- expect(isArray('1')).toBe(false);
14
- });
15
- });
@@ -1,25 +0,0 @@
1
- import { isNull } from 'isNull';
2
-
3
- describe('Tests isNull rule', () => {
4
- it('Should return true for `null` value', () => {
5
- expect(isNull(null)).toBe(true);
6
- });
7
-
8
- it.each([
9
- undefined,
10
- NaN,
11
- false,
12
- true,
13
- Object,
14
- Array(0),
15
- '',
16
- ' ',
17
- 0,
18
- 1,
19
- '0',
20
- '1',
21
- Function.prototype,
22
- ])('Should return false for %s value', v => {
23
- expect(isNull(v)).toBe(false);
24
- });
25
- });
@@ -1,26 +0,0 @@
1
- import { isNumeric } from 'isNumeric';
2
-
3
- const NUMERICS = ['-10', '0', 0xff, '0xFF', '8e5', '3.1415', +10, '0144'];
4
-
5
- const NON_NUMERICS = [
6
- '-0x42',
7
- '7.2acdgs',
8
- '',
9
- {},
10
- NaN,
11
- null,
12
- true,
13
- Infinity,
14
- undefined,
15
- ];
16
-
17
- describe('Tests isNumeric rule', () => {
18
- it('Should return true for numeric values', () => {
19
- NUMERICS.forEach(value => expect(isNumeric(value)).toBe(true));
20
- });
21
-
22
- it('Should return false for non numeric values', () => {
23
- // @ts-expect-error - testing bad usage
24
- NON_NUMERICS.forEach(value => expect(isNumeric(value)).toBe(false));
25
- });
26
- });
@@ -1,26 +0,0 @@
1
- import { isUndefined } from 'isUndefined';
2
-
3
- describe('Tests isUndefined rule', () => {
4
- it('Should return true for `undefined` value', () => {
5
- expect(isUndefined(undefined)).toBe(true);
6
- expect(isUndefined()).toBe(true);
7
- });
8
-
9
- it.each([
10
- null,
11
- NaN,
12
- false,
13
- true,
14
- Object,
15
- Array(0),
16
- '',
17
- ' ',
18
- 0,
19
- 1,
20
- '0',
21
- '1',
22
- () => undefined,
23
- ])('Should return false for %s value', v => {
24
- expect(isUndefined(v)).toBe(false);
25
- });
26
- });
@@ -1,56 +0,0 @@
1
- import faker from 'faker';
2
-
3
- import { lengthEquals } from 'lengthEquals';
4
-
5
- describe('Tests lengthEquals rule', () => {
6
- const length = faker.datatype.number();
7
- const word = faker.random.word();
8
- const boolean = faker.datatype.boolean();
9
-
10
- describe('First argument is array or string', () => {
11
- describe('When first argument is equal to a given value', () => {
12
- it('Should return true for an array equal to length', () => {
13
- expect(lengthEquals(new Array(length), length)).toBe(true);
14
- });
15
-
16
- it('Should return true for a string equal to word length', () => {
17
- expect(lengthEquals(word, word.length)).toBe(true);
18
- });
19
- });
20
-
21
- describe('When first argument is shorter', () => {
22
- it('Should return false for an array shorter than length', () => {
23
- expect(lengthEquals(new Array(length), length + 1)).toBe(false);
24
- });
25
-
26
- it('Should return false for a string shorter than word length', () => {
27
- expect(lengthEquals(word, word.length + 1)).toBe(false);
28
- });
29
- });
30
-
31
- describe('When first argument is longer', () => {
32
- it('Should return false for an array longer than length', () => {
33
- expect(lengthEquals(new Array(length), length - 1)).toBe(false);
34
- });
35
-
36
- it('Should return false for a string longer than word length', () => {
37
- expect(lengthEquals(word, word.length - 1)).toBe(false);
38
- });
39
- });
40
- });
41
-
42
- describe("First argument isn't array or string", () => {
43
- it('Should throw error', () => {
44
- // @ts-expect-error - testing wrong input
45
- expect(() => lengthEquals(undefined, 0)).toThrow(TypeError);
46
- });
47
-
48
- it('Should return false for number argument', () => {
49
- expect(lengthEquals(length, 0)).toBe(false);
50
- });
51
-
52
- it('Should return false for boolean argument', () => {
53
- expect(lengthEquals(boolean, 0)).toBe(false);
54
- });
55
- });
56
- });
@@ -1,56 +0,0 @@
1
- import faker from 'faker';
2
-
3
- import { longerThan } from 'longerThan';
4
-
5
- describe('Tests longerThan rule', () => {
6
- const length = faker.datatype.number();
7
- const word = faker.random.word();
8
- const boolean = faker.datatype.boolean();
9
-
10
- describe('First argument is array or string', () => {
11
- describe('When first argument is longer', () => {
12
- it('Should return true for an array longer than length', () => {
13
- expect(longerThan(new Array(length), length - 1)).toBe(true);
14
- });
15
-
16
- it('Should return true for a string longer than word length', () => {
17
- expect(longerThan(word, word.length - 1)).toBe(true);
18
- });
19
- });
20
-
21
- describe('When first argument is shorter', () => {
22
- it('Should return false for an array shorter than length', () => {
23
- expect(longerThan(new Array(length), length + 1)).toBe(false);
24
- });
25
-
26
- it('Should return false for a string shorter than word length', () => {
27
- expect(longerThan(word, word.length + 1)).toBe(false);
28
- });
29
- });
30
-
31
- describe('When first argument is equal to a given value', () => {
32
- it('Should return false for an array equal to length', () => {
33
- expect(longerThan(new Array(length), length)).toBe(false);
34
- });
35
-
36
- it('Should return false for a string equal to word length', () => {
37
- expect(longerThan(word, word.length)).toBe(false);
38
- });
39
- });
40
- });
41
-
42
- describe("First argument isn't array or string", () => {
43
- it('Should throw error', () => {
44
- // @ts-expect-error - testing wrong input
45
- expect(() => longerThan(undefined, 0)).toThrow(TypeError);
46
- });
47
-
48
- it('Should return false for number argument', () => {
49
- expect(longerThan(length, 0)).toBe(false);
50
- });
51
-
52
- it('Should return false for boolean argument', () => {
53
- expect(longerThan(boolean, 0)).toBe(false);
54
- });
55
- });
56
- });
@@ -1,29 +0,0 @@
1
- import { mapFirst } from 'vest-utils';
2
-
3
- describe('mapFirst', () => {
4
- it('should return the broken out result', () => {
5
- const result = mapFirst([1, 2, 3], (value, breakout) => {
6
- breakout(value === 3, { pass: true });
7
- });
8
-
9
- expect(result).toEqual({ pass: true });
10
- });
11
-
12
- it('Should respect the breakout conditional', () => {
13
- const result = mapFirst([1, 2, 3], (_, breakout) => {
14
- breakout(false, 0);
15
- breakout(false, 0);
16
- breakout(true, 1);
17
- });
18
-
19
- expect(result).toBe(1);
20
- });
21
-
22
- describe('When not broken out', () => {
23
- it('Should return undefined', () => {
24
- const result = mapFirst([1, 2, 3], () => {});
25
-
26
- expect(result).toBeUndefined();
27
- });
28
- });
29
- });
@@ -1,59 +0,0 @@
1
- import { random, datatype } from 'faker';
2
-
3
- import { numberEquals } from 'numberEquals';
4
-
5
- describe('Tests numberEquals rule', () => {
6
- let arg0;
7
-
8
- describe('Arguments are numbers', () => {
9
- beforeEach(() => {
10
- arg0 = datatype.number();
11
- });
12
-
13
- describe('When first argument is larger', () => {
14
- it('Should return false', () => {
15
- expect(numberEquals(arg0, arg0 - 1)).toBe(false);
16
- });
17
- });
18
-
19
- describe('When first argument is smaller', () => {
20
- it('Should return false', () => {
21
- expect(numberEquals(arg0, arg0 + 1)).toBe(false);
22
- });
23
- });
24
-
25
- describe('When values are equal', () => {
26
- it('Should return true', () => {
27
- expect(numberEquals(arg0, arg0)).toBe(true);
28
- });
29
- });
30
- });
31
-
32
- describe('Arguments are numeric strings', () => {
33
- describe('When first argument is larger', () => {
34
- it('Should return false', () => {
35
- expect(numberEquals(`${arg0}`, `${arg0 - 1}`)).toBe(false);
36
- });
37
- });
38
-
39
- describe('When first argument is smaller', () => {
40
- it('Should return false', () => {
41
- expect(numberEquals(`${arg0}`, `${arg0 + 1}`)).toBe(false);
42
- });
43
- });
44
-
45
- describe('When values are equal', () => {
46
- it('Should return true', () => {
47
- expect(numberEquals(arg0, arg0)).toBe(true);
48
- });
49
- });
50
- });
51
-
52
- describe('Arguments are non numeric', () => {
53
- [random.word(), `${datatype.number()}`.split(''), {}].forEach(element => {
54
- it('Should return false', () => {
55
- expect(numberEquals(element, 0)).toBe(false);
56
- });
57
- });
58
- });
59
- });
@@ -1,27 +0,0 @@
1
- import { optionalFunctionValue } from 'vest-utils';
2
-
3
- describe('optionalFunctionValue', () => {
4
- describe('When not a function', () => {
5
- it.each([0, undefined, false, true, 1, [], {}, null, NaN])(
6
- 'Should return the same value',
7
- value => {
8
- expect(optionalFunctionValue(value)).toBe(value);
9
- }
10
- );
11
- });
12
-
13
- describe('When value is a function', () => {
14
- it('Should call the function and return its return value', () => {
15
- const value = jest.fn(() => 'return value');
16
-
17
- expect(optionalFunctionValue(value)).toBe('return value');
18
- expect(value).toHaveBeenCalled();
19
- });
20
- it('Should run with arguments arry', () => {
21
- const value = jest.fn((...args) => args.join('|'));
22
- const args = [1, 2, 3, 4];
23
- expect(optionalFunctionValue(value, ...args)).toBe('1|2|3|4');
24
- expect(value).toHaveBeenCalledWith(...args);
25
- });
26
- });
27
- });
@@ -1,28 +0,0 @@
1
- import seq, { genSeq } from 'seq';
2
-
3
- describe('lib:seq', () => {
4
- it('Should return a new id on each run', () => {
5
- Array.from({ length: 100 }, () => seq()).reduce((existing, seq) => {
6
- expect(existing).not.toHaveProperty(seq.toString());
7
- Object.assign(existing, { [seq]: true });
8
- expect(existing).toHaveProperty(seq.toString());
9
- return existing;
10
- }, {});
11
- });
12
-
13
- describe('genSeq', () => {
14
- it('Creates a namespaced sequence', () => {
15
- const seq = genSeq('test');
16
- expect(seq()).toBe('test_0');
17
- expect(seq()).toBe('test_1');
18
- expect(seq()).toBe('test_2');
19
-
20
- const seq2 = genSeq('test2');
21
- expect(seq2()).toBe('test2_0');
22
- expect(seq2()).toBe('test2_1');
23
- expect(seq2()).toBe('test2_2');
24
-
25
- expect(seq()).toBe('test_3');
26
- });
27
- });
28
- });
package/src/asArray.ts DELETED
@@ -1,3 +0,0 @@
1
- export default function asArray<T>(possibleArg: T | T[]): T[] {
2
- return ([] as T[]).concat(possibleArg);
3
- }
package/src/assign.ts DELETED
@@ -1 +0,0 @@
1
- export default Object.assign;
package/src/bindNot.ts DELETED
@@ -1,3 +0,0 @@
1
- export default function bindNot<T extends (...args: any[]) => unknown>(fn: T) {
2
- return (...args: Parameters<T>): boolean => !fn(...args);
3
- }