vest-utils 0.0.1-rc → 0.0.2-dev-9b46fb
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.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/cjs/vest-utils.development.js +340 -0
- package/dist/cjs/vest-utils.production.js +1 -1
- package/dist/es/vest-utils.development.js +298 -0
- package/dist/es/vest-utils.production.js +1 -1
- package/dist/umd/vest-utils.development.js +344 -4
- package/dist/umd/vest-utils.production.js +1 -1
- package/package.json +4 -662
- package/src/{exports/__tests__ → __tests__}/bindNot.test.ts +1 -1
- package/src/{exports/__tests__ → __tests__}/bus.test.ts +0 -0
- package/src/{exports/__tests__ → __tests__}/cache.test.ts +1 -1
- package/src/{exports/__tests__ → __tests__}/defaultTo.test.ts +1 -1
- package/src/{exports/__tests__/throwError.test.ts → __tests__/deferThrow.test.ts} +1 -1
- package/src/__tests__/greaterThan.test.ts +59 -0
- package/src/{exports/__tests__ → __tests__}/invariant.test.ts +1 -1
- package/src/__tests__/isArray.test.ts +15 -0
- package/src/__tests__/isNull.test.ts +25 -0
- package/src/__tests__/isNumeric.test.ts +26 -0
- package/src/__tests__/isUndefined.test.ts +26 -0
- package/src/__tests__/lengthEquals.test.ts +56 -0
- package/src/__tests__/longerThan.test.ts +56 -0
- package/src/{exports/__tests__ → __tests__}/mapFirst.test.ts +1 -1
- package/src/__tests__/numberEquals.test.ts +59 -0
- package/src/{exports/__tests__ → __tests__}/optionalFunctionValue.test.ts +1 -1
- package/src/__tests__/seq.test.ts +12 -0
- package/src/{exports/asArray.ts → asArray.ts} +0 -0
- package/src/{exports/assign.ts → assign.ts} +0 -0
- package/src/{exports/bindNot.ts → bindNot.ts} +0 -0
- package/src/{exports/bus.ts → bus.ts} +0 -0
- package/src/{exports/cache.ts → cache.ts} +0 -0
- package/src/callEach.ts +5 -0
- package/src/{exports/defaultTo.ts → defaultTo.ts} +0 -0
- package/src/{exports/throwError.ts → deferThrow.ts} +1 -1
- package/src/{exports/either.ts → either.ts} +0 -0
- package/src/globals.d.ts +3 -3
- package/src/greaterThan.ts +8 -0
- package/src/{exports/hasOwnProperty.ts → hasOwnProperty.ts} +0 -0
- package/src/{exports/invariant.ts → invariant.ts} +0 -0
- package/src/isArrayValue.ts +11 -0
- package/src/isBooleanValue.ts +3 -0
- package/src/isEmpty.ts +17 -0
- package/src/{exports/isFunction.ts → isFunction.ts} +0 -0
- package/src/isNull.ts +7 -0
- package/src/{exports/isNullish.ts → isNullish.ts} +1 -2
- package/src/isNumeric.ts +11 -0
- package/src/isPositive.ts +5 -0
- package/src/{exports/isPromise.ts → isPromise.ts} +0 -0
- package/src/isStringValue.ts +3 -0
- package/src/isUndefined.ts +7 -0
- package/src/{exports/last.ts → last.ts} +0 -0
- package/src/lengthEquals.ts +11 -0
- package/src/longerThan.ts +8 -0
- package/src/{exports/mapFirst.ts → mapFirst.ts} +0 -0
- package/src/{exports/nestedArray.ts → nestedArray.ts} +2 -3
- package/src/numberEquals.ts +11 -0
- package/src/{exports/optionalFunctionValue.ts → optionalFunctionValue.ts} +1 -1
- package/src/{exports/genId.ts → seq.ts} +2 -2
- package/src/utilityTypes.ts +1 -1
- package/src/vest-utils.ts +31 -0
- package/tsconfig.json +3 -1
- package/types/vest-utils.d.ts +92 -1
- package/asArray/package.json +0 -9
- package/assign/package.json +0 -9
- package/bindNot/package.json +0 -9
- package/bus/package.json +0 -9
- package/cache/package.json +0 -9
- package/callEach/package.json +0 -9
- package/defaultTo/package.json +0 -9
- package/dist/cjs/asArray.development.js +0 -7
- package/dist/cjs/asArray.js +0 -7
- package/dist/cjs/asArray.production.js +0 -1
- package/dist/cjs/assign.development.js +0 -5
- package/dist/cjs/assign.js +0 -7
- package/dist/cjs/assign.production.js +0 -1
- package/dist/cjs/bindNot.development.js +0 -13
- package/dist/cjs/bindNot.js +0 -7
- package/dist/cjs/bindNot.production.js +0 -1
- package/dist/cjs/bus.development.js +0 -27
- package/dist/cjs/bus.js +0 -7
- package/dist/cjs/bus.production.js +0 -1
- package/dist/cjs/cache.development.js +0 -72
- package/dist/cjs/cache.js +0 -7
- package/dist/cjs/cache.production.js +0 -1
- package/dist/cjs/callEach.development.js +0 -7
- package/dist/cjs/callEach.js +0 -7
- package/dist/cjs/callEach.production.js +0 -1
- package/dist/cjs/defaultTo.development.js +0 -20
- package/dist/cjs/defaultTo.js +0 -7
- package/dist/cjs/defaultTo.production.js +0 -1
- package/dist/cjs/either.development.js +0 -7
- package/dist/cjs/either.js +0 -7
- package/dist/cjs/either.production.js +0 -1
- package/dist/cjs/genId.development.js +0 -10
- package/dist/cjs/genId.js +0 -7
- package/dist/cjs/genId.production.js +0 -1
- package/dist/cjs/hasOwnProperty.development.js +0 -10
- package/dist/cjs/hasOwnProperty.js +0 -7
- package/dist/cjs/hasOwnProperty.production.js +0 -1
- package/dist/cjs/invariant.development.js +0 -36
- package/dist/cjs/invariant.js +0 -7
- package/dist/cjs/invariant.production.js +0 -1
- package/dist/cjs/isBooleanValue.development.js +0 -9
- package/dist/cjs/isBooleanValue.js +0 -7
- package/dist/cjs/isBooleanValue.production.js +0 -1
- package/dist/cjs/isFunction.development.js +0 -7
- package/dist/cjs/isFunction.js +0 -7
- package/dist/cjs/isFunction.production.js +0 -1
- package/dist/cjs/isNullish.development.js +0 -37
- package/dist/cjs/isNullish.js +0 -7
- package/dist/cjs/isNullish.production.js +0 -1
- package/dist/cjs/isPromise.development.js +0 -11
- package/dist/cjs/isPromise.js +0 -7
- package/dist/cjs/isPromise.production.js +0 -1
- package/dist/cjs/isStringValue.development.js +0 -9
- package/dist/cjs/isStringValue.js +0 -7
- package/dist/cjs/isStringValue.production.js +0 -1
- package/dist/cjs/last.development.js +0 -12
- package/dist/cjs/last.js +0 -7
- package/dist/cjs/last.production.js +0 -1
- package/dist/cjs/mapFirst.development.js +0 -20
- package/dist/cjs/mapFirst.js +0 -7
- package/dist/cjs/mapFirst.production.js +0 -1
- package/dist/cjs/nestedArray.development.js +0 -99
- package/dist/cjs/nestedArray.js +0 -7
- package/dist/cjs/nestedArray.production.js +0 -1
- package/dist/cjs/optionalFunctionValue.development.js +0 -15
- package/dist/cjs/optionalFunctionValue.js +0 -7
- package/dist/cjs/optionalFunctionValue.production.js +0 -1
- package/dist/cjs/partition.development.js +0 -10
- package/dist/cjs/partition.js +0 -7
- package/dist/cjs/partition.production.js +0 -1
- package/dist/cjs/throwError.development.js +0 -11
- package/dist/cjs/throwError.js +0 -7
- package/dist/cjs/throwError.production.js +0 -1
- package/dist/es/asArray.development.js +0 -5
- package/dist/es/asArray.production.js +0 -1
- package/dist/es/assign.development.js +0 -3
- package/dist/es/assign.production.js +0 -1
- package/dist/es/bindNot.development.js +0 -11
- package/dist/es/bindNot.production.js +0 -1
- package/dist/es/bus.development.js +0 -23
- package/dist/es/bus.production.js +0 -1
- package/dist/es/cache.development.js +0 -66
- package/dist/es/cache.production.js +0 -1
- package/dist/es/callEach.development.js +0 -5
- package/dist/es/callEach.production.js +0 -1
- package/dist/es/defaultTo.development.js +0 -18
- package/dist/es/defaultTo.production.js +0 -1
- package/dist/es/either.development.js +0 -5
- package/dist/es/either.production.js +0 -1
- package/dist/es/genId.development.js +0 -8
- package/dist/es/genId.production.js +0 -1
- package/dist/es/hasOwnProperty.development.js +0 -8
- package/dist/es/hasOwnProperty.production.js +0 -1
- package/dist/es/invariant.development.js +0 -32
- package/dist/es/invariant.production.js +0 -1
- package/dist/es/isBooleanValue.development.js +0 -5
- package/dist/es/isBooleanValue.production.js +0 -1
- package/dist/es/isFunction.development.js +0 -5
- package/dist/es/isFunction.production.js +0 -1
- package/dist/es/isNullish.development.js +0 -28
- package/dist/es/isNullish.production.js +0 -1
- package/dist/es/isPromise.development.js +0 -9
- package/dist/es/isPromise.production.js +0 -1
- package/dist/es/isStringValue.development.js +0 -5
- package/dist/es/isStringValue.production.js +0 -1
- package/dist/es/last.development.js +0 -10
- package/dist/es/last.production.js +0 -1
- package/dist/es/mapFirst.development.js +0 -18
- package/dist/es/mapFirst.production.js +0 -1
- package/dist/es/nestedArray.development.js +0 -87
- package/dist/es/nestedArray.production.js +0 -1
- package/dist/es/optionalFunctionValue.development.js +0 -13
- package/dist/es/optionalFunctionValue.production.js +0 -1
- package/dist/es/partition.development.js +0 -8
- package/dist/es/partition.production.js +0 -1
- package/dist/es/throwError.development.js +0 -7
- package/dist/es/throwError.production.js +0 -1
- package/dist/umd/asArray.development.js +0 -13
- package/dist/umd/asArray.production.js +0 -1
- package/dist/umd/assign.development.js +0 -11
- package/dist/umd/assign.production.js +0 -1
- package/dist/umd/bindNot.development.js +0 -19
- package/dist/umd/bindNot.production.js +0 -1
- package/dist/umd/bus.development.js +0 -33
- package/dist/umd/bus.production.js +0 -1
- package/dist/umd/cache.development.js +0 -76
- package/dist/umd/cache.production.js +0 -1
- package/dist/umd/callEach.development.js +0 -13
- package/dist/umd/callEach.production.js +0 -1
- package/dist/umd/defaultTo.development.js +0 -26
- package/dist/umd/defaultTo.production.js +0 -1
- package/dist/umd/either.development.js +0 -13
- package/dist/umd/either.production.js +0 -1
- package/dist/umd/genId.development.js +0 -16
- package/dist/umd/genId.production.js +0 -1
- package/dist/umd/hasOwnProperty.development.js +0 -16
- package/dist/umd/hasOwnProperty.production.js +0 -1
- package/dist/umd/invariant.development.js +0 -42
- package/dist/umd/invariant.production.js +0 -1
- package/dist/umd/isBooleanValue.development.js +0 -15
- package/dist/umd/isBooleanValue.production.js +0 -1
- package/dist/umd/isFunction.development.js +0 -13
- package/dist/umd/isFunction.production.js +0 -1
- package/dist/umd/isNullish.development.js +0 -41
- package/dist/umd/isNullish.production.js +0 -1
- package/dist/umd/isPromise.development.js +0 -17
- package/dist/umd/isPromise.production.js +0 -1
- package/dist/umd/isStringValue.development.js +0 -15
- package/dist/umd/isStringValue.production.js +0 -1
- package/dist/umd/last.development.js +0 -18
- package/dist/umd/last.production.js +0 -1
- package/dist/umd/mapFirst.development.js +0 -26
- package/dist/umd/mapFirst.production.js +0 -1
- package/dist/umd/nestedArray.development.js +0 -103
- package/dist/umd/nestedArray.production.js +0 -1
- package/dist/umd/optionalFunctionValue.development.js +0 -21
- package/dist/umd/optionalFunctionValue.production.js +0 -1
- package/dist/umd/partition.development.js +0 -16
- package/dist/umd/partition.production.js +0 -1
- package/dist/umd/throwError.development.js +0 -17
- package/dist/umd/throwError.production.js +0 -1
- package/either/package.json +0 -9
- package/genId/package.json +0 -9
- package/hasOwnProperty/package.json +0 -9
- package/invariant/package.json +0 -9
- package/isBooleanValue/package.json +0 -9
- package/isFunction/package.json +0 -9
- package/isNullish/package.json +0 -9
- package/isPromise/package.json +0 -9
- package/isStringValue/package.json +0 -9
- package/last/package.json +0 -9
- package/mapFirst/package.json +0 -9
- package/nestedArray/package.json +0 -9
- package/optionalFunctionValue/package.json +0 -9
- package/partition/package.json +0 -9
- package/src/exports/__tests__/genId.test.ts +0 -12
- package/src/exports/__tests__/partition.test.ts +0 -21
- package/src/exports/callEach.ts +0 -3
- package/src/exports/isBooleanValue.ts +0 -3
- package/src/exports/isStringValue.ts +0 -3
- package/src/exports/partition.ts +0 -12
- package/throwError/package.json +0 -9
- package/types/asArray.d.ts +0 -2
- package/types/assign.d.ts +0 -7
- package/types/bindNot.d.ts +0 -2
- package/types/bus.d.ts +0 -9
- package/types/cache.d.ts +0 -9
- package/types/callEach.d.ts +0 -2
- package/types/defaultTo.d.ts +0 -2
- package/types/either.d.ts +0 -2
- package/types/genId.d.ts +0 -5
- package/types/hasOwnProperty.d.ts +0 -5
- package/types/invariant.d.ts +0 -4
- package/types/isBooleanValue.d.ts +0 -2
- package/types/isFunction.d.ts +0 -2
- package/types/isNullish.d.ts +0 -3
- package/types/isPromise.d.ts +0 -2
- package/types/isStringValue.d.ts +0 -2
- package/types/last.d.ts +0 -2
- package/types/mapFirst.d.ts +0 -2
- package/types/nestedArray.d.ts +0 -7
- package/types/optionalFunctionValue.d.ts +0 -2
- package/types/partition.d.ts +0 -5
- package/types/throwError.d.ts +0 -2
- package/types/utilityTypes.d.ts +0 -8
- package/types/vest-utilities.d.ts +0 -1
- package/utilityTypes/package.json +0 -9
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).isStringValue={})}(this,(function(e){e.isStringValue=function(e){return String(e)===e},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.last = factory());
|
|
5
|
-
}(this, (function () { 'use strict';
|
|
6
|
-
|
|
7
|
-
function asArray(possibleArg) {
|
|
8
|
-
return [].concat(possibleArg);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function last(values) {
|
|
12
|
-
var valuesArray = asArray(values);
|
|
13
|
-
return valuesArray[valuesArray.length - 1];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return last;
|
|
17
|
-
|
|
18
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(n){return(n=[].concat(n))[n.length-1]}:"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).last=function(n){return(n=[].concat(n))[n.length-1]}}(this,(function(){return function(n){return(n=[].concat(n))[n.length-1]}}));
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.mapFirst = factory());
|
|
5
|
-
}(this, (function () { 'use strict';
|
|
6
|
-
|
|
7
|
-
function mapFirst(array, callback) {
|
|
8
|
-
var broke = false;
|
|
9
|
-
var breakoutValue = null;
|
|
10
|
-
for (var i = 0; i < array.length; i++) {
|
|
11
|
-
callback(array[i], breakout, i);
|
|
12
|
-
if (broke) {
|
|
13
|
-
return breakoutValue;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function breakout(conditional, value) {
|
|
17
|
-
if (conditional) {
|
|
18
|
-
broke = true;
|
|
19
|
-
breakoutValue = value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return mapFirst;
|
|
25
|
-
|
|
26
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(n,e){function t(n,e){n&&(f=!0,o=e)}for(var f=!1,o=null,i=0;i<n.length;i++)if(e(n[i],t,i),f)return o}:"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).mapFirst=function(n,e){function t(n,e){n&&(f=!0,o=e)}for(var f=!1,o=null,i=0;i<n.length;i++)if(e(n[i],t,i),f)return o}}(this,(function(){return function(n,e){function t(n,e){n&&(f=!0,o=e)}for(var f=!1,o=null,i=0;i<n.length;i++)if(e(n[i],t,i),f)return o}}));
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vest-utils/bindNot')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vest-utils/bindNot'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.nestedArray = {}, global.bindNot));
|
|
5
|
-
}(this, (function (exports, bindNot) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var bindNot__default = /*#__PURE__*/_interopDefaultLegacy(bindNot);
|
|
10
|
-
|
|
11
|
-
// The module is named "isArrayValue" since it
|
|
12
|
-
// is conflicting with a nested npm dependency.
|
|
13
|
-
// We may need to revisit this in the future.
|
|
14
|
-
function isArray(value) {
|
|
15
|
-
return Boolean(Array.isArray(value));
|
|
16
|
-
}
|
|
17
|
-
bindNot__default['default'](isArray);
|
|
18
|
-
|
|
19
|
-
function isNull(value) {
|
|
20
|
-
return value === null;
|
|
21
|
-
}
|
|
22
|
-
var isNotNull = bindNot__default['default'](isNull);
|
|
23
|
-
|
|
24
|
-
function asArray(possibleArg) {
|
|
25
|
-
return [].concat(possibleArg);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function isFunction(value) {
|
|
29
|
-
return typeof value === 'function';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function optionalFunctionValue(value) {
|
|
33
|
-
var args = [];
|
|
34
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
35
|
-
args[_i - 1] = arguments[_i];
|
|
36
|
-
}
|
|
37
|
-
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function defaultTo(value, defaultValue) {
|
|
41
|
-
var _a;
|
|
42
|
-
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function last(values) {
|
|
46
|
-
var valuesArray = asArray(values);
|
|
47
|
-
return valuesArray[valuesArray.length - 1];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// This is kind of a map/filter in one function.
|
|
51
|
-
// Normally, behaves like a nested-array map,
|
|
52
|
-
// but returning `null` will drop the element from the array
|
|
53
|
-
function transform(array, cb) {
|
|
54
|
-
var res = [];
|
|
55
|
-
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
|
|
56
|
-
var v = array_1[_i];
|
|
57
|
-
if (isArray(v)) {
|
|
58
|
-
res.push(transform(v, cb));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
var output = cb(v);
|
|
62
|
-
if (isNotNull(output)) {
|
|
63
|
-
res.push(output);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return res;
|
|
68
|
-
}
|
|
69
|
-
function valueAtPath(array, path) {
|
|
70
|
-
return getCurrent(array, path)[last(path)];
|
|
71
|
-
}
|
|
72
|
-
function setValueAtPath(array, path, value) {
|
|
73
|
-
var current = getCurrent(array, path);
|
|
74
|
-
current[last(path)] = value;
|
|
75
|
-
return array;
|
|
76
|
-
}
|
|
77
|
-
function flatten(values) {
|
|
78
|
-
return asArray(values).reduce(function (acc, value) {
|
|
79
|
-
if (isArray(value)) {
|
|
80
|
-
return acc.concat(flatten(value));
|
|
81
|
-
}
|
|
82
|
-
return asArray(acc).concat(value);
|
|
83
|
-
}, []);
|
|
84
|
-
}
|
|
85
|
-
function getCurrent(array, path) {
|
|
86
|
-
var current = array;
|
|
87
|
-
for (var _i = 0, _a = path.slice(0, -1); _i < _a.length; _i++) {
|
|
88
|
-
var p = _a[_i];
|
|
89
|
-
current[p] = defaultTo(current[p], []);
|
|
90
|
-
current = current[p];
|
|
91
|
-
}
|
|
92
|
-
return current;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
exports.flatten = flatten;
|
|
96
|
-
exports.getCurrent = getCurrent;
|
|
97
|
-
exports.setValueAtPath = setValueAtPath;
|
|
98
|
-
exports.transform = transform;
|
|
99
|
-
exports.valueAtPath = valueAtPath;
|
|
100
|
-
|
|
101
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
102
|
-
|
|
103
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vest-utils/bindNot")):"function"==typeof define&&define.amd?define(["exports","vest-utils/bindNot"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).nestedArray={},t.bindNot)}(this,(function(t,n){function e(t){return!!Array.isArray(t)}function r(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return"function"==typeof t?t.apply(void 0,n):t}function u(t){return(t=[].concat(t))[t.length-1]}function o(t,n){var e=0;for(n=n.slice(0,-1);e<n.length;e++){var u,o=n[e],f=t,i=o,c=[];c=null!==(u=r(t[o]))&&void 0!==u?u:r(c),f[i]=c,t=t[o]}return t}(n=n&&"object"==typeof n&&"default"in n?n:{default:n}).default(e);var f=n.default((function(t){return null===t}));t.flatten=function t(n){return[].concat(n).reduce((function(n,r){return e(r)?n.concat(t(r)):[].concat(n).concat(r)}),[])},t.getCurrent=o,t.setValueAtPath=function(t,n,e){return o(t,n)[u(n)]=e,t},t.transform=function t(n,r){for(var u=[],o=0;o<n.length;o++){var i=n[o];e(i)?u.push(t(i,r)):(i=r(i),f(i)&&u.push(i))}return u},t.valueAtPath=function(t,n){return o(t,n)[u(n)]},Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.optionalFunctionValue = factory());
|
|
5
|
-
}(this, (function () { 'use strict';
|
|
6
|
-
|
|
7
|
-
function isFunction(value) {
|
|
8
|
-
return typeof value === 'function';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function optionalFunctionValue(value) {
|
|
12
|
-
var args = [];
|
|
13
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
14
|
-
args[_i - 1] = arguments[_i];
|
|
15
|
-
}
|
|
16
|
-
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return optionalFunctionValue;
|
|
20
|
-
|
|
21
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(n){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];return"function"==typeof n?n.apply(void 0,e):n}:"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).optionalFunctionValue=function(n){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];return"function"==typeof n?n.apply(void 0,e):n}}(this,(function(){return function(n){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];return"function"==typeof n?n.apply(void 0,e):n}}));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.partition = factory());
|
|
5
|
-
}(this, (function () { 'use strict';
|
|
6
|
-
|
|
7
|
-
function partition(array, predicate) {
|
|
8
|
-
return array.reduce(function (partitions, value, number) {
|
|
9
|
-
partitions[predicate(value, number, array) ? 0 : 1].push(value);
|
|
10
|
-
return partitions;
|
|
11
|
-
}, [[], []]);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return partition;
|
|
15
|
-
|
|
16
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=function(e,n){return e.reduce((function(t,u,o){return t[n(u,o,e)?0:1].push(u),t}),[[],[]])}:"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).partition=function(e,n){return e.reduce((function(t,u,o){return t[n(u,o,e)?0:1].push(u),t}),[[],[]])}}(this,(function(){return function(e,n){return e.reduce((function(t,u,o){return t[n(u,o,e)?0:1].push(u),t}),[[],[]])}}));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.throwError = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function deferThrow(message) {
|
|
8
|
-
setTimeout(function () {
|
|
9
|
-
throw new Error(message);
|
|
10
|
-
}, 0);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
exports.deferThrow = deferThrow;
|
|
14
|
-
|
|
15
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
16
|
-
|
|
17
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).throwError={})}(this,(function(e){e.deferThrow=function(e){setTimeout((function(){throw Error(e)}),0)},Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/either/package.json
DELETED
package/genId/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/hasOwnProperty.js",
|
|
3
|
-
"module": "../dist/es/hasOwnProperty.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/hasOwnProperty.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/hasOwnProperty.production.js",
|
|
6
|
-
"name": "hasOwnProperty",
|
|
7
|
-
"types": "../types/hasOwnProperty.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/invariant/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/invariant.js",
|
|
3
|
-
"module": "../dist/es/invariant.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/invariant.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/invariant.production.js",
|
|
6
|
-
"name": "invariant",
|
|
7
|
-
"types": "../types/invariant.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/isBooleanValue.js",
|
|
3
|
-
"module": "../dist/es/isBooleanValue.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/isBooleanValue.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/isBooleanValue.production.js",
|
|
6
|
-
"name": "isBooleanValue",
|
|
7
|
-
"types": "../types/isBooleanValue.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/isFunction/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/isFunction.js",
|
|
3
|
-
"module": "../dist/es/isFunction.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/isFunction.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/isFunction.production.js",
|
|
6
|
-
"name": "isFunction",
|
|
7
|
-
"types": "../types/isFunction.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/isNullish/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/isNullish.js",
|
|
3
|
-
"module": "../dist/es/isNullish.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/isNullish.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/isNullish.production.js",
|
|
6
|
-
"name": "isNullish",
|
|
7
|
-
"types": "../types/isNullish.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/isPromise/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/isPromise.js",
|
|
3
|
-
"module": "../dist/es/isPromise.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/isPromise.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/isPromise.production.js",
|
|
6
|
-
"name": "isPromise",
|
|
7
|
-
"types": "../types/isPromise.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/isStringValue.js",
|
|
3
|
-
"module": "../dist/es/isStringValue.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/isStringValue.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/isStringValue.production.js",
|
|
6
|
-
"name": "isStringValue",
|
|
7
|
-
"types": "../types/isStringValue.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/last/package.json
DELETED
package/mapFirst/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/mapFirst.js",
|
|
3
|
-
"module": "../dist/es/mapFirst.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/mapFirst.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/mapFirst.production.js",
|
|
6
|
-
"name": "mapFirst",
|
|
7
|
-
"types": "../types/mapFirst.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/nestedArray/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/nestedArray.js",
|
|
3
|
-
"module": "../dist/es/nestedArray.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/nestedArray.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/nestedArray.production.js",
|
|
6
|
-
"name": "nestedArray",
|
|
7
|
-
"types": "../types/nestedArray.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/optionalFunctionValue.js",
|
|
3
|
-
"module": "../dist/es/optionalFunctionValue.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/optionalFunctionValue.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/optionalFunctionValue.production.js",
|
|
6
|
-
"name": "optionalFunctionValue",
|
|
7
|
-
"types": "../types/optionalFunctionValue.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/partition/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/partition.js",
|
|
3
|
-
"module": "../dist/es/partition.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/partition.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/partition.production.js",
|
|
6
|
-
"name": "partition",
|
|
7
|
-
"types": "../types/partition.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import id from 'genId';
|
|
2
|
-
|
|
3
|
-
describe('lib:id', () => {
|
|
4
|
-
it('Should return a new id on each run', () => {
|
|
5
|
-
Array.from({ length: 100 }, () => id()).reduce((existing, id) => {
|
|
6
|
-
expect(existing).not.toHaveProperty(id.toString());
|
|
7
|
-
Object.assign(existing, { [id]: true });
|
|
8
|
-
expect(existing).toHaveProperty(id.toString());
|
|
9
|
-
return existing;
|
|
10
|
-
}, {});
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import partition from 'partition';
|
|
2
|
-
|
|
3
|
-
describe('partition', () => {
|
|
4
|
-
it('Should correctly partition array', () => {
|
|
5
|
-
expect(partition([300, 200, 10, 50, 0, -500], v => v <= 100))
|
|
6
|
-
.toMatchInlineSnapshot(`
|
|
7
|
-
Array [
|
|
8
|
-
Array [
|
|
9
|
-
10,
|
|
10
|
-
50,
|
|
11
|
-
0,
|
|
12
|
-
-500,
|
|
13
|
-
],
|
|
14
|
-
Array [
|
|
15
|
-
300,
|
|
16
|
-
200,
|
|
17
|
-
],
|
|
18
|
-
]
|
|
19
|
-
`);
|
|
20
|
-
});
|
|
21
|
-
});
|
package/src/exports/callEach.ts
DELETED
package/src/exports/partition.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default function partition<T>(
|
|
2
|
-
array: T[],
|
|
3
|
-
predicate: (value: T, index: number, array: T[]) => boolean
|
|
4
|
-
): [T[], T[]] {
|
|
5
|
-
return array.reduce(
|
|
6
|
-
(partitions: [T[], T[]], value, number) => {
|
|
7
|
-
partitions[predicate(value, number, array) ? 0 : 1].push(value);
|
|
8
|
-
return partitions;
|
|
9
|
-
},
|
|
10
|
-
[[], []]
|
|
11
|
-
);
|
|
12
|
-
}
|
package/throwError/package.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/throwError.js",
|
|
3
|
-
"module": "../dist/es/throwError.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/throwError.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/throwError.production.js",
|
|
6
|
-
"name": "throwError",
|
|
7
|
-
"types": "../types/throwError.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|
package/types/asArray.d.ts
DELETED
package/types/assign.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
<T extends {}, U>(target: T, source: U): T & U;
|
|
3
|
-
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
4
|
-
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
5
|
-
(target: object, ...sources: any[]): any;
|
|
6
|
-
};
|
|
7
|
-
export { _default as default };
|
package/types/bindNot.d.ts
DELETED
package/types/bus.d.ts
DELETED
package/types/cache.d.ts
DELETED
package/types/callEach.d.ts
DELETED
package/types/defaultTo.d.ts
DELETED
package/types/either.d.ts
DELETED
package/types/genId.d.ts
DELETED
package/types/invariant.d.ts
DELETED
package/types/isFunction.d.ts
DELETED
package/types/isNullish.d.ts
DELETED
package/types/isPromise.d.ts
DELETED
package/types/isStringValue.d.ts
DELETED
package/types/last.d.ts
DELETED
package/types/mapFirst.d.ts
DELETED
package/types/nestedArray.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type NestedArray<T> = Array<NestedArray<T> | T>;
|
|
2
|
-
declare function transform<T>(array: NestedArray<T>, cb: (value: T) => NestedArray<T> | T | null): NestedArray<T>;
|
|
3
|
-
declare function valueAtPath<T>(array: NestedArray<T>, path: number[]): T | NestedArray<T>;
|
|
4
|
-
declare function setValueAtPath<T>(array: NestedArray<T>, path: number[], value: NestedArray<T> | T): NestedArray<T>;
|
|
5
|
-
declare function flatten<T>(values: NestedArray<T> | T): T[];
|
|
6
|
-
declare function getCurrent<T>(array: NestedArray<T>, path: number[]): NestedArray<T>;
|
|
7
|
-
export { NestedArray, transform, valueAtPath, setValueAtPath, flatten, getCurrent };
|
package/types/partition.d.ts
DELETED
package/types/throwError.d.ts
DELETED
package/types/utilityTypes.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type DropFirst<T extends unknown[]> = T extends [
|
|
2
|
-
unknown,
|
|
3
|
-
...infer U
|
|
4
|
-
] ? U : never;
|
|
5
|
-
type Stringable = string | ((...args: any[]) => string);
|
|
6
|
-
type CB = (...args: any[]) => void;
|
|
7
|
-
type ValueOf<T> = T[keyof T];
|
|
8
|
-
export { DropFirst, Stringable, CB, ValueOf };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "../dist/cjs/utilityTypes.js",
|
|
3
|
-
"module": "../dist/es/utilityTypes.production.js",
|
|
4
|
-
"unpkg": "../dist/umd/utilityTypes.production.js",
|
|
5
|
-
"jsdelivr": "../dist/umd/utilityTypes.production.js",
|
|
6
|
-
"name": "utilityTypes",
|
|
7
|
-
"types": "../types/utilityTypes.d.ts",
|
|
8
|
-
"private": true
|
|
9
|
-
}
|