@naturalcycles/js-lib 14.241.0 → 14.241.2

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.
Files changed (82) hide show
  1. package/dist/abort.js +1 -2
  2. package/dist/array/array.util.js +39 -40
  3. package/dist/array/range.js +3 -4
  4. package/dist/datetime/localDate.js +2 -2
  5. package/dist/datetime/localTime.js +2 -2
  6. package/dist/decorators/asyncMemo.decorator.js +2 -2
  7. package/dist/decorators/createPromiseDecorator.js +1 -2
  8. package/dist/decorators/debounce.decorator.js +2 -3
  9. package/dist/decorators/debounce.js +2 -3
  10. package/dist/decorators/decorator.util.js +3 -4
  11. package/dist/decorators/logMethod.decorator.js +1 -2
  12. package/dist/decorators/memo.decorator.js +2 -2
  13. package/dist/decorators/memoFn.js +1 -2
  14. package/dist/decorators/memoFnAsync.js +1 -2
  15. package/dist/decorators/retry.decorator.js +1 -2
  16. package/dist/decorators/timeout.decorator.js +1 -2
  17. package/dist/define.js +6 -7
  18. package/dist/enum.util.js +20 -21
  19. package/dist/env/buildInfo.js +1 -2
  20. package/dist/env.js +2 -3
  21. package/dist/error/assert.js +9 -10
  22. package/dist/error/error.util.js +11 -11
  23. package/dist/error/try.js +6 -7
  24. package/dist/error/tryCatch.js +2 -2
  25. package/dist/form.util.js +2 -3
  26. package/dist/http/fetcher.d.ts +3 -3
  27. package/dist/http/fetcher.js +5 -5
  28. package/dist/http/fetcher.model.d.ts +2 -2
  29. package/dist/http/fetcher.model.js +2 -2
  30. package/dist/is.util.js +7 -7
  31. package/dist/json-schema/from-data/generateJsonSchemaFromData.js +1 -2
  32. package/dist/json-schema/jsonSchema.util.js +1 -2
  33. package/dist/json-schema/jsonSchemaBuilder.d.ts +8 -9
  34. package/dist/log/commonLogger.js +5 -5
  35. package/dist/math/math.util.js +6 -7
  36. package/dist/number/createDeterministicRandom.js +1 -2
  37. package/dist/number/number.util.js +9 -10
  38. package/dist/object/deepEquals.js +3 -4
  39. package/dist/object/object.util.js +26 -27
  40. package/dist/object/sortObject.js +1 -2
  41. package/dist/object/sortObjectDeep.js +1 -2
  42. package/dist/polyfill.js +1 -2
  43. package/dist/promise/abortable.js +2 -2
  44. package/dist/promise/pDefer.js +1 -2
  45. package/dist/promise/pDelay.js +2 -3
  46. package/dist/promise/pFilter.js +1 -2
  47. package/dist/promise/pHang.js +1 -2
  48. package/dist/promise/pMap.js +1 -2
  49. package/dist/promise/pProps.js +1 -2
  50. package/dist/promise/pRetry.js +2 -3
  51. package/dist/promise/pState.js +1 -2
  52. package/dist/promise/pTimeout.js +2 -3
  53. package/dist/semver.js +2 -2
  54. package/dist/string/case.js +3 -4
  55. package/dist/string/escape.js +2 -3
  56. package/dist/string/hash.util.js +4 -5
  57. package/dist/string/json.util.js +3 -4
  58. package/dist/string/leven.js +1 -2
  59. package/dist/string/lodash/unicodeWords.js +1 -2
  60. package/dist/string/lodash/words.js +1 -2
  61. package/dist/string/pupa.js +2 -2
  62. package/dist/string/readingTime.js +1 -2
  63. package/dist/string/safeJsonStringify.js +1 -2
  64. package/dist/string/string.util.js +13 -14
  65. package/dist/string/stringify.js +2 -3
  66. package/dist/string/url.util.js +1 -2
  67. package/dist/time/time.util.js +3 -4
  68. package/dist/types.d.ts +0 -1
  69. package/dist/types.js +2 -2
  70. package/dist/unit/size.util.js +5 -6
  71. package/dist/web.d.ts +2 -2
  72. package/dist/web.js +2 -2
  73. package/dist/zod/zod.util.js +4 -4
  74. package/dist-esm/http/fetcher.js +3 -3
  75. package/dist-esm/http/fetcher.model.js +2 -2
  76. package/dist-esm/web.js +2 -2
  77. package/package.json +1 -1
  78. package/src/enum.util.ts +1 -1
  79. package/src/http/fetcher.model.ts +2 -2
  80. package/src/http/fetcher.ts +3 -3
  81. package/src/json-schema/from-data/generateJsonSchemaFromData.ts +1 -1
  82. package/src/web.ts +2 -2
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hashCode = exports.hashCode64 = exports.hashCode36 = exports.hashCode16 = void 0;
3
+ exports.hashCode16 = hashCode16;
4
+ exports.hashCode36 = hashCode36;
5
+ exports.hashCode64 = hashCode64;
6
+ exports.hashCode = hashCode;
4
7
  const BASE62 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
