@naturalcycles/js-lib 14.189.0 → 14.191.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.
Files changed (36) hide show
  1. package/dist/datetime/localDate.d.ts +5 -5
  2. package/dist/datetime/localDate.js +15 -15
  3. package/dist/datetime/localTime.d.ts +5 -5
  4. package/dist/datetime/localTime.js +14 -14
  5. package/dist/decorators/logMethod.decorator.js +1 -1
  6. package/dist/error/assert.js +2 -6
  7. package/dist/error/error.util.d.ts +1 -1
  8. package/dist/error/error.util.js +2 -2
  9. package/dist/error/try.js +3 -3
  10. package/dist/http/fetcher.js +2 -2
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/string/{stringifyAny.d.ts → stringify.d.ts} +9 -5
  14. package/dist/string/{stringifyAny.js → stringify.js} +14 -10
  15. package/dist/zod/zod.util.js +2 -2
  16. package/dist-esm/datetime/localDate.js +15 -15
  17. package/dist-esm/datetime/localTime.js +14 -14
  18. package/dist-esm/decorators/logMethod.decorator.js +2 -2
  19. package/dist-esm/error/assert.js +3 -7
  20. package/dist-esm/error/error.util.js +3 -3
  21. package/dist-esm/error/try.js +3 -3
  22. package/dist-esm/http/fetcher.js +2 -2
  23. package/dist-esm/index.js +1 -1
  24. package/dist-esm/string/{stringifyAny.js → stringify.js} +12 -8
  25. package/dist-esm/zod/zod.util.js +2 -2
  26. package/package.json +2 -2
  27. package/src/datetime/localDate.ts +15 -15
  28. package/src/datetime/localTime.ts +14 -14
  29. package/src/decorators/logMethod.decorator.ts +2 -2
  30. package/src/error/assert.ts +3 -7
  31. package/src/error/error.util.ts +3 -3
  32. package/src/error/try.ts +3 -3
  33. package/src/http/fetcher.ts +2 -2
  34. package/src/index.ts +1 -1
  35. package/src/string/{stringifyAny.ts → stringify.ts} +14 -9
  36. package/src/zod/zod.util.ts +2 -2
