vest-utils 0.1.0 → 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.
- package/dist/cjs/vest-utils.development.js +102 -136
- package/dist/cjs/vest-utils.production.js +1 -1
- package/dist/es/vest-utils.development.js +100 -136
- package/dist/es/vest-utils.production.js +1 -1
- package/dist/umd/vest-utils.development.js +102 -136
- package/dist/umd/vest-utils.production.js +1 -1
- package/package.json +1 -1
- package/types/vest-utils.d.ts +32 -20
- package/types/vest-utils.d.ts.map +1 -1
- package/src/__tests__/bindNot.test.ts +0 -37
- package/src/__tests__/bus.test.ts +0 -81
- package/src/__tests__/cache.test.ts +0 -113
- package/src/__tests__/defaultTo.test.ts +0 -50
- package/src/__tests__/deferThrow.test.ts +0 -24
- package/src/__tests__/greaterThan.test.ts +0 -59
- package/src/__tests__/invariant.test.ts +0 -45
- package/src/__tests__/isArray.test.ts +0 -15
- package/src/__tests__/isNull.test.ts +0 -25
- package/src/__tests__/isNumeric.test.ts +0 -26
- package/src/__tests__/isUndefined.test.ts +0 -26
- package/src/__tests__/lengthEquals.test.ts +0 -56
- package/src/__tests__/longerThan.test.ts +0 -56
- package/src/__tests__/mapFirst.test.ts +0 -29
- package/src/__tests__/numberEquals.test.ts +0 -59
- package/src/__tests__/optionalFunctionValue.test.ts +0 -27
- package/src/__tests__/seq.test.ts +0 -28
- package/src/asArray.ts +0 -3
- package/src/assign.ts +0 -1
- package/src/bindNot.ts +0 -3
- package/src/bus.ts +0 -32
- package/src/cache.ts +0 -57
- package/src/callEach.ts +0 -5
- package/src/defaultTo.ts +0 -8
- package/src/deferThrow.ts +0 -5
- package/src/either.ts +0 -3
- package/src/globals.d.ts +0 -3
- package/src/greaterThan.ts +0 -8
- package/src/hasOwnProperty.ts +0 -9
- package/src/invariant.ts +0 -24
- package/src/isArrayValue.ts +0 -11
- package/src/isBooleanValue.ts +0 -3
- package/src/isEmpty.ts +0 -17
- package/src/isFunction.ts +0 -5
- package/src/isNull.ts +0 -7
- package/src/isNullish.ts +0 -9
- package/src/isNumeric.ts +0 -11
- package/src/isPositive.ts +0 -5
- package/src/isPromise.ts +0 -5
- package/src/isStringValue.ts +0 -3
- package/src/isUndefined.ts +0 -7
- package/src/last.ts +0 -7
- package/src/lengthEquals.ts +0 -11
- package/src/longerThan.ts +0 -8
- package/src/mapFirst.ts +0 -25
- package/src/nestedArray.ts +0 -69
- package/src/numberEquals.ts +0 -11
- package/src/optionalFunctionValue.ts +0 -8
- package/src/seq.ts +0 -14
- package/src/utilityTypes.ts +0 -9
- package/src/vest-utils.ts +0 -36
- package/tsconfig.json +0 -46
|
@@ -3,32 +3,26 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function bindNot(fn) {
|
|
6
|
-
return
|
|
7
|
-
var args = [];
|
|
8
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9
|
-
args[_i] = arguments[_i];
|
|
10
|
-
}
|
|
11
|
-
return !fn.apply(void 0, args);
|
|
12
|
-
};
|
|
6
|
+
return (...args) => !fn(...args);
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
function isNumeric(value) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const str = String(value);
|
|
11
|
+
const num = Number(value);
|
|
12
|
+
const result = !isNaN(parseFloat(str)) && !isNaN(Number(value)) && isFinite(num);
|
|
19
13
|
return Boolean(result);
|
|
20
14
|
}
|
|
21
|
-
|
|
15
|
+
const isNotNumeric = bindNot(isNumeric);
|
|
22
16
|
|
|
23
17
|
function numberEquals(value, eq) {
|
|
24
18
|
return isNumeric(value) && isNumeric(eq) && Number(value) === Number(eq);
|
|
25
19
|
}
|
|
26
|
-
|
|
20
|
+
const numberNotEquals = bindNot(numberEquals);
|
|
27
21
|
|
|
28
22
|
function lengthEquals(value, arg1) {
|
|
29
23
|
return numberEquals(value.length, arg1);
|
|
30
24
|
}
|
|
31
|
-
|
|
25
|
+
const lengthNotEquals = bindNot(lengthEquals);
|
|
32
26
|
|
|
33
27
|
function greaterThan(value, gt) {
|
|
34
28
|
return isNumeric(value) && isNumeric(gt) && Number(value) > Number(gt);
|
|
@@ -41,145 +35,55 @@ function longerThan(value, arg1) {
|
|
|
41
35
|
/**
|
|
42
36
|
* Creates a cache function
|
|
43
37
|
*/
|
|
44
|
-
function createCache(maxSize) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var cacheHit = cache.get(deps);
|
|
38
|
+
function createCache(maxSize = 1) {
|
|
39
|
+
const cacheStorage = [];
|
|
40
|
+
const cache = (deps, cacheAction) => {
|
|
41
|
+
const cacheHit = cache.get(deps);
|
|
49
42
|
// cache hit is not null
|
|
50
43
|
if (cacheHit)
|
|
51
44
|
return cacheHit[1];
|
|
52
|
-
|
|
45
|
+
const result = cacheAction();
|
|
53
46
|
cacheStorage.unshift([deps.concat(), result]);
|
|
54
47
|
if (longerThan(cacheStorage, maxSize))
|
|
55
48
|
cacheStorage.length = maxSize;
|
|
56
49
|
return result;
|
|
57
50
|
};
|
|
58
51
|
// invalidate an item in the cache by its dependencies
|
|
59
|
-
cache.invalidate =
|
|
60
|
-
|
|
52
|
+
cache.invalidate = (deps) => {
|
|
53
|
+
const index = findIndex(deps);
|
|
61
54
|
if (index > -1)
|
|
62
55
|
cacheStorage.splice(index, 1);
|
|
63
56
|
};
|
|
64
57
|
// Retrieves an item from the cache.
|
|
65
|
-
cache.get =
|
|
66
|
-
return cacheStorage[findIndex(deps)] || null;
|
|
67
|
-
};
|
|
58
|
+
cache.get = (deps) => cacheStorage[findIndex(deps)] || null;
|
|
68
59
|
return cache;
|
|
69
60
|
function findIndex(deps) {
|
|
70
|
-
return cacheStorage.findIndex(
|
|
71
|
-
|
|
72
|
-
return lengthEquals(deps, cachedDeps.length) &&
|
|
73
|
-
deps.every(function (dep, i) { return dep === cachedDeps[i]; });
|
|
74
|
-
});
|
|
61
|
+
return cacheStorage.findIndex(([cachedDeps]) => lengthEquals(deps, cachedDeps.length) &&
|
|
62
|
+
deps.every((dep, i) => dep === cachedDeps[i]));
|
|
75
63
|
}
|
|
76
64
|
}
|
|
77
65
|
|
|
78
66
|
function isNull(value) {
|
|
79
67
|
return value === null;
|
|
80
68
|
}
|
|
81
|
-
|
|
69
|
+
const isNotNull = bindNot(isNull);
|
|
82
70
|
|
|
83
71
|
function isUndefined(value) {
|
|
84
72
|
return value === undefined;
|
|
85
73
|
}
|
|
86
|
-
|
|
74
|
+
const isNotUndefined = bindNot(isUndefined);
|
|
87
75
|
|
|
88
76
|
function isNullish(value) {
|
|
89
77
|
return isNull(value) || isUndefined(value);
|
|
90
78
|
}
|
|
91
|
-
|
|
79
|
+
const isNotNullish = bindNot(isNullish);
|
|
92
80
|
|
|
93
81
|
function asArray(possibleArg) {
|
|
94
82
|
return [].concat(possibleArg);
|
|
95
83
|
}
|
|
96
84
|
|
|
97
|
-
function isFunction(value) {
|
|
98
|
-
return typeof value === 'function';
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function optionalFunctionValue(value) {
|
|
102
|
-
var args = [];
|
|
103
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
104
|
-
args[_i - 1] = arguments[_i];
|
|
105
|
-
}
|
|
106
|
-
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function defaultTo(value, defaultValue) {
|
|
110
|
-
var _a;
|
|
111
|
-
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// The module is named "isArrayValue" since it
|
|
115
|
-
// is conflicting with a nested npm dependency.
|
|
116
|
-
// We may need to revisit this in the future.
|
|
117
|
-
function isArray(value) {
|
|
118
|
-
return Boolean(Array.isArray(value));
|
|
119
|
-
}
|
|
120
|
-
var isNotArray = bindNot(isArray);
|
|
121
|
-
|
|
122
|
-
function last(values) {
|
|
123
|
-
var valuesArray = asArray(values);
|
|
124
|
-
return valuesArray[valuesArray.length - 1];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// This is kind of a map/filter in one function.
|
|
128
|
-
// Normally, behaves like a nested-array map,
|
|
129
|
-
// but returning `null` will drop the element from the array
|
|
130
|
-
function transform(array, cb) {
|
|
131
|
-
var res = [];
|
|
132
|
-
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
|
|
133
|
-
var v = array_1[_i];
|
|
134
|
-
if (isArray(v)) {
|
|
135
|
-
res.push(transform(v, cb));
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
var output = cb(v);
|
|
139
|
-
if (isNotNull(output)) {
|
|
140
|
-
res.push(output);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return res;
|
|
145
|
-
}
|
|
146
|
-
function valueAtPath(array, path) {
|
|
147
|
-
return getCurrent(array, path)[last(path)];
|
|
148
|
-
}
|
|
149
|
-
function setValueAtPath(array, path, value) {
|
|
150
|
-
var current = getCurrent(array, path);
|
|
151
|
-
current[last(path)] = value;
|
|
152
|
-
return array;
|
|
153
|
-
}
|
|
154
|
-
function flatten(values) {
|
|
155
|
-
return asArray(values).reduce(function (acc, value) {
|
|
156
|
-
if (isArray(value)) {
|
|
157
|
-
return acc.concat(flatten(value));
|
|
158
|
-
}
|
|
159
|
-
return asArray(acc).concat(value);
|
|
160
|
-
}, []);
|
|
161
|
-
}
|
|
162
|
-
function getCurrent(array, path) {
|
|
163
|
-
var current = array;
|
|
164
|
-
for (var _i = 0, _a = path.slice(0, -1); _i < _a.length; _i++) {
|
|
165
|
-
var p = _a[_i];
|
|
166
|
-
current[p] = defaultTo(current[p], []);
|
|
167
|
-
current = current[p];
|
|
168
|
-
}
|
|
169
|
-
return current;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
var nestedArray = /*#__PURE__*/Object.freeze({
|
|
173
|
-
__proto__: null,
|
|
174
|
-
transform: transform,
|
|
175
|
-
valueAtPath: valueAtPath,
|
|
176
|
-
setValueAtPath: setValueAtPath,
|
|
177
|
-
flatten: flatten,
|
|
178
|
-
getCurrent: getCurrent
|
|
179
|
-
});
|
|
180
|
-
|
|
181
85
|
function callEach(arr) {
|
|
182
|
-
return arr.forEach(
|
|
86
|
+
return arr.forEach(fn => fn());
|
|
183
87
|
}
|
|
184
88
|
|
|
185
89
|
/**
|
|
@@ -189,12 +93,25 @@ function hasOwnProperty(obj, key) {
|
|
|
189
93
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
190
94
|
}
|
|
191
95
|
|
|
96
|
+
function isFunction(value) {
|
|
97
|
+
return typeof value === 'function';
|
|
98
|
+
}
|
|
99
|
+
|
|
192
100
|
function isPromise(value) {
|
|
193
101
|
return value && isFunction(value.then);
|
|
194
102
|
}
|
|
195
103
|
|
|
104
|
+
function optionalFunctionValue(value, ...args) {
|
|
105
|
+
return isFunction(value) ? value(...args) : value;
|
|
106
|
+
}
|
|
107
|
+
|
|
196
108
|
var assign = Object.assign;
|
|
197
109
|
|
|
110
|
+
function defaultTo(value, defaultValue) {
|
|
111
|
+
var _a;
|
|
112
|
+
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
|
|
113
|
+
}
|
|
114
|
+
|
|
198
115
|
function invariant(condition,
|
|
199
116
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
200
117
|
message) {
|
|
@@ -225,28 +142,33 @@ function isBoolean(value) {
|
|
|
225
142
|
return !!value === value;
|
|
226
143
|
}
|
|
227
144
|
|
|
145
|
+
function last(values) {
|
|
146
|
+
const valuesArray = asArray(values);
|
|
147
|
+
return valuesArray[valuesArray.length - 1];
|
|
148
|
+
}
|
|
149
|
+
|
|
228
150
|
function deferThrow(message) {
|
|
229
|
-
setTimeout(
|
|
151
|
+
setTimeout(() => {
|
|
230
152
|
throw new Error(message);
|
|
231
153
|
}, 0);
|
|
232
154
|
}
|
|
233
155
|
|
|
234
156
|
function createBus() {
|
|
235
|
-
|
|
157
|
+
const listeners = {};
|
|
236
158
|
return {
|
|
237
|
-
emit
|
|
238
|
-
listener(event).forEach(
|
|
159
|
+
emit(event, data) {
|
|
160
|
+
listener(event).forEach(handler => {
|
|
239
161
|
handler(data);
|
|
240
162
|
});
|
|
241
163
|
},
|
|
242
|
-
on
|
|
164
|
+
on(event, handler) {
|
|
243
165
|
listeners[event] = listener(event).concat(handler);
|
|
244
166
|
return {
|
|
245
|
-
off
|
|
246
|
-
listeners[event] = listener(event).filter(
|
|
247
|
-
}
|
|
167
|
+
off() {
|
|
168
|
+
listeners[event] = listener(event).filter(h => h !== handler);
|
|
169
|
+
},
|
|
248
170
|
};
|
|
249
|
-
}
|
|
171
|
+
},
|
|
250
172
|
};
|
|
251
173
|
function listener(event) {
|
|
252
174
|
return listeners[event] || [];
|
|
@@ -261,17 +183,15 @@ var bus = /*#__PURE__*/Object.freeze({
|
|
|
261
183
|
/**
|
|
262
184
|
* @returns a unique numeric id.
|
|
263
185
|
*/
|
|
264
|
-
|
|
186
|
+
const seq = genSeq();
|
|
265
187
|
function genSeq(namespace) {
|
|
266
|
-
return (
|
|
267
|
-
return "".concat(namespace ? namespace + '_' : '').concat(n++);
|
|
268
|
-
}; })(0);
|
|
188
|
+
return ((n) => () => `${namespace ? namespace + '_' : ''}${n++}`)(0);
|
|
269
189
|
}
|
|
270
190
|
|
|
271
191
|
function mapFirst(array, callback) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
for (
|
|
192
|
+
let broke = false;
|
|
193
|
+
let breakoutValue = null;
|
|
194
|
+
for (let i = 0; i < array.length; i++) {
|
|
275
195
|
callback(array[i], breakout, i);
|
|
276
196
|
if (broke) {
|
|
277
197
|
return breakoutValue;
|
|
@@ -285,6 +205,18 @@ function mapFirst(array, callback) {
|
|
|
285
205
|
}
|
|
286
206
|
}
|
|
287
207
|
|
|
208
|
+
function isObject(v) {
|
|
209
|
+
return typeof v === 'object' && !isNullish(v);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// The module is named "isArrayValue" since it
|
|
213
|
+
// is conflicting with a nested npm dependency.
|
|
214
|
+
// We may need to revisit this in the future.
|
|
215
|
+
function isArray(value) {
|
|
216
|
+
return Boolean(Array.isArray(value));
|
|
217
|
+
}
|
|
218
|
+
const isNotArray = bindNot(isArray);
|
|
219
|
+
|
|
288
220
|
function isEmpty(value) {
|
|
289
221
|
if (!value) {
|
|
290
222
|
return true;
|
|
@@ -292,17 +224,49 @@ function isEmpty(value) {
|
|
|
292
224
|
else if (hasOwnProperty(value, 'length')) {
|
|
293
225
|
return lengthEquals(value, 0);
|
|
294
226
|
}
|
|
295
|
-
else if (
|
|
227
|
+
else if (isObject(value)) {
|
|
296
228
|
return lengthEquals(Object.keys(value), 0);
|
|
297
229
|
}
|
|
298
230
|
return false;
|
|
299
231
|
}
|
|
300
|
-
|
|
232
|
+
const isNotEmpty = bindNot(isEmpty);
|
|
301
233
|
|
|
302
234
|
function isPositive(value) {
|
|
303
235
|
return greaterThan(value, 0);
|
|
304
236
|
}
|
|
305
237
|
|
|
238
|
+
const regexp = /{(.*?)}/g;
|
|
239
|
+
function text(str, ...substitutions) {
|
|
240
|
+
const first = substitutions[0];
|
|
241
|
+
if (isObject(first)) {
|
|
242
|
+
return str.replace(regexp, (placeholder, key) => {
|
|
243
|
+
var _a;
|
|
244
|
+
return `${(_a = first[key]) !== null && _a !== void 0 ? _a : placeholder}`;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const subs = [...substitutions];
|
|
248
|
+
return str.replace(regexp, placeholder => {
|
|
249
|
+
return `${isEmpty(subs) ? placeholder : subs.shift()}`;
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function createTinyState(initialValue) {
|
|
254
|
+
let value;
|
|
255
|
+
resetValue();
|
|
256
|
+
return () => [value, setValue, resetValue];
|
|
257
|
+
function setValue(nextValue) {
|
|
258
|
+
value = optionalFunctionValue(nextValue, value);
|
|
259
|
+
}
|
|
260
|
+
function resetValue() {
|
|
261
|
+
setValue(optionalFunctionValue(initialValue));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var tinyState = /*#__PURE__*/Object.freeze({
|
|
266
|
+
__proto__: null,
|
|
267
|
+
createTinyState: createTinyState
|
|
268
|
+
});
|
|
269
|
+
|
|
306
270
|
exports.StringObject = StringObject;
|
|
307
271
|
exports.asArray = asArray;
|
|
308
272
|
exports.assign = assign;
|
|
@@ -330,6 +294,7 @@ exports.isNotUndefined = isNotUndefined;
|
|
|
330
294
|
exports.isNull = isNull;
|
|
331
295
|
exports.isNullish = isNullish;
|
|
332
296
|
exports.isNumeric = isNumeric;
|
|
297
|
+
exports.isObject = isObject;
|
|
333
298
|
exports.isPositive = isPositive;
|
|
334
299
|
exports.isPromise = isPromise;
|
|
335
300
|
exports.isStringValue = isStringValue;
|
|
@@ -339,8 +304,9 @@ exports.lengthEquals = lengthEquals;
|
|
|
339
304
|
exports.lengthNotEquals = lengthNotEquals;
|
|
340
305
|
exports.longerThan = longerThan;
|
|
341
306
|
exports.mapFirst = mapFirst;
|
|
342
|
-
exports.nestedArray = nestedArray;
|
|
343
307
|
exports.numberEquals = numberEquals;
|
|
344
308
|
exports.numberNotEquals = numberNotEquals;
|
|
345
309
|
exports.optionalFunctionValue = optionalFunctionValue;
|
|
346
310
|
exports.seq = seq;
|
|
311
|
+
exports.text = text;
|
|
312
|
+
exports.tinyState = tinyState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function t(t){return(...n)=>!t(...n)}function n(t){const n=String(t),r=Number(t),e=!isNaN(parseFloat(n))&&!isNaN(Number(t))&&isFinite(r);return Boolean(e)}Object.defineProperty(exports,"__esModule",{value:!0});const r=t(n);function e(t,r){return n(t)&&n(r)&&Number(t)===Number(r)}const o=t(e);function s(t,n){return e(t.length,n)}const u=t(s);function i(t,r){return n(t)&&n(r)&&Number(t)>Number(r)}function c(t,n){return i(t.length,n)}function f(t){return null===t}const p=t(f);function l(t){return void 0===t}const a=t(l);function x(t){return f(t)||l(t)}const h=t(x);function N(t){return[].concat(t)}function g(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function b(t){return"function"==typeof t}function y(t,...n){return b(t)?t(...n):t}var m=Object.assign;var d=Object.freeze({__proto__:null,createBus:function(){const t={};return{emit(t,r){n(t).forEach((t=>{t(r)}))},on:(r,e)=>(t[r]=n(r).concat(e),{off(){t[r]=n(r).filter((t=>t!==e))}})};function n(n){return t[n]||[]}}});const v=E();function E(t){return n=0,()=>`${t?t+"_":""}${n++}`;var n}function O(t){return"object"==typeof t&&!x(t)}function _(t){return Boolean(Array.isArray(t))}const j=t(_);function S(t){return!t||(g(t,"length")?s(t,0):!!O(t)&&s(Object.keys(t),0))}const w=t(S);const q=/{(.*?)}/g;var T=Object.freeze({__proto__:null,createTinyState:function(t){let n;return e(),()=>[n,r,e];function r(t){n=y(t,n)}function e(){r(y(t))}}});exports.StringObject=function(t){return new String(y(t))},exports.asArray=N,exports.assign=m,exports.bindNot=t,exports.bus=d,exports.cache=function(t=1){const n=[],r=(e,o)=>{const s=r.get(e);if(s)return s[1];const u=o();return n.unshift([e.concat(),u]),c(n,t)&&(n.length=t),u};return r.invalidate=t=>{const r=e(t);r>-1&&n.splice(r,1)},r.get=t=>n[e(t)]||null,r;function e(t){return n.findIndex((([n])=>s(t,n.length)&&t.every(((t,r)=>t===n[r]))))}},exports.callEach=function(t){return t.forEach((t=>t()))},exports.defaultTo=function(t,n){var r;return null!==(r=y(t))&&void 0!==r?r:y(n)},exports.deferThrow=function(t){setTimeout((()=>{throw new Error(t)}),0)},exports.either=function(t,n){return!!t!=!!n},exports.genSeq=E,exports.greaterThan=i,exports.hasOwnProperty=g,exports.invariant=function(t,n){if(!t)throw n instanceof String?n.valueOf():new Error(n?y(n):n)},exports.isArray=_,exports.isBoolean=function(t){return!!t===t},exports.isEmpty=S,exports.isFunction=b,exports.isNotArray=j,exports.isNotEmpty=w,exports.isNotNull=p,exports.isNotNullish=h,exports.isNotNumeric=r,exports.isNotUndefined=a,exports.isNull=f,exports.isNullish=x,exports.isNumeric=n,exports.isObject=O,exports.isPositive=function(t){return i(t,0)},exports.isPromise=function(t){return t&&b(t.then)},exports.isStringValue=function(t){return String(t)===t},exports.isUndefined=l,exports.last=function(t){const n=N(t);return n[n.length-1]},exports.lengthEquals=s,exports.lengthNotEquals=u,exports.longerThan=c,exports.mapFirst=function(t,n){let r=!1,e=null;for(let s=0;s<t.length;s++)if(n(t[s],o,s),r)return e;function o(t,n){t&&(r=!0,e=n)}},exports.numberEquals=e,exports.numberNotEquals=o,exports.optionalFunctionValue=y,exports.seq=v,exports.text=function(t,...n){const r=n[0];if(O(r))return t.replace(q,((t,n)=>{var e;return`${null!==(e=r[n])&&void 0!==e?e:t}`}));const e=[...n];return t.replace(q,(t=>`${S(e)?t:e.shift()}`))},exports.tinyState=T;
|