@naturalcycles/js-lib 14.276.0 → 15.0.0
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/cfg/frontend/tsconfig.json +3 -3
- package/dist/abort.js +1 -4
- package/dist/array/array.util.d.ts +1 -1
- package/dist/array/array.util.js +47 -88
- package/dist/array/range.d.ts +2 -2
- package/dist/array/range.js +7 -12
- package/dist/bot.js +6 -10
- package/dist/browser/adminService.d.ts +1 -1
- package/dist/browser/adminService.js +10 -14
- package/dist/browser/analytics.util.js +10 -15
- package/dist/browser/i18n/fetchTranslationLoader.d.ts +3 -3
- package/dist/browser/i18n/fetchTranslationLoader.js +1 -5
- package/dist/browser/i18n/translation.service.d.ts +1 -1
- package/dist/browser/i18n/translation.service.js +5 -10
- package/dist/browser/imageFitter.js +1 -5
- package/dist/browser/script.util.js +8 -12
- package/dist/browser/topbar.js +7 -10
- package/dist/datetime/dateInterval.d.ts +2 -2
- package/dist/datetime/dateInterval.js +7 -11
- package/dist/datetime/localDate.d.ts +3 -3
- package/dist/datetime/localDate.js +40 -44
- package/dist/datetime/localTime.d.ts +3 -3
- package/dist/datetime/localTime.js +36 -40
- package/dist/datetime/timeInterval.d.ts +2 -2
- package/dist/datetime/timeInterval.js +6 -10
- package/dist/datetime/wallTime.d.ts +3 -3
- package/dist/datetime/wallTime.js +5 -9
- package/dist/decorators/asyncMemo.decorator.d.ts +3 -3
- package/dist/decorators/asyncMemo.decorator.js +12 -17
- package/dist/decorators/createPromiseDecorator.js +3 -6
- package/dist/decorators/debounce.d.ts +1 -1
- package/dist/decorators/debounce.decorator.d.ts +1 -1
- package/dist/decorators/debounce.decorator.js +5 -9
- package/dist/decorators/debounce.js +2 -6
- package/dist/decorators/decorator.util.d.ts +1 -1
- package/dist/decorators/decorator.util.js +3 -8
- package/dist/decorators/logMethod.decorator.d.ts +1 -1
- package/dist/decorators/logMethod.decorator.js +11 -14
- package/dist/decorators/memo.decorator.d.ts +3 -3
- package/dist/decorators/memo.decorator.js +11 -16
- package/dist/decorators/memo.util.d.ts +2 -2
- package/dist/decorators/memo.util.js +11 -17
- package/dist/decorators/memoFn.d.ts +3 -3
- package/dist/decorators/memoFn.js +3 -6
- package/dist/decorators/memoFnAsync.d.ts +3 -3
- package/dist/decorators/memoFnAsync.js +5 -8
- package/dist/decorators/memoSimple.decorator.d.ts +1 -1
- package/dist/decorators/memoSimple.decorator.js +6 -10
- package/dist/decorators/retry.decorator.d.ts +1 -1
- package/dist/decorators/retry.decorator.js +3 -6
- package/dist/decorators/swarmSafe.decorator.js +3 -7
- package/dist/decorators/timeout.decorator.d.ts +1 -1
- package/dist/decorators/timeout.decorator.js +7 -10
- package/dist/define.d.ts +1 -1
- package/dist/define.js +11 -19
- package/dist/deviceIdService.js +7 -11
- package/dist/enum.util.d.ts +1 -1
- package/dist/enum.util.js +20 -42
- package/dist/env/buildInfo.d.ts +1 -1
- package/dist/env/buildInfo.js +3 -6
- package/dist/env.js +2 -6
- package/dist/error/assert.d.ts +3 -3
- package/dist/error/assert.js +30 -44
- package/dist/error/error.model.d.ts +2 -2
- package/dist/error/error.model.js +1 -2
- package/dist/error/error.util.d.ts +1 -1
- package/dist/error/error.util.js +25 -44
- package/dist/error/errorMode.js +2 -5
- package/dist/error/try.d.ts +2 -2
- package/dist/error/try.js +15 -23
- package/dist/error/tryCatch.d.ts +2 -2
- package/dist/error/tryCatch.js +6 -11
- package/dist/form.util.d.ts +1 -1
- package/dist/form.util.js +2 -6
- package/dist/http/fetcher.d.ts +3 -3
- package/dist/http/fetcher.js +48 -53
- package/dist/http/fetcher.model.d.ts +5 -5
- package/dist/http/fetcher.model.js +1 -2
- package/dist/http/http.model.js +1 -4
- package/dist/index.d.ts +96 -96
- package/dist/index.js +96 -99
- package/dist/is.util.d.ts +2 -2
- package/dist/is.util.js +12 -27
- package/dist/iter/asyncIterable2.d.ts +3 -3
- package/dist/iter/asyncIterable2.js +8 -12
- package/dist/iter/iterable2.d.ts +2 -2
- package/dist/iter/iterable2.js +8 -12
- package/dist/json-schema/from-data/generateJsonSchemaFromData.d.ts +1 -1
- package/dist/json-schema/from-data/generateJsonSchemaFromData.js +4 -7
- package/dist/json-schema/jsonSchema.cnst.d.ts +1 -1
- package/dist/json-schema/jsonSchema.cnst.js +1 -4
- package/dist/json-schema/jsonSchema.model.d.ts +1 -1
- package/dist/json-schema/jsonSchema.model.js +1 -2
- package/dist/json-schema/jsonSchema.util.d.ts +2 -2
- package/dist/json-schema/jsonSchema.util.js +5 -8
- package/dist/json-schema/jsonSchemaBuilder.d.ts +2 -2
- package/dist/json-schema/jsonSchemaBuilder.js +16 -25
- package/dist/json-schema/jsonSchemas.d.ts +2 -2
- package/dist/json-schema/jsonSchemas.js +5 -8
- package/dist/log/commonLogger.js +14 -21
- package/dist/math/accumulatingAverage.js +1 -5
- package/dist/math/math.util.js +11 -19
- package/dist/math/sma.js +1 -5
- package/dist/math/stack.util.js +11 -16
- package/dist/nanoid.js +2 -6
- package/dist/number/createDeterministicRandom.js +1 -4
- package/dist/number/number.util.d.ts +1 -1
- package/dist/number/number.util.js +9 -20
- package/dist/object/deepEquals.js +3 -8
- package/dist/object/map2.js +1 -5
- package/dist/object/object.util.d.ts +2 -2
- package/dist/object/object.util.js +40 -70
- package/dist/object/set2.js +1 -5
- package/dist/object/sortObject.d.ts +1 -1
- package/dist/object/sortObject.js +1 -4
- package/dist/object/sortObjectDeep.js +1 -4
- package/dist/polyfill.js +1 -4
- package/dist/promise/abortable.d.ts +1 -1
- package/dist/promise/abortable.js +2 -7
- package/dist/promise/pDefer.js +1 -4
- package/dist/promise/pDelay.d.ts +2 -2
- package/dist/promise/pDelay.js +4 -8
- package/dist/promise/pFilter.d.ts +1 -1
- package/dist/promise/pFilter.js +1 -4
- package/dist/promise/pHang.js +1 -4
- package/dist/promise/pMap.d.ts +2 -2
- package/dist/promise/pMap.js +17 -20
- package/dist/promise/pProps.js +1 -4
- package/dist/promise/pQueue.d.ts +2 -2
- package/dist/promise/pQueue.js +7 -11
- package/dist/promise/pRetry.d.ts +1 -1
- package/dist/promise/pRetry.js +8 -12
- package/dist/promise/pState.js +1 -4
- package/dist/promise/pTimeout.d.ts +3 -3
- package/dist/promise/pTimeout.js +7 -11
- package/dist/semver.d.ts +1 -1
- package/dist/semver.js +13 -18
- package/dist/string/case.js +9 -14
- package/dist/string/escape.js +2 -6
- package/dist/string/hash.util.d.ts +1 -1
- package/dist/string/hash.util.js +4 -10
- package/dist/string/json.util.d.ts +1 -1
- package/dist/string/json.util.js +5 -10
- package/dist/string/leven.js +1 -4
- package/dist/string/lodash/unicodeWords.js +1 -4
- package/dist/string/lodash/words.js +3 -6
- package/dist/string/pupa.d.ts +1 -1
- package/dist/string/pupa.js +4 -9
- package/dist/string/readingTime.d.ts +1 -1
- package/dist/string/readingTime.js +1 -4
- package/dist/string/regex.js +1 -4
- package/dist/string/safeJsonStringify.d.ts +1 -1
- package/dist/string/safeJsonStringify.js +1 -4
- package/dist/string/slugify.js +1 -4
- package/dist/string/string.util.js +15 -32
- package/dist/string/stringify.d.ts +1 -1
- package/dist/string/stringify.js +10 -14
- package/dist/string/url.util.d.ts +1 -1
- package/dist/string/url.util.js +2 -6
- package/dist/time/time.util.d.ts +1 -1
- package/dist/time/time.util.js +3 -8
- package/dist/typeFest.js +1 -2
- package/dist/types.d.ts +7 -3
- package/dist/types.js +21 -23
- package/dist/unit/size.util.js +5 -12
- package/dist/web.d.ts +1 -1
- package/dist/web.js +1 -5
- package/dist/zod/index.d.ts +2 -2
- package/dist/zod/index.js +4 -10
- package/dist/zod/zod.shared.schemas.js +36 -39
- package/dist/zod/zod.util.js +7 -14
- package/package.json +7 -8
- package/src/array/array.util.ts +3 -3
- package/src/array/range.ts +2 -2
- package/src/bot.ts +1 -1
- package/src/browser/adminService.ts +4 -4
- package/src/browser/analytics.util.ts +1 -1
- package/src/browser/i18n/fetchTranslationLoader.ts +3 -3
- package/src/browser/i18n/translation.service.ts +2 -2
- package/src/browser/script.util.ts +2 -2
- package/src/datetime/dateInterval.ts +3 -3
- package/src/datetime/localDate.ts +5 -5
- package/src/datetime/localTime.ts +6 -6
- package/src/datetime/timeInterval.ts +3 -3
- package/src/datetime/wallTime.ts +4 -4
- package/src/decorators/asyncMemo.decorator.ts +7 -7
- package/src/decorators/createPromiseDecorator.ts +1 -1
- package/src/decorators/debounce.decorator.ts +2 -2
- package/src/decorators/debounce.ts +1 -1
- package/src/decorators/decorator.util.ts +1 -1
- package/src/decorators/logMethod.decorator.ts +4 -4
- package/src/decorators/memo.decorator.ts +7 -7
- package/src/decorators/memo.util.ts +4 -4
- package/src/decorators/memoFn.ts +4 -4
- package/src/decorators/memoFnAsync.ts +5 -5
- package/src/decorators/memoSimple.decorator.ts +4 -4
- package/src/decorators/retry.decorator.ts +2 -2
- package/src/decorators/swarmSafe.decorator.ts +2 -2
- package/src/decorators/timeout.decorator.ts +4 -4
- package/src/define.ts +3 -3
- package/src/deviceIdService.ts +3 -3
- package/src/enum.util.ts +1 -1
- package/src/env/buildInfo.ts +2 -2
- package/src/error/assert.ts +7 -7
- package/src/error/error.model.ts +2 -2
- package/src/error/error.util.ts +5 -5
- package/src/error/try.ts +5 -5
- package/src/error/tryCatch.ts +3 -3
- package/src/form.util.ts +1 -1
- package/src/http/fetcher.model.ts +5 -5
- package/src/http/fetcher.ts +20 -15
- package/src/index.ts +96 -96
- package/src/is.util.ts +2 -2
- package/src/iter/asyncIterable2.ts +3 -3
- package/src/iter/iterable2.ts +2 -2
- package/src/json-schema/from-data/generateJsonSchemaFromData.ts +2 -2
- package/src/json-schema/jsonSchema.cnst.ts +1 -1
- package/src/json-schema/jsonSchema.model.ts +1 -1
- package/src/json-schema/jsonSchema.util.ts +4 -4
- package/src/json-schema/jsonSchemaBuilder.ts +5 -5
- package/src/json-schema/jsonSchemas.ts +2 -2
- package/src/math/math.util.ts +2 -2
- package/src/math/stack.util.ts +1 -1
- package/src/number/number.util.ts +1 -1
- package/src/object/object.util.ts +3 -3
- package/src/object/sortObject.ts +1 -1
- package/src/promise/abortable.ts +1 -1
- package/src/promise/pDelay.ts +3 -3
- package/src/promise/pFilter.ts +1 -1
- package/src/promise/pMap.ts +2 -2
- package/src/promise/pQueue.ts +4 -4
- package/src/promise/pRetry.ts +2 -2
- package/src/promise/pTimeout.ts +4 -4
- package/src/semver.ts +3 -3
- package/src/string/case.ts +2 -2
- package/src/string/hash.util.ts +1 -1
- package/src/string/json.util.ts +2 -2
- package/src/string/lodash/words.ts +1 -1
- package/src/string/pupa.ts +2 -2
- package/src/string/readingTime.ts +1 -1
- package/src/string/safeJsonStringify.ts +1 -1
- package/src/string/stringify.ts +4 -4
- package/src/string/url.util.ts +1 -1
- package/src/time/time.util.ts +1 -1
- package/src/types.ts +15 -3
- package/src/web.ts +1 -1
- package/src/zod/index.ts +2 -2
- package/src/zod/zod.util.ts +1 -1
- package/dist-esm/abort.js +0 -12
- package/dist-esm/array/array.util.js +0 -458
- package/dist-esm/array/range.js +0 -34
- package/dist-esm/bot.js +0 -130
- package/dist-esm/browser/adminService.js +0 -94
- package/dist-esm/browser/analytics.util.js +0 -54
- package/dist-esm/browser/i18n/fetchTranslationLoader.js +0 -13
- package/dist-esm/browser/i18n/translation.service.js +0 -56
- package/dist-esm/browser/imageFitter.js +0 -65
- package/dist-esm/browser/script.util.js +0 -46
- package/dist-esm/browser/topbar.js +0 -135
- package/dist-esm/datetime/dateInterval.js +0 -80
- package/dist-esm/datetime/localDate.js +0 -719
- package/dist-esm/datetime/localTime.js +0 -996
- package/dist-esm/datetime/timeInterval.js +0 -88
- package/dist-esm/datetime/wallTime.js +0 -70
- package/dist-esm/decorators/asyncMemo.decorator.js +0 -111
- package/dist-esm/decorators/createPromiseDecorator.js +0 -82
- package/dist-esm/decorators/debounce.decorator.js +0 -17
- package/dist-esm/decorators/debounce.js +0 -114
- package/dist-esm/decorators/decorator.util.js +0 -31
- package/dist-esm/decorators/logMethod.decorator.js +0 -85
- package/dist-esm/decorators/memo.decorator.js +0 -80
- package/dist-esm/decorators/memo.util.js +0 -97
- package/dist-esm/decorators/memoFn.js +0 -29
- package/dist-esm/decorators/memoFnAsync.js +0 -35
- package/dist-esm/decorators/memoSimple.decorator.js +0 -55
- package/dist-esm/decorators/retry.decorator.js +0 -9
- package/dist-esm/decorators/swarmSafe.decorator.js +0 -38
- package/dist-esm/decorators/timeout.decorator.js +0 -19
- package/dist-esm/define.js +0 -109
- package/dist-esm/deviceIdService.js +0 -105
- package/dist-esm/enum.util.js +0 -157
- package/dist-esm/env/buildInfo.js +0 -19
- package/dist-esm/env.js +0 -19
- package/dist-esm/error/assert.js +0 -122
- package/dist-esm/error/error.model.js +0 -1
- package/dist-esm/error/error.util.js +0 -337
- package/dist-esm/error/errorMode.js +0 -20
- package/dist-esm/error/try.js +0 -105
- package/dist-esm/error/tryCatch.js +0 -41
- package/dist-esm/form.util.js +0 -16
- package/dist-esm/http/fetcher.js +0 -704
- package/dist-esm/http/fetcher.model.js +0 -3
- package/dist-esm/http/http.model.js +0 -1
- package/dist-esm/index.js +0 -96
- package/dist-esm/is.util.js +0 -70
- package/dist-esm/iter/asyncIterable2.js +0 -103
- package/dist-esm/iter/iterable2.js +0 -87
- package/dist-esm/json-schema/from-data/generateJsonSchemaFromData.js +0 -86
- package/dist-esm/json-schema/jsonSchema.cnst.js +0 -38
- package/dist-esm/json-schema/jsonSchema.model.js +0 -1
- package/dist-esm/json-schema/jsonSchema.util.js +0 -27
- package/dist-esm/json-schema/jsonSchemaBuilder.js +0 -352
- package/dist-esm/json-schema/jsonSchemas.js +0 -6
- package/dist-esm/log/commonLogger.js +0 -78
- package/dist-esm/math/accumulatingAverage.js +0 -32
- package/dist-esm/math/math.util.js +0 -85
- package/dist-esm/math/sma.js +0 -43
- package/dist-esm/math/stack.util.js +0 -82
- package/dist-esm/nanoid.js +0 -57
- package/dist-esm/number/createDeterministicRandom.js +0 -18
- package/dist-esm/number/number.util.js +0 -109
- package/dist-esm/object/deepEquals.js +0 -170
- package/dist-esm/object/map2.js +0 -21
- package/dist-esm/object/object.util.js +0 -435
- package/dist-esm/object/set2.js +0 -15
- package/dist-esm/object/sortObject.js +0 -21
- package/dist-esm/object/sortObjectDeep.js +0 -17
- package/dist-esm/polyfill.js +0 -6
- package/dist-esm/promise/abortable.js +0 -31
- package/dist-esm/promise/pDefer.js +0 -17
- package/dist-esm/promise/pDelay.js +0 -37
- package/dist-esm/promise/pFilter.js +0 -5
- package/dist-esm/promise/pHang.js +0 -6
- package/dist-esm/promise/pMap.js +0 -174
- package/dist-esm/promise/pProps.js +0 -20
- package/dist-esm/promise/pQueue.js +0 -101
- package/dist-esm/promise/pRetry.js +0 -64
- package/dist-esm/promise/pState.js +0 -14
- package/dist-esm/promise/pTimeout.js +0 -64
- package/dist-esm/semver.js +0 -149
- package/dist-esm/string/case.js +0 -24
- package/dist-esm/string/escape.js +0 -49
- package/dist-esm/string/hash.util.js +0 -67
- package/dist-esm/string/json.util.js +0 -46
- package/dist-esm/string/leven.js +0 -77
- package/dist-esm/string/lodash/unicodeWords.js +0 -68
- package/dist-esm/string/lodash/words.js +0 -31
- package/dist-esm/string/pupa.js +0 -54
- package/dist-esm/string/readingTime.js +0 -102
- package/dist-esm/string/regex.js +0 -6
- package/dist-esm/string/safeJsonStringify.js +0 -39
- package/dist-esm/string/slugify.js +0 -66
- package/dist-esm/string/string.util.js +0 -99
- package/dist-esm/string/stringify.js +0 -133
- package/dist-esm/string/url.util.js +0 -42
- package/dist-esm/time/time.util.js +0 -61
- package/dist-esm/typeFest.js +0 -2
- package/dist-esm/types.js +0 -59
- package/dist-esm/unit/size.util.js +0 -43
- package/dist-esm/web.js +0 -40
- package/dist-esm/zod/index.js +0 -4
- package/dist-esm/zod/zod.shared.schemas.js +0 -92
- package/dist-esm/zod/zod.util.js +0 -52
package/dist/string/pupa.d.ts
CHANGED
package/dist/string/pupa.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
|
|
4
3
|
Vendored:
|
|
@@ -11,11 +10,8 @@ Reasons:
|
|
|
11
10
|
2. ESM-only
|
|
12
11
|
|
|
13
12
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.pupa = pupa;
|
|
17
|
-
const escape_1 = require("./escape");
|
|
18
|
-
class MissingValueError extends Error {
|
|
13
|
+
import { htmlEscape } from './escape.js';
|
|
14
|
+
export class MissingValueError extends Error {
|
|
19
15
|
key;
|
|
20
16
|
constructor(key) {
|
|
21
17
|
super(`Missing a value for ${key ? `the placeholder: ${key}` : 'a placeholder'}`);
|
|
@@ -23,11 +19,10 @@ class MissingValueError extends Error {
|
|
|
23
19
|
this.name = 'MissingValueError';
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
|
-
exports.MissingValueError = MissingValueError;
|
|
27
22
|
/**
|
|
28
23
|
* API: https://github.com/sindresorhus/pupa
|
|
29
24
|
*/
|
|
30
|
-
function pupa(template, data, opt = {}) {
|
|
25
|
+
export function pupa(template, data, opt = {}) {
|
|
31
26
|
if (typeof template !== 'string') {
|
|
32
27
|
throw new TypeError(`Expected a \`string\` in the first argument, got \`${typeof template}\``);
|
|
33
28
|
}
|
|
@@ -49,7 +44,7 @@ function pupa(template, data, opt = {}) {
|
|
|
49
44
|
}
|
|
50
45
|
return String(transformedValue);
|
|
51
46
|
};
|
|
52
|
-
const composeHtmlEscape = (replacer) => (...args) =>
|
|
47
|
+
const composeHtmlEscape = (replacer) => (...args) => htmlEscape(replacer(...args));
|
|
53
48
|
// The regex tries to match either a number inside `{{ }}` or a valid JS identifier or key path.
|
|
54
49
|
const doubleBraceRegex = /{{(\d+|[a-z$_][\w\-$]*?(?:\.[\w\-$]*?)*?)}}/gi;
|
|
55
50
|
if (doubleBraceRegex.test(template)) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
|
|
4
3
|
Vendored from https://github.com/ngryman/reading-time
|
|
@@ -9,8 +8,6 @@ Reasons:
|
|
|
9
8
|
2. Streaming mode is not needed (but brings confusion when used in the Browser).
|
|
10
9
|
|
|
11
10
|
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.readingTime = readingTime;
|
|
14
11
|
function codeIsInRanges(num, arrayOfRanges) {
|
|
15
12
|
return arrayOfRanges.some(([lowerBound, upperBound]) => lowerBound <= num && num <= upperBound);
|
|
16
13
|
}
|
|
@@ -96,7 +93,7 @@ function readingTimeWithCount(words, options = {}) {
|
|
|
96
93
|
/**
|
|
97
94
|
* API: https://github.com/ngryman/reading-time
|
|
98
95
|
*/
|
|
99
|
-
function readingTime(text, options = {}) {
|
|
96
|
+
export function readingTime(text, options = {}) {
|
|
100
97
|
const words = countWords(text, options);
|
|
101
98
|
return {
|
|
102
99
|
...readingTimeWithCount(words, options),
|
package/dist/string/regex.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SIMPLE_EMAIL_REGEX = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Simple, intentionally not exhaustive regex to match an email address.
|
|
6
3
|
*
|
|
7
4
|
* Source: https://regexr.com/3e48o
|
|
8
5
|
*/
|
|
9
|
-
|
|
6
|
+
export const SIMPLE_EMAIL_REGEX = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._safeJsonStringify = _safeJsonStringify;
|
|
4
1
|
/**
|
|
5
2
|
* JSON.stringify that avoids circular references, prints them as [Circular ~]
|
|
6
3
|
*
|
|
7
4
|
* Based on: https://github.com/moll/json-stringify-safe/
|
|
8
5
|
*/
|
|
9
|
-
function _safeJsonStringify(obj, replacer, spaces, cycleReplacer) {
|
|
6
|
+
export function _safeJsonStringify(obj, replacer, spaces, cycleReplacer) {
|
|
10
7
|
try {
|
|
11
8
|
// Try native first (as it's ~3 times faster)
|
|
12
9
|
return JSON.stringify(obj, replacer, spaces);
|
package/dist/string/slugify.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Credit to (adopted from): https://github.com/sindresorhus/slugify/
|
|
3
|
-
|
|
4
|
-
exports._slugify = _slugify;
|
|
5
|
-
function _slugify(s, opt = {}) {
|
|
2
|
+
export function _slugify(s, opt = {}) {
|
|
6
3
|
opt = {
|
|
7
4
|
separator: '-',
|
|
8
5
|
lowercase: true,
|
|
@@ -1,43 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._capitalize = _capitalize;
|
|
4
|
-
exports._toUpperCase = _toUpperCase;
|
|
5
|
-
exports._toLowercase = _toLowercase;
|
|
6
|
-
exports._upperFirst = _upperFirst;
|
|
7
|
-
exports._lowerFirst = _lowerFirst;
|
|
8
|
-
exports._split = _split;
|
|
9
|
-
exports._removeWhitespace = _removeWhitespace;
|
|
10
|
-
exports._truncate = _truncate;
|
|
11
|
-
exports._truncateMiddle = _truncateMiddle;
|
|
12
|
-
exports._substringBefore = _substringBefore;
|
|
13
|
-
exports._substringBeforeLast = _substringBeforeLast;
|
|
14
|
-
exports._substringAfter = _substringAfter;
|
|
15
|
-
exports._substringAfterLast = _substringAfterLast;
|
|
16
|
-
exports._substringBetweenLast = _substringBetweenLast;
|
|
17
|
-
exports._nl2br = _nl2br;
|
|
18
1
|
/**
|
|
19
2
|
* Converts the first character of string to upper case and the remaining to lower case.
|
|
20
3
|
* Returns a type-safe capitalized string.
|
|
21
4
|
*/
|
|
22
|
-
function _capitalize(s = '') {
|
|
5
|
+
export function _capitalize(s = '') {
|
|
23
6
|
return (s.charAt(0).toUpperCase() + s.slice(1).toLowerCase());
|
|
24
7
|
}
|
|
25
8
|
/**
|
|
26
9
|
* Convert a string to a type-safe uppercase string.
|
|
27
10
|
*/
|
|
28
|
-
function _toUpperCase(s) {
|
|
11
|
+
export function _toUpperCase(s) {
|
|
29
12
|
return s.toUpperCase();
|
|
30
13
|
}
|
|
31
14
|
/**
|
|
32
15
|
* Convert a string to a type-safe lowercase string.
|
|
33
16
|
*/
|
|
34
|
-
function _toLowercase(s) {
|
|
17
|
+
export function _toLowercase(s) {
|
|
35
18
|
return s.toLowerCase();
|
|
36
19
|
}
|
|
37
|
-
function _upperFirst(s = '') {
|
|
20
|
+
export function _upperFirst(s = '') {
|
|
38
21
|
return (s.charAt(0).toUpperCase() + s.slice(1));
|
|
39
22
|
}
|
|
40
|
-
function _lowerFirst(s) {
|
|
23
|
+
export function _lowerFirst(s) {
|
|
41
24
|
return (s.charAt(0).toLowerCase() + s.slice(1));
|
|
42
25
|
}
|
|
43
26
|
/**
|
|
@@ -45,20 +28,20 @@ function _lowerFirst(s) {
|
|
|
45
28
|
*
|
|
46
29
|
* @return Returns the new array of string segments.
|
|
47
30
|
*/
|
|
48
|
-
function _split(str, separator, limit) {
|
|
31
|
+
export function _split(str, separator, limit) {
|
|
49
32
|
const parts = str.split(separator);
|
|
50
33
|
if (parts.length <= limit)
|
|
51
34
|
return parts;
|
|
52
35
|
return [...parts.slice(0, limit - 1), parts.slice(limit - 1).join(separator)];
|
|
53
36
|
}
|
|
54
|
-
function _removeWhitespace(s) {
|
|
37
|
+
export function _removeWhitespace(s) {
|
|
55
38
|
return s.replaceAll(/\s/g, '');
|
|
56
39
|
}
|
|
57
40
|
/**
|
|
58
41
|
* _.truncate('hi-diddly-ho there, neighborino')
|
|
59
42
|
* // => 'hi-diddly-ho there, neighbo...'
|
|
60
43
|
*/
|
|
61
|
-
function _truncate(s, maxLen, omission = '...') {
|
|
44
|
+
export function _truncate(s, maxLen, omission = '...') {
|
|
62
45
|
if (!s || s.length <= maxLen)
|
|
63
46
|
return s;
|
|
64
47
|
if (maxLen <= omission.length)
|
|
@@ -69,7 +52,7 @@ function _truncate(s, maxLen, omission = '...') {
|
|
|
69
52
|
* _.truncateMiddle('abcdefghijklmnopqrstuvwxyz', 10)
|
|
70
53
|
* // => 'abcd...xyz'
|
|
71
54
|
*/
|
|
72
|
-
function _truncateMiddle(s, maxLen, omission = '...') {
|
|
55
|
+
export function _truncateMiddle(s, maxLen, omission = '...') {
|
|
73
56
|
if (!s || s.length <= maxLen)
|
|
74
57
|
return s;
|
|
75
58
|
if (maxLen <= omission.length)
|
|
@@ -79,19 +62,19 @@ function _truncateMiddle(s, maxLen, omission = '...') {
|
|
|
79
62
|
return s.slice(0, mark1) + omission + s.slice(mark2);
|
|
80
63
|
}
|
|
81
64
|
// These functions are modeled after Kotlin's String API
|
|
82
|
-
function _substringBefore(s, delimiter) {
|
|
65
|
+
export function _substringBefore(s, delimiter) {
|
|
83
66
|
const pos = s.indexOf(delimiter);
|
|
84
67
|
return s.slice(0, pos !== -1 ? pos : undefined);
|
|
85
68
|
}
|
|
86
|
-
function _substringBeforeLast(s, delimiter) {
|
|
69
|
+
export function _substringBeforeLast(s, delimiter) {
|
|
87
70
|
const pos = s.lastIndexOf(delimiter);
|
|
88
71
|
return s.slice(0, pos !== -1 ? pos : undefined);
|
|
89
72
|
}
|
|
90
|
-
function _substringAfter(s, delimiter) {
|
|
73
|
+
export function _substringAfter(s, delimiter) {
|
|
91
74
|
const pos = s.indexOf(delimiter);
|
|
92
75
|
return pos !== -1 ? s.slice(pos + delimiter.length) : s;
|
|
93
76
|
}
|
|
94
|
-
function _substringAfterLast(s, delimiter) {
|
|
77
|
+
export function _substringAfterLast(s, delimiter) {
|
|
95
78
|
const pos = s.lastIndexOf(delimiter);
|
|
96
79
|
return pos !== -1 ? s.slice(pos + delimiter.length) : s;
|
|
97
80
|
}
|
|
@@ -104,13 +87,13 @@ function _substringAfterLast(s, delimiter) {
|
|
|
104
87
|
* _substringBetweenLast(s, '/', '.')
|
|
105
88
|
* // `someFile`
|
|
106
89
|
*/
|
|
107
|
-
function _substringBetweenLast(s, leftDelimiter, rightDelimiter) {
|
|
90
|
+
export function _substringBetweenLast(s, leftDelimiter, rightDelimiter) {
|
|
108
91
|
return _substringBefore(_substringAfterLast(s, leftDelimiter), rightDelimiter);
|
|
109
92
|
}
|
|
110
93
|
/**
|
|
111
94
|
* Converts `\n` (aka new-line) to `<br>`, to be presented in HTML.
|
|
112
95
|
* Keeps `\n`, so if it's printed in non-HTML environment it still looks ok-ish.
|
|
113
96
|
*/
|
|
114
|
-
function _nl2br(s) {
|
|
97
|
+
export function _nl2br(s) {
|
|
115
98
|
return s.replaceAll('\n', '<br>\n');
|
|
116
99
|
}
|
package/dist/string/stringify.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports._stringify = _stringify;
|
|
5
|
-
const error_util_1 = require("../error/error.util");
|
|
6
|
-
const json_util_1 = require("./json.util");
|
|
7
|
-
const safeJsonStringify_1 = require("./safeJsonStringify");
|
|
1
|
+
import { _isBackendErrorResponseObject, _isErrorLike, _isErrorObject } from '../error/error.util.js';
|
|
2
|
+
import { _jsonParseIfPossible } from './json.util.js';
|
|
3
|
+
import { _safeJsonStringify } from './safeJsonStringify.js';
|
|
8
4
|
const supportsAggregateError = typeof globalThis.AggregateError === 'function';
|
|
9
|
-
let globalStringifyFunction =
|
|
5
|
+
let globalStringifyFunction = _safeJsonStringify;
|
|
10
6
|
/**
|
|
11
7
|
* Allows to set Global "stringifyFunction" that will be used to "pretty-print" objects
|
|
12
8
|
* in various cases.
|
|
@@ -20,7 +16,7 @@ let globalStringifyFunction = safeJsonStringify_1._safeJsonStringify;
|
|
|
20
16
|
*
|
|
21
17
|
* It's recommended that this function is circular-reference-safe.
|
|
22
18
|
*/
|
|
23
|
-
function setGlobalStringifyFunction(fn) {
|
|
19
|
+
export function setGlobalStringifyFunction(fn) {
|
|
24
20
|
globalStringifyFunction = fn;
|
|
25
21
|
}
|
|
26
22
|
/**
|
|
@@ -41,7 +37,7 @@ function setGlobalStringifyFunction(fn) {
|
|
|
41
37
|
* Returns 'empty_string' if empty string is passed.
|
|
42
38
|
* Returns 'undefined' if undefined is passed (default util.inspect behavior).
|
|
43
39
|
*/
|
|
44
|
-
function _stringify(obj, opt = {}) {
|
|
40
|
+
export function _stringify(obj, opt = {}) {
|
|
45
41
|
if (obj === undefined)
|
|
46
42
|
return 'undefined';
|
|
47
43
|
if (obj === null)
|
|
@@ -52,14 +48,14 @@ function _stringify(obj, opt = {}) {
|
|
|
52
48
|
return obj.toString();
|
|
53
49
|
let s;
|
|
54
50
|
// Parse JSON string, if possible
|
|
55
|
-
obj =
|
|
51
|
+
obj = _jsonParseIfPossible(obj); // in case it's e.g non-pretty JSON, or even a stringified ErrorObject
|
|
56
52
|
//
|
|
57
53
|
// HttpErrorResponse
|
|
58
54
|
//
|
|
59
|
-
if (
|
|
55
|
+
if (_isBackendErrorResponseObject(obj)) {
|
|
60
56
|
return _stringify(obj.error, opt);
|
|
61
57
|
}
|
|
62
|
-
if (obj instanceof Error ||
|
|
58
|
+
if (obj instanceof Error || _isErrorLike(obj)) {
|
|
63
59
|
const { includeErrorCause = true } = opt;
|
|
64
60
|
//
|
|
65
61
|
// Error or ErrorLike
|
|
@@ -78,7 +74,7 @@ function _stringify(obj, opt = {}) {
|
|
|
78
74
|
// Error that has no `data`, but has `code` property
|
|
79
75
|
s += `\ncode: ${obj.code}`;
|
|
80
76
|
}
|
|
81
|
-
if (opt.includeErrorData &&
|
|
77
|
+
if (opt.includeErrorData && _isErrorObject(obj) && Object.keys(obj.data).length) {
|
|
82
78
|
s += '\n' + _stringify(obj.data, opt);
|
|
83
79
|
}
|
|
84
80
|
if (opt.includeErrorStack && obj.stack) {
|
package/dist/string/url.util.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._parseQueryString = _parseQueryString;
|
|
4
|
-
exports._toUrlOrNull = _toUrlOrNull;
|
|
5
1
|
/**
|
|
6
2
|
* Parses `location.search` string (e.g `?a=1&b=2`) into a StringMap, e.g:
|
|
7
3
|
* `{ a: '1', b: '2' }`
|
|
@@ -15,7 +11,7 @@ exports._toUrlOrNull = _toUrlOrNull;
|
|
|
15
11
|
*
|
|
16
12
|
* Goal of this function is to produce exactly same output as URLSearchParams would.
|
|
17
13
|
*/
|
|
18
|
-
function _parseQueryString(search) {
|
|
14
|
+
export function _parseQueryString(search) {
|
|
19
15
|
const qs = {};
|
|
20
16
|
search
|
|
21
17
|
.slice(search.startsWith('?') ? 1 : 0)
|
|
@@ -34,7 +30,7 @@ function _parseQueryString(search) {
|
|
|
34
30
|
*
|
|
35
31
|
* `null` was chosen instead of `undefined` in the return type union to make it easier to move to `URL.parse` if it ever becomes widely supported.
|
|
36
32
|
*/
|
|
37
|
-
function _toUrlOrNull(url, base) {
|
|
33
|
+
export function _toUrlOrNull(url, base) {
|
|
38
34
|
if (typeof url !== 'string')
|
|
39
35
|
return null;
|
|
40
36
|
try {
|
package/dist/time/time.util.d.ts
CHANGED
package/dist/time/time.util.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._blockTimer = _blockTimer;
|
|
4
|
-
exports._since = _since;
|
|
5
|
-
exports._ms = _ms;
|
|
6
1
|
/**
|
|
7
2
|
* using _ = blockTimer()
|
|
8
3
|
* // will log "took 1.234 sec" on dispose
|
|
@@ -12,7 +7,7 @@ exports._ms = _ms;
|
|
|
12
7
|
*
|
|
13
8
|
* @experimental
|
|
14
9
|
*/
|
|
15
|
-
function _blockTimer(name) {
|
|
10
|
+
export function _blockTimer(name) {
|
|
16
11
|
const started = Date.now();
|
|
17
12
|
return {
|
|
18
13
|
[Symbol.dispose]() {
|
|
@@ -23,7 +18,7 @@ function _blockTimer(name) {
|
|
|
23
18
|
/**
|
|
24
19
|
* Returns time passed since `from` until `until` (default to Date.now())
|
|
25
20
|
*/
|
|
26
|
-
function _since(from, until = Date.now()) {
|
|
21
|
+
export function _since(from, until = Date.now()) {
|
|
27
22
|
return _ms(until - from);
|
|
28
23
|
}
|
|
29
24
|
/**
|
|
@@ -35,7 +30,7 @@ function _since(from, until = Date.now()) {
|
|
|
35
30
|
* 59m2s
|
|
36
31
|
* 1h3m12s
|
|
37
32
|
*/
|
|
38
|
-
function _ms(millis) {
|
|
33
|
+
export function _ms(millis) {
|
|
39
34
|
// <1 sec
|
|
40
35
|
if (millis < 1000)
|
|
41
36
|
return `${Math.round(millis)} ms`;
|
package/dist/typeFest.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Promisable } from './typeFest';
|
|
1
|
+
import type { Promisable } from './typeFest.js';
|
|
2
2
|
declare const __brand: unique symbol;
|
|
3
3
|
interface Brand<B> {
|
|
4
4
|
[__brand]: B;
|
|
@@ -264,16 +264,20 @@ export type SemVerString = string;
|
|
|
264
264
|
* Named type for JSON.parse / JSON.stringify second argument
|
|
265
265
|
*/
|
|
266
266
|
export type Reviver = (this: any, key: string, value: any) => any;
|
|
267
|
+
/**
|
|
268
|
+
* Like _stringMapValues, but values are sorted.
|
|
269
|
+
*/
|
|
270
|
+
export declare function _stringMapValuesSorted<T>(map: StringMap<T>, mapper: Mapper<T, any>, dir?: SortDirection): T[];
|
|
267
271
|
/**
|
|
268
272
|
* Needed due to https://github.com/microsoft/TypeScript/issues/13778
|
|
269
273
|
* Only affects typings, no runtime effect.
|
|
270
274
|
*/
|
|
271
|
-
export declare const _stringMapValues: <T>(
|
|
275
|
+
export declare const _stringMapValues: <T>(map: StringMap<T>) => T[];
|
|
272
276
|
/**
|
|
273
277
|
* Needed due to https://github.com/microsoft/TypeScript/issues/13778
|
|
274
278
|
* Only affects typings, no runtime effect.
|
|
275
279
|
*/
|
|
276
|
-
export declare const _stringMapEntries: <T>(
|
|
280
|
+
export declare const _stringMapEntries: <T>(map: StringMap<T>) => [k: string, v: T][];
|
|
277
281
|
/**
|
|
278
282
|
* Alias of `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
|
|
279
283
|
* This is how TypeScript should work, actually.
|
package/dist/types.js
CHANGED
|
@@ -1,55 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._objectAssign = exports._objectEntries = exports._objectKeys = exports._stringMapEntries = exports._stringMapValues = exports._passNothingPredicate = exports._passthroughPredicate = exports._noop = exports._passUndefinedMapper = exports._passthroughMapper = exports.MISS = exports.SKIP = exports.END = void 0;
|
|
4
|
-
exports._typeCast = _typeCast;
|
|
1
|
+
import { _sortBy } from './array/array.util.js';
|
|
5
2
|
/**
|
|
6
3
|
* Symbol to indicate END of Sequence.
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
export const END = Symbol('END');
|
|
9
6
|
/**
|
|
10
7
|
* Symbol to indicate SKIP of item (e.g in AbortableMapper)
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export const SKIP = Symbol('SKIP');
|
|
13
10
|
/**
|
|
14
11
|
* Symbol to indicate cache miss.
|
|
15
12
|
* To distinguish from cache returning `undefined` or `null`.
|
|
16
13
|
*/
|
|
17
|
-
|
|
18
|
-
const _passthroughMapper = item => item;
|
|
19
|
-
|
|
20
|
-
const _passUndefinedMapper = () => undefined;
|
|
21
|
-
exports._passUndefinedMapper = _passUndefinedMapper;
|
|
14
|
+
export const MISS = Symbol('MISS');
|
|
15
|
+
export const _passthroughMapper = item => item;
|
|
16
|
+
export const _passUndefinedMapper = () => undefined;
|
|
22
17
|
/**
|
|
23
18
|
* Function that does nothings and returns `undefined`.
|
|
24
19
|
*/
|
|
25
|
-
const _noop = (..._args) => undefined;
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
export const _noop = (..._args) => undefined;
|
|
21
|
+
export const _passthroughPredicate = () => true;
|
|
22
|
+
export const _passNothingPredicate = () => false;
|
|
23
|
+
/**
|
|
24
|
+
* Like _stringMapValues, but values are sorted.
|
|
25
|
+
*/
|
|
26
|
+
export function _stringMapValuesSorted(map, mapper, dir = 'asc') {
|
|
27
|
+
return _sortBy(_stringMapValues(map), mapper, false, dir);
|
|
28
|
+
}
|
|
31
29
|
/**
|
|
32
30
|
* Needed due to https://github.com/microsoft/TypeScript/issues/13778
|
|
33
31
|
* Only affects typings, no runtime effect.
|
|
34
32
|
*/
|
|
35
|
-
|
|
33
|
+
export const _stringMapValues = Object.values;
|
|
36
34
|
/**
|
|
37
35
|
* Needed due to https://github.com/microsoft/TypeScript/issues/13778
|
|
38
36
|
* Only affects typings, no runtime effect.
|
|
39
37
|
*/
|
|
40
|
-
|
|
38
|
+
export const _stringMapEntries = Object.entries;
|
|
41
39
|
/**
|
|
42
40
|
* Alias of `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
|
|
43
41
|
* This is how TypeScript should work, actually.
|
|
44
42
|
*/
|
|
45
|
-
|
|
43
|
+
export const _objectKeys = Object.keys;
|
|
46
44
|
/**
|
|
47
45
|
* Alias of `Object.entries`, but returns better-typed output.
|
|
48
46
|
*
|
|
49
47
|
* So e.g you can use _objectEntries(obj).map([k, v] => {})
|
|
50
48
|
* and `k` will be `keyof obj` instead of generic `string`.
|
|
51
49
|
*/
|
|
52
|
-
|
|
50
|
+
export const _objectEntries = Object.entries;
|
|
53
51
|
/**
|
|
54
52
|
* Utility function that helps to cast *existing variable* to needed type T.
|
|
55
53
|
*
|
|
@@ -61,8 +59,8 @@ exports._objectEntries = Object.entries;
|
|
|
61
59
|
* err.data = {} // can be done, because it was casted
|
|
62
60
|
* }
|
|
63
61
|
*/
|
|
64
|
-
function _typeCast(v) { }
|
|
62
|
+
export function _typeCast(v) { }
|
|
65
63
|
/**
|
|
66
64
|
* Type-safe Object.assign that checks that part is indeed a Partial<T>
|
|
67
65
|
*/
|
|
68
|
-
|
|
66
|
+
export const _objectAssign = Object.assign;
|
package/dist/unit/size.util.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._gb = _gb;
|
|
4
|
-
exports._mb = _mb;
|
|
5
|
-
exports._kb = _kb;
|
|
6
|
-
exports._hb = _hb;
|
|
7
|
-
exports._hc = _hc;
|
|
8
|
-
function _gb(b) {
|
|
1
|
+
export function _gb(b) {
|
|
9
2
|
return Math.round(b / 1024 ** 3);
|
|
10
3
|
}
|
|
11
|
-
function _mb(b) {
|
|
4
|
+
export function _mb(b) {
|
|
12
5
|
return Math.round(b / 1024 ** 2);
|
|
13
6
|
}
|
|
14
|
-
function _kb(b) {
|
|
7
|
+
export function _kb(b) {
|
|
15
8
|
return Math.round(b / 1024);
|
|
16
9
|
}
|
|
17
10
|
/**
|
|
18
11
|
* Byte size to Human byte size string
|
|
19
12
|
*/
|
|
20
|
-
function _hb(b = 0) {
|
|
13
|
+
export function _hb(b = 0) {
|
|
21
14
|
if (b < 1024)
|
|
22
15
|
return `${Math.round(b)} byte(s)`;
|
|
23
16
|
if (b < 1024 ** 2)
|
|
@@ -35,7 +28,7 @@ function _hb(b = 0) {
|
|
|
35
28
|
* Helpful to print big numbers, as it adds `K` (kilo), `M` (mega), etc to make
|
|
36
29
|
* them more readable.
|
|
37
30
|
*/
|
|
38
|
-
function _hc(c = 0) {
|
|
31
|
+
export function _hc(c = 0) {
|
|
39
32
|
if (c < 10 ** 4)
|
|
40
33
|
return String(c);
|
|
41
34
|
if (c < 10 ** 6)
|
package/dist/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="es2022" preserve="true" />
|
|
2
2
|
/// <reference lib="dom" preserve="true" />
|
|
3
|
-
import type { StringMap } from './types';
|
|
3
|
+
import type { StringMap } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Implements WebStorage API by using in-memory storage.
|
|
6
6
|
* Can be useful in SSR environment or unit tests.
|
package/dist/web.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/// <reference lib="es2022" preserve="true" />
|
|
3
2
|
/// <reference lib="dom" preserve="true" />
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.InMemoryWebStorage = void 0;
|
|
6
3
|
/**
|
|
7
4
|
* Implements WebStorage API by using in-memory storage.
|
|
8
5
|
* Can be useful in SSR environment or unit tests.
|
|
@@ -15,7 +12,7 @@ exports.InMemoryWebStorage = void 0;
|
|
|
15
12
|
*
|
|
16
13
|
* @experimental
|
|
17
14
|
*/
|
|
18
|
-
class InMemoryWebStorage {
|
|
15
|
+
export class InMemoryWebStorage {
|
|
19
16
|
data;
|
|
20
17
|
constructor(data = {}) {
|
|
21
18
|
this.data = data;
|
|
@@ -42,4 +39,3 @@ class InMemoryWebStorage {
|
|
|
42
39
|
return Object.keys(this.data).length;
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
exports.InMemoryWebStorage = InMemoryWebStorage;
|
package/dist/zod/index.d.ts
CHANGED
package/dist/zod/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tslib_1.__exportStar(require("./zod.shared.schemas"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./zod.util"), exports);
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
Object.defineProperty(exports, "z", { enumerable: true, get: function () { return zod_1.z; } });
|
|
9
|
-
Object.defineProperty(exports, "ZodError", { enumerable: true, get: function () { return zod_1.ZodError; } });
|
|
10
|
-
Object.defineProperty(exports, "ZodSchema", { enumerable: true, get: function () { return zod_1.ZodSchema; } });
|
|
1
|
+
export * from './zod.shared.schemas.js';
|
|
2
|
+
export * from './zod.util.js';
|
|
3
|
+
import { z, ZodError, ZodSchema } from 'zod';
|
|
4
|
+
export { z, ZodError, ZodSchema };
|