5
8
  // const BASE64 = BASE62 + '+/'
6
9
  const BASE64URL = BASE62 + '-_';
@@ -24,7 +27,6 @@ const BASE64URL = BASE62 + '-_';
24
27
  function hashCode16(s) {
25
28
  return hashCode(s).toString(16);
26
29
  }
27
- exports.hashCode16 = hashCode16;
28
30
  /**
29
31
  * Returns hashCode as "radix 36", using "Base36 alphabet".
30
32
  * 36 is used, because it's the maximum "radix" that Number.toString() can take.
@@ -34,7 +36,6 @@ exports.hashCode16 = hashCode16;
34
36
  function hashCode36(s) {
35
37
  return hashCode(s).toString(36);
36
38
  }
37
- exports.hashCode36 = hashCode36;
38
39
  /**
39
40
  * Returns hashCode as "radix 64", using Base64url alphabet.
40
41
  * See the hashCode16 for full description.
@@ -42,7 +43,6 @@ exports.hashCode36 = hashCode36;
42
43
  function hashCode64(s) {
43
44
  return numberToBase(hashCode(s), BASE64URL);
44
45
  }
45
- exports.hashCode64 = hashCode64;
46
46
  /**
47
47
  * Generates a stable integer hashCode for a given String.
48
48
  * Matches Java implementation (they say), except it ensures a positive Integer
@@ -59,7 +59,6 @@ function hashCode(s) {
59
59
  }
60
60
  return hash + 2147483647 + 1;
61
61
  }
62
- exports.hashCode = hashCode;
63
62
  /**
64
63
  * Source: https://gist.github.com/alkaruno/b84162bae5115f4ca99b
65
64
  */
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._jsonParse = exports._jsonParseOrUndefined = exports._jsonParseIfPossible = void 0;
3
+ exports._jsonParseIfPossible = _jsonParseIfPossible;
4
+ exports._jsonParseOrUndefined = _jsonParseOrUndefined;
5
+ exports._jsonParse = _jsonParse;
4
6
  const error_util_1 = require("../error/error.util");
5
7
  // const possibleJsonStartTokens = ['{', '[', '"']