@@ -93,16 +93,16 @@ export declare class LocalDate {
93
93
  * a.diff(b) means "a minus b"
94
94
  */
95
95
  diff(d: LocalDateInput, unit: LocalDateUnit): number;
96
- add(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
97
- subtract(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
96
+ plus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
98
97
  /**
99
- * Alias to subtract
98
+ * @deprecated use `minus` instead
100
99
  */
100
+ subtract(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
101
101
  minus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
102
102
  /**
103
- * Alias to add
103
+ * @deprecated use `plus` instead
104
104
  */
105
- plus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
105
+ add(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
106
106
  startOf(unit: LocalDateUnitStrict): LocalDate;
107
107
  endOf(unit: LocalDateUnitStrict): LocalDate;
108
108
  static getYearLength(year: number): number;
@@ -117,12 +117,12 @@ class LocalDate {
117
117
  // ok
118
118
  }
119
119
  else {
120
- current.add(1, stepUnit, true);
120
+ current.plus(1, stepUnit, true);
121
121
  }
122
122
  const incl2 = incl[1] === ']';
123
123
  while (current.isBefore($max, incl2)) {
124
124
  dates.push(current);
125
- current = current.add(step, stepUnit);
125
+ current = current.plus(step, stepUnit);
126
126
  }
127
127
  return dates;
128
128
  }
@@ -189,13 +189,13 @@ class LocalDate {
189
189
  * Third argument allows to override "today".
190
190
  */
191
191
  isOlderThan(n, unit, today) {
192
- return this.isBefore(LocalDate.of(today || new Date()).add(-n, unit));
192
+ return this.isBefore(LocalDate.of(today || new Date()).plus(-n, unit));
193
193
  }
194
194
  /**
195
195
  * Checks if this localDate is same or older (<=) than "today" by X units.
196
196
  */
197
197
  isSameOrOlderThan(n, unit, today) {
198
- return this.isSameOrBefore(LocalDate.of(today || new Date()).add(-n, unit));
198
+ return this.isSameOrBefore(LocalDate.of(today || new Date()).plus(-n, unit));
199
199
  }
200
200
  /**
201
201
  * Checks if this localDate is younger (>) than "today" by X units.
@@ -207,13 +207,13 @@ class LocalDate {
207
207
  * Third argument allows to override "today".
208
208
  */
209
209
  isYoungerThan(n, unit, today) {
210
- return this.isAfter(LocalDate.of(today || new Date()).add(-n, unit));
210
+ return this.isAfter(LocalDate.of(today || new Date()).plus(-n, unit));
211
211
  }
212
212
  /**
213
213
  * Checks if this localDate is same or younger (>=) than "today" by X units.
214
214
  */
215
215
  isSameOrYoungerThan(n, unit, today) {
216
- return this.isSameOrAfter(LocalDate.of(today || new Date()).add(-n, unit));
216
+ return this.isSameOrAfter(LocalDate.of(today || new Date()).plus(-n, unit));
217
217
  }
218
218
  /**
219
219
  * Returns 1 if this > d
@@ -297,7 +297,7 @@ class LocalDate {
297
297
  }
298
298
  return days * sign || 0;
299
299
  }
300
- add(num, unit, mutate = false) {
300
+ plus(num, unit, mutate = false) {
301
301
  let { $day, $month, $year } = this;
302
302
  if (unit === 'week') {
303
303
  num *= 7;
@@ -361,20 +361,20 @@ class LocalDate {
361
361
  }
362
362
  return new LocalDate($year, $month, $day);
363
363
  }
364
- subtract(num, unit, mutate = false) {
365
- return this.add(-num, unit, mutate);
366
- }
367
364
  /**
368
- * Alias to subtract
365
+ * @deprecated use `minus` instead
369
366
  */
367
+ subtract(num, unit, mutate = false) {
368
+ return this.plus(-num, unit, mutate);
369
+ }
370
370
  minus(num, unit, mutate = false) {
371
- return this.add(-num, unit, mutate);
371
+ return this.plus(-num, unit, mutate);
372
372
  }
373
373
  /**
374
- * Alias to add
374
+ * @deprecated use `plus` instead
375
375
  */
376
- plus(num, unit, mutate = false) {
377
- return this.add(num, unit, mutate);
376
+ add(num, unit, mutate = false) {
377
+ return this.plus(num, unit, mutate);
378
378
  }
379
379
  startOf(unit) {
380
380
  if (unit === 'day')
@@ -70,16 +70,16 @@ export declare class LocalTime {
70
70
  second(): number;
71
71
  second(v: number): LocalTime;
72
72
  setComponents(c: Partial<LocalTimeComponents>, mutate?: boolean): LocalTime;
73
- add(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
74
- subtract(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
73
+ plus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
75
74
  /**
76
- * Alias to subtract.
75
+ * @deprecated use `minus` instead
77
76
  */
77
+ subtract(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
78
78
  minus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
79
79
  /**
80
- * Alias to add.
80
+ * @deprecated use `plus` instead
81
81
  */
82
- plus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
82
+ add(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
83
83
  absDiff(other: LocalTimeInput, unit: LocalTimeUnit): number;
84
84
  diff(other: LocalTimeInput, unit: LocalTimeUnit): number;
85
85
  startOf(unit: LocalTimeUnit, mutate?: boolean): LocalTime;
@@ -172,7 +172,7 @@ class LocalTime {
172
172
  return dow;
173
173
  }
174
174
  (0, assert_1._assert)(VALID_DAYS_OF_WEEK.has(v), `Invalid dayOfWeek: ${v}`);
175
- return this.add(v - dow, 'day');
175
+ return this.plus(v - dow, 'day');
176
176
  }
177
177
  hour(v) {
178
178
  return v === undefined ? this.get('hour') : this.set('hour', v);
@@ -200,7 +200,7 @@ class LocalTime {
200
200
  }
201
201
  return mutate ? this : new LocalTime(d);
202
202
  }
203
- add(num, unit, mutate = false) {
203
+ plus(num, unit, mutate = false) {
204
204
  if (unit === 'week') {
205
205
  num *= 7;
206
206
  unit = 'day';
@@ -211,20 +211,20 @@ class LocalTime {
211
211
  }
212
212
  return this.set(unit, this.get(unit) + num, mutate);
213
213
  }
214
- subtract(num, unit, mutate = false) {
215
- return this.add(num * -1, unit, mutate);
216
- }
217
214
  /**
218
- * Alias to subtract.
215
+ * @deprecated use `minus` instead
219
216
  */
217
+ subtract(num, unit, mutate = false) {
218
+ return this.plus(num * -1, unit, mutate);
219
+ }
220
220
  minus(num, unit, mutate = false) {
221
- return this.add(num * -1, unit, mutate);
221
+ return this.plus(num * -1, unit, mutate);
222
222
  }
223
223
  /**
224
- * Alias to add.
224
+ * @deprecated use `plus` instead
225
225
  */
226
- plus(num, unit, mutate = false) {
227
- return this.add(num, unit, mutate);
226
+ add(num, unit, mutate = false) {
227
+ return this.plus(num, unit, mutate);
228
228
  }
229
229
  absDiff(other, unit) {
230
230
  return Math.abs(this.diff(other, unit));
@@ -379,13 +379,13 @@ class LocalTime {
379
379
  * Third argument allows to override "now".
380
380
  */
381
381
  isOlderThan(n, unit, now) {
382
- return this.isBefore(LocalTime.of(now ?? new Date()).add(-n, unit));
382
+ return this.isBefore(LocalTime.of(now ?? new Date()).plus(-n, unit));
383
383
  }
384
384
  /**
385
385
  * Checks if this localTime is same or older (<=) than "now" by X units.
386
386
  */
387
387
  isSameOrOlderThan(n, unit, now) {
388
- return this.isSameOrBefore(LocalTime.of(now ?? new Date()).add(-n, unit));
388
+ return this.isSameOrBefore(LocalTime.of(now ?? new Date()).plus(-n, unit));
389
389
  }
390
390
  /**
391
391
  * Checks if this localTime is younger (>) than "now" by X units.
@@ -397,13 +397,13 @@ class LocalTime {
397
397
  * Third argument allows to override "now".
398
398
  */
399
399
  isYoungerThan(n, unit, now) {
400
- return this.isAfter(LocalTime.of(now ?? new Date()).add(-n, unit));
400
+ return this.isAfter(LocalTime.of(now ?? new Date()).plus(-n, unit));
401
401
  }
402
402
  /**
403
403
  * Checks if this localTime is same or younger (>=) than "now" by X units.
404
404
  */
405
405
  isSameOrYoungerThan(n, unit, now) {
406
- return this.isSameOrAfter(LocalTime.of(now ?? new Date()).add(-n, unit));
406
+ return this.isSameOrAfter(LocalTime.of(now ?? new Date()).plus(-n, unit));
407
407
  }
408
408
  /**
409
409
  * Returns 1 if this > d
@@ -27,7 +27,7 @@ function _LogMethod(opt = {}) {
27
27
  let { logResultFn } = opt;
28
28
  if (!logResultFn) {
29
29
  if (logResult) {
30
- logResultFn = r => ['result:', (0, __1._stringifyAny)(r)];
30
+ logResultFn = r => ['result:', (0, __1._stringify)(r)];
31
31
  }
32
32
  else if (logResultLength) {
33
33
  logResultFn = r => (Array.isArray(r) ? [`result: ${r.length} items`] : []);
@@ -36,7 +36,7 @@ exports._assert = _assert;
36
36
  function _assertEquals(actual, expected, message, errorData) {
37
37
  if (actual !== expected) {
38
38
  const msg = message ||
39
- ['not equal', `expected: ${(0, __1._stringifyAny)(expected)}`, `got : ${(0, __1._stringifyAny)(actual)}`]
39
+ ['not equal', `expected: ${(0, __1._stringify)(expected)}`, `got : ${(0, __1._stringify)(actual)}`]
40
40
  .filter(Boolean)
41
41
  .join('\n');
42
42
  throw new __1.AssertionError(msg, {
@@ -55,11 +55,7 @@ exports._assertEquals = _assertEquals;
55
55
  function _assertDeepEquals(actual, expected, message, errorData) {
56
56
  if (!(0, __1._deepEquals)(actual, expected)) {
57
57
  const msg = message ||
58
- [
59
- `not deeply equal`,
60
- `expected: ${(0, __1._stringifyAny)(expected)}`,
61
- `got : ${(0, __1._stringifyAny)(actual)}`,
62
- ]
58
+ [`not deeply equal`, `expected: ${(0, __1._stringify)(expected)}`, `got : ${(0, __1._stringify)(actual)}`]
63
59
  .filter(Boolean)
64
60
  .join('\n');
65
61
  throw new __1.AssertionError(msg, {
@@ -12,7 +12,7 @@ export declare function _anyToError<ERROR_TYPE extends Error = Error>(o: any, er
12
12
  * Converts "anything" to ErrorObject.
13
13
  * Detects if it's HttpErrorResponse, HttpErrorObject, ErrorObject, Error, etc..
14
14
  * If object is Error - Error.message will be used.
15
- * Objects (not Errors) get converted to prettified JSON string (via `_stringifyAny`).
15
+ * Objects (not Errors) get converted to prettified JSON string (via `_stringify`).
16
16
  */
17
17
  export declare function _anyToErrorObject<DATA_TYPE extends ErrorData = ErrorData>(o: any, errorData?: Partial<DATA_TYPE>): ErrorObject<DATA_TYPE>;
18
18
  export declare function _errorLikeToErrorObject<DATA_TYPE extends ErrorData = ErrorData>(e: AppError<DATA_TYPE> | Error | ErrorLike): ErrorObject<DATA_TYPE>;
@@ -34,7 +34,7 @@ exports._anyToError = _anyToError;
34
34
  * Converts "anything" to ErrorObject.
35
35
  * Detects if it's HttpErrorResponse, HttpErrorObject, ErrorObject, Error, etc..
36
36
  * If object is Error - Error.message will be used.
37
- * Objects (not Errors) get converted to prettified JSON string (via `_stringifyAny`).
37
+ * Objects (not Errors) get converted to prettified JSON string (via `_stringify`).
38
38
  */
39
39
  function _anyToErrorObject(o, errorData) {
40
40
  let eo;
@@ -57,7 +57,7 @@ function _anyToErrorObject(o, errorData) {
57
57
  // so, fair to return `data: {}` in the end
58
58
  // Also we're sure it includes no "error name", e.g no `Error: ...`,
59
59
  // so, fair to include `name: 'Error'`
60
- const message = (0, __1._stringifyAny)(o);
60
+ const message = (0, __1._stringify)(o);
61
61
  eo = {
62
62
  name: 'Error',
63
63
  message,
package/dist/error/try.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._expectedErrorString = exports.pExpectedErrorString = exports.pExpectedError = exports._expectedError = exports.pTry = exports._try = void 0;
4
- const stringifyAny_1 = require("../string/stringifyAny");
4
+ const stringify_1 = require("../string/stringify");
5
5
  const assert_1 = require("./assert");
6
6
  const error_util_1 = require("./error.util");
7
7
  /**
@@ -101,7 +101,7 @@ exports.pExpectedError = pExpectedError;
101
101
  */
102
102
  async function pExpectedErrorString(promise, errorClass) {
103
103
  const err = await pExpectedError(promise, errorClass);
104
- return (0, stringifyAny_1._stringifyAny)(err);
104
+ return (0, stringify_1._stringify)(err);
105
105
  }
106
106
  exports.pExpectedErrorString = pExpectedErrorString;
107
107
  /**
@@ -109,6 +109,6 @@ exports.pExpectedErrorString = pExpectedErrorString;
109
109
  */
110
110
  function _expectedErrorString(fn, errorClass) {
111
111
  const err = _expectedError(fn, errorClass);
112
- return (0, stringifyAny_1._stringifyAny)(err);
112
+ return (0, stringify_1._stringify)(err);
113
113
  }
114
114
  exports._expectedErrorString = _expectedErrorString;
@@ -12,7 +12,7 @@ const object_util_1 = require("../object/object.util");
12
12
  const pDelay_1 = require("../promise/pDelay");
13
13
  const pTimeout_1 = require("../promise/pTimeout");
14
14
  const json_util_1 = require("../string/json.util");
15
- const stringifyAny_1 = require("../string/stringifyAny");
15
+ const stringify_1 = require("../string/stringify");
16
16
  const time_util_1 = require("../time/time.util");
17
17
  const http_model_1 = require("./http.model");
18
18
  const acceptByResponseType = {
@@ -392,7 +392,7 @@ class Fetcher {
392
392
  .filter(Boolean)
393
393
  .join(' ') + '\n',
394
394
  // We're stringifying the error here, otherwise Sentry shows it as [object Object]
395
- (0, stringifyAny_1._stringifyAny)(res.err.cause || res.err));
395
+ (0, stringify_1._stringify)(res.err.cause || res.err));
396
396
  }
397
397
  if (retryStatus.retryStopped)
398
398
  return;
package/dist/index.d.ts CHANGED
@@ -50,7 +50,7 @@ export * from './string/string.util';
50
50
  export * from './string/readingTime';
51
51
  export * from './string/escape';
52
52
  export * from './string/pupa';
53
- export * from './string/stringifyAny';
53
+ export * from './string/stringify';
54
54
  export * from './time/time.util';
55
55
  export * from './is.util';
56
56
  export * from './typeFest';
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ tslib_1.__exportStar(require("./string/string.util"), exports);
54
54
  tslib_1.__exportStar(require("./string/readingTime"), exports);
55
55
  tslib_1.__exportStar(require("./string/escape"), exports);
56
56
  tslib_1.__exportStar(require("./string/pupa"), exports);
57
- tslib_1.__exportStar(require("./string/stringifyAny"), exports);
57
+ tslib_1.__exportStar(require("./string/stringify"), exports);
58
58
  tslib_1.__exportStar(require("./time/time.util"), exports);
59
59
  tslib_1.__exportStar(require("./is.util"), exports);
60
60
  tslib_1.__exportStar(require("./typeFest"), exports);
@@ -3,7 +3,7 @@ import type { Reviver } from '../types';
3
3
  * Allows to set Global "stringifyFunction" that will be used to "pretty-print" objects
4
4
  * in various cases.
5
5
  *
6
- * Used, for example, by _stringifyAny() to pretty-print objects/arrays.
6
+ * Used, for example, by _stringify() to pretty-print objects/arrays.
7
7
  *
8
8
  * Defaults to _safeJsonStringify.
9
9
  *
@@ -14,7 +14,7 @@ import type { Reviver } from '../types';
14
14
  */
15
15
  export declare function setGlobalStringifyFunction(fn: JsonStringifyFunction): void;
16
16
  export type JsonStringifyFunction = (obj: any, reviver?: Reviver, space?: number) => string;
17
- export interface StringifyAnyOptions {
17
+ export interface StringifyOptions {
18
18
  /**
19
19
  * @default 10_000
20
20
  * Default limit is less than in Node, cause it's likely to be used e.g in Browser alert()
@@ -47,13 +47,13 @@ export interface StringifyAnyOptions {
47
47
  stringifyFn?: JsonStringifyFunction;
48
48
  }
49
49
  /**
50
- * Inspired by inspectAny from nodejs-lib, which is based on util.inpect that is not available in the Browser.
50
+ * Inspired by `_inspect` from nodejs-lib, which is based on util.inpect that is not available in the Browser.
51
51
  * Potentially can do this (with extra 2Kb gz size): https://github.com/deecewan/browser-util-inspect
52
52
  *
53
53
  * Transforms ANY to human-readable string (via JSON.stringify pretty).
54
54
  * Safe (no error throwing).
55
55
  *
56
- * Correclty prints Errors, AppErrors, ErrorObjects: error.message + \n + stringifyAny(error.data)
56
+ * Correctly prints Errors, AppErrors, ErrorObjects: error.message + \n + _stringify(error.data)
57
57
  *
58
58
  * Enforces max length (default to 1000, pass 0 to skip it).
59
59
  *
@@ -64,4 +64,8 @@ export interface StringifyAnyOptions {
64
64
  * Returns 'empty_string' if empty string is passed.
65
65
  * Returns 'undefined' if undefined is passed (default util.inspect behavior).
66
66
  */
67
- export declare function _stringifyAny(obj: any, opt?: StringifyAnyOptions): string;
67
+ export declare function _stringify(obj: any, opt?: StringifyOptions): string;
68
+ /**
69
+ * @deprecated renamed to _stringify
70
+ */
71
+ export declare const _stringifyAny: typeof _stringify;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._stringifyAny = exports.setGlobalStringifyFunction = void 0;
3
+ exports._stringifyAny = exports._stringify = exports.setGlobalStringifyFunction = void 0;
4
4
  const error_util_1 = require("../error/error.util");
5
5
  const json_util_1 = require("./json.util");
6
6
  const safeJsonStringify_1 = require("./safeJsonStringify");
@@ -10,7 +10,7 @@ let globalStringifyFunction = safeJsonStringify_1._safeJsonStringify;
10
10
  * Allows to set Global "stringifyFunction" that will be used to "pretty-print" objects
11
11
  * in various cases.
12
12
  *
13
- * Used, for example, by _stringifyAny() to pretty-print objects/arrays.
13
+ * Used, for example, by _stringify() to pretty-print objects/arrays.
14
14
  *
15
15
  * Defaults to _safeJsonStringify.
16
16
  *
@@ -24,13 +24,13 @@ function setGlobalStringifyFunction(fn) {
24
24
  }
25
25
  exports.setGlobalStringifyFunction = setGlobalStringifyFunction;
26
26
  /**
27
- * Inspired by inspectAny from nodejs-lib, which is based on util.inpect that is not available in the Browser.
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
29
29
  *
30
30
  * Transforms ANY to human-readable string (via JSON.stringify pretty).
31
31
  * Safe (no error throwing).
32
32
  *
33
- * Correclty prints Errors, AppErrors, ErrorObjects: error.message + \n + stringifyAny(error.data)
33
+ * Correctly prints Errors, AppErrors, ErrorObjects: error.message + \n + _stringify(error.data)
34
34
  *
35
35
  * Enforces max length (default to 1000, pass 0 to skip it).
36
36
  *
@@ -41,7 +41,7 @@ exports.setGlobalStringifyFunction = setGlobalStringifyFunction;
41
41
  * Returns 'empty_string' if empty string is passed.
42
42
  * Returns 'undefined' if undefined is passed (default util.inspect behavior).
43
43
  */
44
- function _stringifyAny(obj, opt = {}) {
44
+ function _stringify(obj, opt = {}) {
45
45
  if (obj === undefined)
46
46
  return 'undefined';
47
47
  if (obj === null)
@@ -57,7 +57,7 @@ function _stringifyAny(obj, opt = {}) {
57
57
  // HttpErrorResponse
58
58
  //
59
59
  if ((0, error_util_1._isBackendErrorResponseObject)(obj)) {
60
- return _stringifyAny(obj.error, opt);
60
+ return _stringify(obj.error, opt);
61
61
  }
62
62
  if (obj instanceof Error || (0, error_util_1._isErrorLike)(obj)) {
63
63
  const { includeErrorCause = true } = opt;
@@ -79,7 +79,7 @@ function _stringifyAny(obj, opt = {}) {
79
79
  s += `\ncode: ${obj.code}`;
80
80
  }
81
81
  if (opt.includeErrorData && (0, error_util_1._isErrorObject)(obj) && Object.keys(obj.data).length) {
82
- s += '\n' + _stringifyAny(obj.data, opt);
82
+ s += '\n' + _stringify(obj.data, opt);
83
83
  }
84
84
  if (opt.includeErrorStack && obj.stack) {
85
85
  // Here we're using the previously-generated "title line" (e.g "Error: some_message"),
@@ -94,11 +94,11 @@ function _stringifyAny(obj, opt = {}) {
94
94
  s = [
95
95
  s,
96
96
  `${obj.errors.length} error(s):`,
97
- ...obj.errors.map((err, i) => `${i + 1}. ${_stringifyAny(err, opt)}`),
97
+ ...obj.errors.map((err, i) => `${i + 1}. ${_stringify(err, opt)}`),
98
98
  ].join('\n');
99
99
  }
100
100
  if (obj.cause && includeErrorCause) {
101
- s = s + '\nCaused by: ' + _stringifyAny(obj.cause, opt);
101
+ s = s + '\nCaused by: ' + _stringify(obj.cause, opt);
102
102
  }
103
103
  }
104
104
  else if (typeof obj === 'string') {
@@ -129,4 +129,8 @@ function _stringifyAny(obj, opt = {}) {
129
129
  }
130
130
  return s;
131
131
  }
132
- exports._stringifyAny = _stringifyAny;
132
+ exports._stringify = _stringify;
133
+ /**
134
+ * @deprecated renamed to _stringify
135
+ */
136
+ exports._stringifyAny = _stringify;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZodValidationError = exports.zSafeValidate = exports.zValidate = exports.zIsValid = void 0;
4
4
  const zod_1 = require("zod");
5
- const stringifyAny_1 = require("../string/stringifyAny");
5
+ const stringify_1 = require("../string/stringify");
6
6
  function zIsValid(value, schema) {
7
7
  const { success } = schema.safeParse(value);
8
8
  return success;
@@ -48,7 +48,7 @@ class ZodValidationError extends zod_1.ZodError {
48
48
  `Invalid ${objectTitle}`,
49
49
  '',
50
50
  'Input:',
51
- (0, stringifyAny_1._stringifyAny)(this.value),
51
+ (0, stringify_1._stringify)(this.value),
52
52
  this.issues.length > 1 ? `\n${this.issues.length} issues:` : '',
53
53
  ...this.issues.slice(0, 100).map(i => {
54
54
  return [i.path.join('.'), i.message].filter(Boolean).join(': ');
@@ -114,12 +114,12 @@ export class LocalDate {
114
114
  // ok
115
115
  }
116
116
  else {
117
- current.add(1, stepUnit, true);
117
+ current.plus(1, stepUnit, true);
118
118
  }
119
119
  const incl2 = incl[1] === ']';
120
120
  while (current.isBefore($max, incl2)) {
121
121
  dates.push(current);
122
- current = current.add(step, stepUnit);
122
+ current = current.plus(step, stepUnit);
123
123
  }
124
124
  return dates;
125
125
  }
@@ -186,13 +186,13 @@ export class LocalDate {
186
186
  * Third argument allows to override "today".
187
187
  */
188
188
  isOlderThan(n, unit, today) {
189
- return this.isBefore(LocalDate.of(today || new Date()).add(-n, unit));
189
+ return this.isBefore(LocalDate.of(today || new Date()).plus(-n, unit));
190
190
  }
191
191
  /**
192
192
  * Checks if this localDate is same or older (<=) than "today" by X units.
193
193
  */
194
194
  isSameOrOlderThan(n, unit, today) {
195
- return this.isSameOrBefore(LocalDate.of(today || new Date()).add(-n, unit));
195
+ return this.isSameOrBefore(LocalDate.of(today || new Date()).plus(-n, unit));
196
196
  }
197
197
  /**
198
198
  * Checks if this localDate is younger (>) than "today" by X units.
@@ -204,13 +204,13 @@ export class LocalDate {
204
204
  * Third argument allows to override "today".
205
205
  */
206
206
  isYoungerThan(n, unit, today) {
207
- return this.isAfter(LocalDate.of(today || new Date()).add(-n, unit));
207
+ return this.isAfter(LocalDate.of(today || new Date()).plus(-n, unit));
208
208
  }
209
209
  /**
210
210
  * Checks if this localDate is same or younger (>=) than "today" by X units.
211
211
  */
212
212
  isSameOrYoungerThan(n, unit, today) {
213
- return this.isSameOrAfter(LocalDate.of(today || new Date()).add(-n, unit));
213
+ return this.isSameOrAfter(LocalDate.of(today || new Date()).plus(-n, unit));
214
214
  }
215
215
  /**
216
216
  * Returns 1 if this > d
@@ -294,7 +294,7 @@ export class LocalDate {
294
294
  }
295
295
  return days * sign || 0;
296
296
  }
297
- add(num, unit, mutate = false) {
297
+ plus(num, unit, mutate = false) {
298
298
  let { $day, $month, $year } = this;
299
299
  if (unit === 'week') {
300
300
  num *= 7;
@@ -358,20 +358,20 @@ export class LocalDate {
358
358
  }
359
359
  return new LocalDate($year, $month, $day);
360
360
  }
361
- subtract(num, unit, mutate = false) {
362
- return this.add(-num, unit, mutate);
363
- }
364
361
  /**
365
- * Alias to subtract
362
+ * @deprecated use `minus` instead
366
363
  */
364
+ subtract(num, unit, mutate = false) {
365
+ return this.plus(-num, unit, mutate);
366
+ }
367
367
  minus(num, unit, mutate = false) {
368
- return this.add(-num, unit, mutate);
368
+ return this.plus(-num, unit, mutate);
369
369
  }
370
370
  /**
371
- * Alias to add
371
+ * @deprecated use `plus` instead
372
372
  */
373
- plus(num, unit, mutate = false) {
374
- return this.add(num, unit, mutate);
373
+ add(num, unit, mutate = false) {
374
+ return this.plus(num, unit, mutate);
375
375
  }
376
376
  startOf(unit) {
377
377
  if (unit === 'day')
@@ -169,7 +169,7 @@ export class LocalTime {
169
169
  return dow;
170
170
  }
171
171
  _assert(VALID_DAYS_OF_WEEK.has(v), `Invalid dayOfWeek: ${v}`);
172
- return this.add(v - dow, 'day');
172
+ return this.plus(v - dow, 'day');
173
173
  }
174
174
  hour(v) {
175
175
  return v === undefined ? this.get('hour') : this.set('hour', v);
@@ -198,7 +198,7 @@ export class LocalTime {
198
198
  }
199
199
  return mutate ? this : new LocalTime(d);
200
200
  }
201
- add(num, unit, mutate = false) {
201
+ plus(num, unit, mutate = false) {
202
202
  if (unit === 'week') {
203
203
  num *= 7;
204
204
  unit = 'day';
@@ -209,20 +209,20 @@ export class LocalTime {
209
209
  }
210
210
  return this.set(unit, this.get(unit) + num, mutate);
211
211
  }
212
- subtract(num, unit, mutate = false) {
213
- return this.add(num * -1, unit, mutate);
214
- }
215
212
  /**
216
- * Alias to subtract.
213
+ * @deprecated use `minus` instead
217
214
  */
215
+ subtract(num, unit, mutate = false) {
216
+ return this.plus(num * -1, unit, mutate);
217
+ }
218
218
  minus(num, unit, mutate = false) {
219
- return this.add(num * -1, unit, mutate);
219
+ return this.plus(num * -1, unit, mutate);
220
220
  }
221
221
  /**
222
- * Alias to add.
222
+ * @deprecated use `plus` instead
223
223
  */
224
- plus(num, unit, mutate = false) {
225
- return this.add(num, unit, mutate);
224
+ add(num, unit, mutate = false) {
225
+ return this.plus(num, unit, mutate);
226
226
  }
227
227
  absDiff(other, unit) {
228
228
  return Math.abs(this.diff(other, unit));
@@ -377,13 +377,13 @@ export class LocalTime {
377
377
  * Third argument allows to override "now".
378
378
  */
379
379
  isOlderThan(n, unit, now) {
380
- return this.isBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
380
+ return this.isBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
381
381
  }
382
382
  /**
383
383
  * Checks if this localTime is same or older (<=) than "now" by X units.
384
384
  */
385
385
  isSameOrOlderThan(n, unit, now) {
386
- return this.isSameOrBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
386
+ return this.isSameOrBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
387
387
  }
388
388
  /**
389
389
  * Checks if this localTime is younger (>) than "now" by X units.
@@ -395,13 +395,13 @@ export class LocalTime {
395
395
  * Third argument allows to override "now".
396
396
  */
397
397
  isYoungerThan(n, unit, now) {
398
- return this.isAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
398
+ return this.isAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
399
399
  }
400
400
  /**
401
401
  * Checks if this localTime is same or younger (>=) than "now" by X units.
402
402
  */
403
403
  isSameOrYoungerThan(n, unit, now) {
404
- return this.isSameOrAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
404
+ return this.isSameOrAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
405
405
  }
406
406
  /**
407
407
  * Returns 1 if this > d
@@ -1,4 +1,4 @@
1
- import { SimpleMovingAverage, _stringifyAny, _assert } from '..';
1
+ import { SimpleMovingAverage, _stringify, _assert } from '..';
2
2
  import { _ms } from '../time/time.util';
3
3
  import { _getArgsSignature, _getMethodSignature } from './decorator.util';
4
4
  /**
@@ -24,7 +24,7 @@ export function _LogMethod(opt = {}) {
24
24
  let { logResultFn } = opt;
25
25
  if (!logResultFn) {
26
26
  if (logResult) {
27
- logResultFn = r => ['result:', _stringifyAny(r)];
27
+ logResultFn = r => ['result:', _stringify(r)];
28
28
  }
29
29
  else if (logResultLength) {
30
30
  logResultFn = r => (Array.isArray(r) ? [`result: ${r.length} items`] : []);