vest-utils 0.0.1-rc → 0.0.4-dev-afe5de
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/dist/cjs/vest-utils.development.js +348 -0
- package/dist/cjs/vest-utils.production.js +1 -1
- package/dist/es/vest-utils.development.js +305 -0
- package/dist/es/vest-utils.production.js +1 -1
- package/dist/umd/vest-utils.development.js +352 -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__ → __tests__}/genId.test.ts +0 -0
- 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/{exports/__tests__ → __tests__}/partition.test.ts +1 -1
- package/src/{exports/__tests__ → __tests__}/throwError.test.ts +1 -1
- 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/{exports/callEach.ts → callEach.ts} +0 -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/{exports/genId.ts → genId.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/partition.ts → partition.ts} +0 -0
- package/src/vest-utils.ts +32 -0
- package/types/vest-utils.d.ts +96 -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/isBooleanValue.ts +0 -3
- package/src/exports/isStringValue.ts +0 -3
- package/throwError/package.json +0 -9
- package/tsconfig.json +0 -6
- 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
package/dist/cjs/isPromise.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";module.exports=function(t){return t&&function(t){return"function"==typeof t}(t.then)};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isStringValue=function(e){return String(e)===e};
|
package/dist/cjs/last.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";module.exports=function(t){return(t=function(t){return[].concat(t)}(t))[t.length-1]};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function mapFirst(array, callback) {
|
|
4
|
-
var broke = false;
|
|
5
|
-
var breakoutValue = null;
|
|
6
|
-
for (var i = 0; i < array.length; i++) {
|
|
7
|
-
callback(array[i], breakout, i);
|
|
8
|
-
if (broke) {
|
|
9
|
-
return breakoutValue;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function breakout(conditional, value) {
|
|
13
|
-
if (conditional) {
|
|
14
|
-
broke = true;
|
|
15
|
-
breakoutValue = value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = mapFirst;
|
package/dist/cjs/mapFirst.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";module.exports=function(n,t){function r(n,t){n&&(u=!0,e=t)}for(var u=!1,e=null,o=0;o<n.length;o++)if(t(n[o],r,o),u)return e};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var bindNot = require('vest-utils/bindNot');
|
|
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;
|
package/dist/cjs/nestedArray.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("vest-utils/bindNot");var r,n=(r=t)&&"object"==typeof r&&"default"in r?r:{default:r};function e(t){return!!Array.isArray(t)}n.default(e);var u=n.default((function(t){return null===t}));function o(t){return[].concat(t)}function a(t){return"function"==typeof t}function f(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return a(t)?t.apply(void 0,r):t}function c(t,r){var n;return null!==(n=f(t))&&void 0!==n?n:f(r)}function i(t){return(t=o(t))[t.length-1]}function l(t,r){var n=0;for(r=r.slice(0,-1);n<r.length;n++){var e=r[n];t[e]=c(t[e],[]),t=t[e]}return t}exports.flatten=function t(r){return o(r).reduce((function(r,n){return e(n)?r.concat(t(n)):o(r).concat(n)}),[])},exports.getCurrent=l,exports.setValueAtPath=function(t,r,n){return l(t,r)[i(r)]=n,t},exports.transform=function t(r,n){for(var o=[],a=0;a<r.length;a++){var f=r[a];e(f)?o.push(t(f,n)):(f=n(f),u(f)&&o.push(f))}return o},exports.valueAtPath=function(t,r){return l(t,r)[i(r)]};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function isFunction(value) {
|
|
4
|
-
return typeof value === 'function';
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function optionalFunctionValue(value) {
|
|
8
|
-
var args = [];
|
|
9
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
10
|
-
args[_i - 1] = arguments[_i];
|
|
11
|
-
}
|
|
12
|
-
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = optionalFunctionValue;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function t(t){return"function"==typeof t}module.exports=function(n){for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];return t(n)?n.apply(void 0,o):n};
|
package/dist/cjs/partition.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";module.exports=function(u,e){return u.reduce((function(r,t,n){return r[e(t,n,u)?0:1].push(t),r}),[[],[]])};
|
package/dist/cjs/throwError.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.deferThrow=function(e){setTimeout((function(){throw Error(e)}),0)};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(t){return[].concat(t)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default Object.assign;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(n){return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return!n.apply(void 0,r)}}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
function createBus() {
|
|
2
|
-
var listeners = {};
|
|
3
|
-
return {
|
|
4
|
-
emit: function (event, data) {
|
|
5
|
-
listener(event).forEach(function (handler) {
|
|
6
|
-
handler(data);
|
|
7
|
-
});
|
|
8
|
-
},
|
|
9
|
-
on: function (event, handler) {
|
|
10
|
-
listeners[event] = listener(event).concat(handler);
|
|
11
|
-
return {
|
|
12
|
-
off: function () {
|
|
13
|
-
listeners[event] = listener(event).filter(function (h) { return h !== handler; });
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
function listener(event) {
|
|
19
|
-
return listeners[event] || [];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { createBus };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function createBus(){var n={};return{emit:function(t,o){(n[t]||[]).forEach((function(n){n(o)}))},on:function(t,o){return n[t]=(n[t]||[]).concat(o),{off:function(){n[t]=(n[t]||[]).filter((function(n){return n!==o}))}}}}}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import bindNot from 'vest-utils/bindNot';
|
|
2
|
-
|
|
3
|
-
function isNumeric(value) {
|
|
4
|
-
var str = String(value);
|
|
5
|
-
var num = Number(value);
|
|
6
|
-
var result = !isNaN(parseFloat(str)) && !isNaN(Number(value)) && isFinite(num);
|
|
7
|
-
return Boolean(result);
|
|
8
|
-
}
|
|
9
|
-
bindNot(isNumeric);
|
|
10
|
-
|
|
11
|
-
function numberEquals(value, eq) {
|
|
12
|
-
return isNumeric(value) && isNumeric(eq) && Number(value) === Number(eq);
|
|
13
|
-
}
|
|
14
|
-
bindNot(numberEquals);
|
|
15
|
-
|
|
16
|
-
function lengthEquals(value, arg1) {
|
|
17
|
-
return numberEquals(value.length, arg1);
|
|
18
|
-
}
|
|
19
|
-
bindNot(lengthEquals);
|
|
20
|
-
|
|
21
|
-
function greaterThan(value, gt) {
|
|
22
|
-
return isNumeric(value) && isNumeric(gt) && Number(value) > Number(gt);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function longerThan(value, arg1) {
|
|
26
|
-
return greaterThan(value.length, arg1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Creates a cache function
|
|
31
|
-
*/
|
|
32
|
-
function createCache(maxSize) {
|
|
33
|
-
if (maxSize === void 0) { maxSize = 1; }
|
|
34
|
-
var cacheStorage = [];
|
|
35
|
-
var cache = function (deps, cacheAction) {
|
|
36
|
-
var cacheHit = cache.get(deps);
|
|
37
|
-
// cache hit is not null
|
|
38
|
-
if (cacheHit)
|
|
39
|
-
return cacheHit[1];
|
|
40
|
-
var result = cacheAction();
|
|
41
|
-
cacheStorage.unshift([deps.concat(), result]);
|
|
42
|
-
if (longerThan(cacheStorage, maxSize))
|
|
43
|
-
cacheStorage.length = maxSize;
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
46
|
-
// invalidate an item in the cache by its dependencies
|
|
47
|
-
cache.invalidate = function (deps) {
|
|
48
|
-
var index = findIndex(deps);
|
|
49
|
-
if (index > -1)
|
|
50
|
-
cacheStorage.splice(index, 1);
|
|
51
|
-
};
|
|
52
|
-
// Retrieves an item from the cache.
|
|
53
|
-
cache.get = function (deps) {
|
|
54
|
-
return cacheStorage[findIndex(deps)] || null;
|
|
55
|
-
};
|
|
56
|
-
return cache;
|
|
57
|
-
function findIndex(deps) {
|
|
58
|
-
return cacheStorage.findIndex(function (_a) {
|
|
59
|
-
var cachedDeps = _a[0];
|
|
60
|
-
return lengthEquals(deps, cachedDeps.length) &&
|
|
61
|
-
deps.every(function (dep, i) { return dep === cachedDeps[i]; });
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default createCache;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n from"vest-utils/bindNot";function t(n){var t=Number(n);return!(isNaN(parseFloat(String(n)))||isNaN(Number(n))||!isFinite(t))}function r(n,r){return t(n)&&t(r)&&Number(n)===Number(r)}function e(n,t){return r(n.length,t)}n(t),n(r),n(e);export default function(n){function r(e,u){var o=r.get(e);return o?o[1]:(u=u(),i.unshift([e.concat(),u]),e=i.length,o=n,t(e)&&t(o)&&Number(e)>Number(o)&&(i.length=n),u)}function u(n){return i.findIndex((function(t){var r=t[0];return e(n,r.length)&&n.every((function(n,t){return n===r[t]}))}))}void 0===n&&(n=1);var i=[];return r.invalidate=function(n){-1<(n=u(n))&&i.splice(n,1)},r.get=function(n){return i[u(n)]||null},r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(n){return n.forEach((function(n){return n()}))}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function isFunction(value) {
|
|
2
|
-
return typeof value === 'function';
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function optionalFunctionValue(value) {
|
|
6
|
-
var args = [];
|
|
7
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
8
|
-
args[_i - 1] = arguments[_i];
|
|
9
|
-
}
|
|
10
|
-
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function defaultTo(value, defaultValue) {
|
|
14
|
-
var _a;
|
|
15
|
-
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default defaultTo;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n(n){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return"function"==typeof n?n.apply(void 0,t):n}export default function(t,o){var r;return null!==(r=n(t))&&void 0!==r?r:n(o)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(t,e){return!!t!=!!e}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t,n=(t=0,function(){return"".concat(t++)});export default n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}export default t;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
function isFunction(value) {
|
|
2
|
-
return typeof value === 'function';
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function optionalFunctionValue(value) {
|
|
6
|
-
var args = [];
|
|
7
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
8
|
-
args[_i - 1] = arguments[_i];
|
|
9
|
-
}
|
|
10
|
-
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function invariant(condition,
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
15
|
-
message) {
|
|
16
|
-
if (condition) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
// If message is a string object (rather than string literal)
|
|
20
|
-
// Throw the value directly as a string
|
|
21
|
-
// Alternatively, throw an error with the message
|
|
22
|
-
throw message instanceof String
|
|
23
|
-
? message.valueOf()
|
|
24
|
-
: new Error(message ? optionalFunctionValue(message) : message);
|
|
25
|
-
}
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
27
|
-
function StringObject(value) {
|
|
28
|
-
return new String(optionalFunctionValue(value));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default invariant;
|
|
32
|
-
export { StringObject };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return"function"==typeof n?n.apply(void 0,t):n}export default function(t,r){if(!t)throw r instanceof String?r.valueOf():Error(r?n(r):r)}function t(t){return new String(n(t))}export{t as StringObject};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function isBoolean(n){return!!n===n}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(t){return"function"==typeof t}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import bindNot$1 from 'vest-utils/bindNot';
|
|
2
|
-
|
|
3
|
-
function isNull(value) {
|
|
4
|
-
return value === null;
|
|
5
|
-
}
|
|
6
|
-
bindNot$1(isNull);
|
|
7
|
-
|
|
8
|
-
function isUndefined(value) {
|
|
9
|
-
return value === undefined;
|
|
10
|
-
}
|
|
11
|
-
bindNot$1(isUndefined);
|
|
12
|
-
|
|
13
|
-
function bindNot(fn) {
|
|
14
|
-
return function () {
|
|
15
|
-
var args = [];
|
|
16
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
17
|
-
args[_i] = arguments[_i];
|
|
18
|
-
}
|
|
19
|
-
return !fn.apply(void 0, args);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function isNullish(value) {
|
|
24
|
-
return isNull(value) || isUndefined(value);
|
|
25
|
-
}
|
|
26
|
-
var isNotNullish = bindNot(isNullish);
|
|
27
|
-
|
|
28
|
-
export { isNotNullish, isNullish };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n from"vest-utils/bindNot";function t(n){return void 0===n}function r(n){return null===n||t(n)}n((function(n){return null===n})),n(t);var i,u=(i=r,function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return!i.apply(void 0,n)});export{u as isNotNullish,r as isNullish};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(t){return t&&"function"==typeof t.then}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function isStringValue(n){return String(n)===n}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(t){return(t=[].concat(t))[t.length-1]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function mapFirst(array, callback) {
|
|
2
|
-
var broke = false;
|
|
3
|
-
var breakoutValue = null;
|
|
4
|
-
for (var i = 0; i < array.length; i++) {
|
|
5
|
-
callback(array[i], breakout, i);
|
|
6
|
-
if (broke) {
|
|
7
|
-
return breakoutValue;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function breakout(conditional, value) {
|
|
11
|
-
if (conditional) {
|
|
12
|
-
broke = true;
|
|
13
|
-
breakoutValue = value;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default mapFirst;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(n,t){function f(n,t){n&&(r=!0,u=t)}for(var r=!1,u=null,e=0;e<n.length;e++)if(t(n[e],f,e),r)return u}
|