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