6
8
  const DETECT_JSON = /^\s*[{["\-\d]/;
@@ -18,7 +20,6 @@ function _jsonParseIfPossible(obj, reviver) {
18
20
  }
19
21
  return obj;
20
22
  }
21
- exports._jsonParseIfPossible = _jsonParseIfPossible;
22
23
  /**
23
24
  * Convenience function that does JSON.parse, but doesn't throw on error,
24
25
  * instead - safely returns `undefined`.
@@ -32,7 +33,6 @@ function _jsonParseOrUndefined(obj, reviver) {
32
33
  catch { }
33
34
  }
34
35
  }
35
- exports._jsonParseOrUndefined = _jsonParseOrUndefined;
36
36
  /**
37
37
  * Same as JSON.parse, but throws JsonParseError:
38
38
  *
@@ -49,4 +49,3 @@ function _jsonParse(s, reviver) {
49
49
  });
50
50
  }
51
51
  }
52
- exports._jsonParse = _jsonParse;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._leven = void 0;
3
+ exports._leven = _leven;
4
4
  const array = [];
5
5
  const characterCodeCache = [];
6
6
  /* eslint-disable unicorn/prefer-code-point, no-bitwise */
@@ -78,4 +78,3 @@ function _leven(first, second, limit) {
78
78
  }
79
79
  return result;
80
80
  }
81
- exports._leven = _leven;
@@ -2,7 +2,7 @@
2
2
  // from: https://github.com/lodash/lodash/blob/master/.internal/unicodeWords.js
3
3
  /* eslint-disable */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.unicodeWords = void 0;
5
+ exports.unicodeWords = unicodeWords;
6
6
  /** Used to compose unicode character classes. */
7
7
  const rsAstralRange = '\\ud800-\\udfff';
8
8
  const rsComboMarksRange = '\\u0300-\\u036f';
@@ -69,4 +69,3 @@ const reUnicodeWords = new RegExp([
69
69
  function unicodeWords(s) {
70
70
  return s.match(reUnicodeWords);
71
71
  }
72
- exports.unicodeWords = unicodeWords;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // from: https://github.com/lodash/lodash/blob/master/words.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.words = void 0;
4
+ exports.words = words;
5
5
  /* eslint-disable */
6
6
  const unicodeWords_1 = require("./unicodeWords");
7
7
  const hasUnicodeWord = RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);
@@ -31,4 +31,3 @@ function words(s, pattern) {
31
31
  }
32
32
  return s.match(pattern) || [];
33
33
  }
34
- exports.words = words;
@@ -12,7 +12,8 @@ Reasons:
12
12
 
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.pupa = exports.MissingValueError = void 0;
15
+ exports.MissingValueError = void 0;
16
+ exports.pupa = pupa;
16
17
  const escape_1 = require("./escape");
17
18
  class MissingValueError extends Error {
18
19
  constructor(key) {
@@ -57,4 +58,3 @@ function pupa(template, data, opt = {}) {
57
58
  const braceRegex = /{(\d+|[a-z$_][\w\-$]*?(?:\.[\w\-$]*?)*?)}/gi;
58
59
  return template.replaceAll(braceRegex, replace);
59
60
  }
60
- exports.pupa = pupa;
@@ -10,7 +10,7 @@ Reasons:
10
10
 
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.readingTime = void 0;
13
+ exports.readingTime = readingTime;
14
14
  function codeIsInRanges(num, arrayOfRanges) {
15
15
  return arrayOfRanges.some(([lowerBound, upperBound]) => lowerBound <= num && num <= upperBound);
16
16
  }
@@ -103,4 +103,3 @@ function readingTime(text, options = {}) {
103
103
  words,
104
104
  };
105
105
  }
106
- exports.readingTime = readingTime;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._safeJsonStringify = void 0;
3
+ exports._safeJsonStringify = _safeJsonStringify;
4
4
  /**
5
5
  * JSON.stringify that avoids circular references, prints them as [Circular ~]
6
6
  *
@@ -16,7 +16,6 @@ function _safeJsonStringify(obj, replacer, spaces, cycleReplacer) {
16
16
  return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
17
17
  }
18
18
  }
19
- exports._safeJsonStringify = _safeJsonStringify;
20
19
  /* eslint-disable @typescript-eslint/no-unused-expressions, no-bitwise, no-implicit-coercion */
21
20
  function serializer(replacer, cycleReplacer) {
22
21
  const stack = [];
@@ -1,21 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._nl2br = exports._substringBetweenLast = exports._substringAfterLast = exports._substringAfter = exports._substringBeforeLast = exports._substringBefore = exports._truncateMiddle = exports._truncate = exports._removeWhitespace = exports._split = exports._lowerFirst = exports._upperFirst = exports._capitalize = void 0;
3
+ exports._capitalize = _capitalize;
4
+ exports._upperFirst = _upperFirst;
5
+ exports._lowerFirst = _lowerFirst;
6
+ exports._split = _split;
7
+ exports._removeWhitespace = _removeWhitespace;
8
+ exports._truncate = _truncate;
9
+ exports._truncateMiddle = _truncateMiddle;
10
+ exports._substringBefore = _substringBefore;
11
+ exports._substringBeforeLast = _substringBeforeLast;
12
+ exports._substringAfter = _substringAfter;
13
+ exports._substringAfterLast = _substringAfterLast;
14
+ exports._substringBetweenLast = _substringBetweenLast;
15
+ exports._nl2br = _nl2br;
4
16
  /**
5
17
  * Converts the first character of string to upper case and the remaining to lower case.
6
18
  */
7
19
  function _capitalize(s = '') {
8
20
  return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
9
21
  }
10
- exports._capitalize = _capitalize;
11
22
  function _upperFirst(s = '') {
12
23
  return s.charAt(0).toUpperCase() + s.slice(1);
13
24
  }
14
- exports._upperFirst = _upperFirst;
15
25
  function _lowerFirst(s) {
16
26
  return s.charAt(0).toLowerCase() + s.slice(1);
17
27
  }
18
- exports._lowerFirst = _lowerFirst;
19
28
  /**
20
29
  * Like String.split(), but with limit, returning the tail together with last element.
21
30
  *
@@ -27,11 +36,9 @@ function _split(str, separator, limit) {
27
36
  return parts;
28
37
  return [...parts.slice(0, limit - 1), parts.slice(limit - 1).join(separator)];
29
38
  }
30
- exports._split = _split;
31
39
  function _removeWhitespace(s) {
32
40
  return s.replaceAll(/\s/g, '');
33
41
  }
34
- exports._removeWhitespace = _removeWhitespace;
35
42
  /**
36
43
  * _.truncate('hi-diddly-ho there, neighborino')
37
44
  * // => 'hi-diddly-ho there, neighbo...'
@@ -43,7 +50,6 @@ function _truncate(s, maxLen, omission = '...') {
43
50
  return omission;
44
51
  return s.slice(0, maxLen - omission.length) + omission;
45
52
  }
46
- exports._truncate = _truncate;
47
53
  /**
48
54
  * _.truncateMiddle('abcdefghijklmnopqrstuvwxyz', 10)
49
55
  * // => 'abcd...xyz'
@@ -57,28 +63,23 @@ function _truncateMiddle(s, maxLen, omission = '...') {
57
63
  const mark2 = s.length - Math.floor((maxLen - omission.length) / 2);
58
64
  return s.slice(0, mark1) + omission + s.slice(mark2);
59
65
  }
60
- exports._truncateMiddle = _truncateMiddle;
61
66
  // These functions are modeled after Kotlin's String API
62
67
  function _substringBefore(s, delimiter) {
63
68
  const pos = s.indexOf(delimiter);
64
69
  return s.slice(0, pos !== -1 ? pos : undefined);
65
70
  }
66
- exports._substringBefore = _substringBefore;
67
71
  function _substringBeforeLast(s, delimiter) {
68
72
  const pos = s.lastIndexOf(delimiter);
69
73
  return s.slice(0, pos !== -1 ? pos : undefined);
70
74
  }
71
- exports._substringBeforeLast = _substringBeforeLast;
72
75
  function _substringAfter(s, delimiter) {
73
76
  const pos = s.indexOf(delimiter);
74
77
  return pos !== -1 ? s.slice(pos + delimiter.length) : s;
75
78
  }
76
- exports._substringAfter = _substringAfter;
77
79
  function _substringAfterLast(s, delimiter) {
78
80
  const pos = s.lastIndexOf(delimiter);
79
81
  return pos !== -1 ? s.slice(pos + delimiter.length) : s;
80
82
  }
81
- exports._substringAfterLast = _substringAfterLast;
82
83
  /**
83
84
  * Returns the substring between LAST `leftDelimiter` and then FIRST `rightDelimiter`.
84
85
  *
@@ -91,7 +92,6 @@ exports._substringAfterLast = _substringAfterLast;
91
92
  function _substringBetweenLast(s, leftDelimiter, rightDelimiter) {
92
93
  return _substringBefore(_substringAfterLast(s, leftDelimiter), rightDelimiter);
93
94
  }
94
- exports._substringBetweenLast = _substringBetweenLast;
95
95
  /**
96
96
  * Converts `\n` (aka new-line) to `<br>`, to be presented in HTML.
97
97
  * Keeps `\n`, so if it's printed in non-HTML environment it still looks ok-ish.
@@ -99,4 +99,3 @@ exports._substringBetweenLast = _substringBetweenLast;
99
99
  function _nl2br(s) {
100
100
  return s.replaceAll('\n', '<br>\n');
101
101
  }
102
- exports._nl2br = _nl2br;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._stringify = exports.setGlobalStringifyFunction = void 0;
3
+ exports.setGlobalStringifyFunction = setGlobalStringifyFunction;
4
+ exports._stringify = _stringify;
4
5
  const error_util_1 = require("../error/error.util");
5
6
  const json_util_1 = require("./json.util");
6
7
  const safeJsonStringify_1 = require("./safeJsonStringify");
@@ -22,7 +23,6 @@ let globalStringifyFunction = safeJsonStringify_1._safeJsonStringify;
22
23
  function setGlobalStringifyFunction(fn) {
23
24
  globalStringifyFunction = fn;
24
25
  }
25
- exports.setGlobalStringifyFunction = setGlobalStringifyFunction;
26
26
  /**
27
27
  * Inspired by `_inspect` from nodejs-lib, which is based on util.inpect that is not available in the Browser.
28
28
  * Potentially can do this (with extra 2Kb gz size): https://github.com/deecewan/browser-util-inspect
@@ -135,4 +135,3 @@ function _stringify(obj, opt = {}) {
135
135
  }
136
136
  return s;
137
137
  }
138
- exports._stringify = _stringify;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._parseQueryString = void 0;
3
+ exports._parseQueryString = _parseQueryString;
4
4
  /**
5
5
  * Parses `location.search` string (e.g `?a=1&b=2`) into a StringMap, e.g:
6
6
  * `{ a: '1', b: '2' }`
@@ -27,4 +27,3 @@ function _parseQueryString(search) {
27
27
  });
28
28
  return qs;
29
29
  }
30
- exports._parseQueryString = _parseQueryString;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._ms = exports._since = exports._blockTimer = void 0;
3
+ exports._blockTimer = _blockTimer;
4
+ exports._since = _since;
5
+ exports._ms = _ms;
4
6
  /**
5
7
  * using _ = blockTimer()
6
8
  * // will log "took 1.234 sec" on dispose
@@ -18,14 +20,12 @@ function _blockTimer(name) {
18
20
  },
19
21
  };
20
22
  }
21
- exports._blockTimer = _blockTimer;
22
23
  /**
23
24
  * Returns time passed since `from` until `until` (default to Date.now())
24
25
  */
25
26
  function _since(from, until = Date.now()) {
26
27
  return _ms(until - from);
27
28
  }
28
- exports._since = _since;
29
29
  /**
30
30
  * Returns, e.g:
31
31
  * 125 ms
@@ -62,4 +62,3 @@ function _ms(millis) {
62
62
  const days = Math.floor(hrs / 24);
63
63
  return `${days} days`;
64
64
  }
65
- exports._ms = _ms;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Promisable } from './typeFest';
3
2
  /**
4
3
  * Map from String to String (or <T>).
package/dist/types.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._objectAssign = exports._typeCast = 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;
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;
4
5
  /**
5
6
  * Symbol to indicate END of Sequence.
6
7
  */
@@ -61,7 +62,6 @@ exports._objectEntries = Object.entries;
61
62
  * }
62
63
  */
63
64
  function _typeCast(v) { }
64
- exports._typeCast = _typeCast;
65
65
  /**
66
66
  * Type-safe Object.assign that checks that part is indeed a Partial<T>
67
67
  */
@@ -1,18 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._hc = exports._hb = exports._kb = exports._mb = exports._gb = void 0;
3
+ exports._gb = _gb;
4
+ exports._mb = _mb;
5
+ exports._kb = _kb;
6
+ exports._hb = _hb;
7
+ exports._hc = _hc;
4
8
  function _gb(b) {
5
9
  return Math.round(b / 1024 ** 3);
6
10
  }
7
- exports._gb = _gb;
8
11
  function _mb(b) {
9
12
  return Math.round(b / 1024 ** 2);
10
13
  }
11
- exports._mb = _mb;
12
14
  function _kb(b) {
13
15
  return Math.round(b / 1024);
14
16
  }
15
- exports._kb = _kb;
16
17
  /**
17
18
  * Byte size to Human byte size string
18
19
  */
@@ -29,7 +30,6 @@ function _hb(b = 0) {
29
30
  return `${(b / 1024 ** 4).toPrecision(3)} Tb`;
30
31
  return `${Math.round(b / 1024 ** 4)} Tb`;
31
32
  }
32
- exports._hb = _hb;
33
33
  /**
34
34
  * hc stands for "human count", similar to "human bytes" `_hb` function.
35
35
  * Helpful to print big numbers, as it adds `K` (kilo), `M` (mega), etc to make
@@ -48,4 +48,3 @@ function _hc(c = 0) {
48
48
  return (c / 10 ** 12).toPrecision(3) + ' T'; // trillion
49
49
  return Math.round(c / 10 ** 12) + ' T';
50
50
  }
51
- exports._hc = _hc;
package/dist/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /// <reference lib="es2022" />
2
- /// <reference lib="dom" />
1
+ /// <reference lib="es2022" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
3
  import { StringMap } from './types';
4
4
  /**
5
5
  * Implements WebStorage API by using in-memory storage.
package/dist/web.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- /// <reference lib="es2022"/>
3
- /// <reference lib="dom"/>
2
+ /// <reference lib="es2022" preserve="true" />
3
+ /// <reference lib="dom" preserve="true" />
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.InMemoryWebStorage = void 0;
6
6
  /**
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZodValidationError = exports.zSafeValidate = exports.zValidate = exports.zIsValid = void 0;
3
+ exports.ZodValidationError = void 0;
4
+ exports.zIsValid = zIsValid;
5
+ exports.zValidate = zValidate;
6
+ exports.zSafeValidate = zSafeValidate;
4
7
  const zod_1 = require("zod");
5
8
  const stringify_1 = require("../string/stringify");
6
9
  function zIsValid(value, schema) {
7
10
  const { success } = schema.safeParse(value);
8
11
  return success;
9
12
  }
10
- exports.zIsValid = zIsValid;
11
13
  function zValidate(value, schema) {
12
14
  const r = zSafeValidate(value, schema);
13
15
  if (r.success) {
@@ -15,7 +17,6 @@ function zValidate(value, schema) {
15
17
  }
16
18
  throw r.error;
17
19
  }
18
- exports.zValidate = zValidate;
19
20
  function zSafeValidate(value, schema) {
20
21
  const r = schema.safeParse(value);
21
22
  if (r.success) {
@@ -26,7 +27,6 @@ function zSafeValidate(value, schema) {
26
27
  error: new ZodValidationError(r.error.issues, value, schema),
27
28
  };
28
29
  }
29
- exports.zSafeValidate = zSafeValidate;
30
30
  class ZodValidationError extends zod_1.ZodError {
31
31
  constructor(issues, value, schema) {
32
32
  super(issues);
@@ -1,6 +1,6 @@
1
- /// <reference lib="es2022"/>
2
- /// <reference lib="dom"/>
3
- /// <reference lib="dom.iterable"/>
1
+ /// <reference lib="es2022" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
+ /// <reference lib="dom.iterable" preserve="true" />
4
4
  var _a;
5
5
  import { isServerSide } from '../env';
6
6
  import { _assertErrorClassOrRethrow, _assertIsError } from '../error/assert';
@@ -1,3 +1,3 @@
1
- /// <reference lib="es2022"/>
2
- /// <reference lib="dom"/>
1
+ /// <reference lib="es2022" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
3
  export {};
package/dist-esm/web.js CHANGED
@@ -1,5 +1,5 @@
1
- /// <reference lib="es2022"/>
2
- /// <reference lib="dom"/>
1
+ /// <reference lib="es2022" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
3
  /**
4
4
  * Implements WebStorage API by using in-memory storage.
5
5
  * Can be useful in SSR environment or unit tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.241.0",
3
+ "version": "14.241.2",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build-prod": "build-prod-esm-cjs",
package/src/enum.util.ts CHANGED
@@ -4,7 +4,7 @@ import type { NumberEnum, StringEnum } from './types'
4
4
  * Returns all String keys of a number-enum.
5
5
  */
6
6
  export function _numberEnumKeys<T extends NumberEnum>(en: T): (keyof T)[] {
7
- return Object.values(en).filter(k => typeof k === 'string') as string[]
7
+ return Object.values(en).filter(k => typeof k === 'string')
8
8
  }
9
9
 
10
10
  /**
@@ -1,5 +1,5 @@
1
- /// <reference lib="es2022"/>
2
- /// <reference lib="dom"/>
1
+ /// <reference lib="es2022" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
3
 
4
4
  import type { CommonLogger } from '../log/commonLogger'
5
5
  import type { Promisable } from '../typeFest'
@@ -1,6 +1,6 @@
1
- /// <reference lib="es2022"/>
2
- /// <reference lib="dom"/>
3
- /// <reference lib="dom.iterable"/>
1
+ /// <reference lib="es2022" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
+ /// <reference lib="dom.iterable" preserve="true" />
4
4
 
5
5
  import { isServerSide } from '../env'
6
6
  import { _assertErrorClassOrRethrow, _assertIsError } from '../error/assert'
@@ -32,7 +32,7 @@ function objectToJsonSchema(rows: AnyObject[]): JsonSchemaObject {
32
32
  rows.forEach(r => {
33
33
  Object.keys(r).forEach(key => {
34
34
  typesByKey[key] ||= new Set<Type>()
35
- typesByKey[key]!.add(getTypeOfValue(r[key]))
35
+ typesByKey[key].add(getTypeOfValue(r[key]))
36
36
  })
37
37
  })
38
38
 
package/src/web.ts CHANGED
@@ -1,5 +1,5 @@
1
- /// <reference lib="es2022"/>
2
- /// <reference lib="dom"/>
1
+ /// <reference lib="es2022" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
3
 
4
4
  import { StringMap } from './types'
5
5