@naturalcycles/js-lib 14.108.0 → 14.109.1

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 (101) hide show
  1. package/dist/array/array.util.d.ts +2 -2
  2. package/dist/datetime/dateInterval.d.ts +2 -1
  3. package/dist/datetime/localDate.d.ts +1 -1
  4. package/dist/datetime/localTime.d.ts +3 -2
  5. package/dist/datetime/timeInterval.d.ts +4 -3
  6. package/dist/decorators/asyncMemo.decorator.d.ts +2 -2
  7. package/dist/decorators/debounce.d.ts +1 -1
  8. package/dist/decorators/debounce.decorator.d.ts +1 -1
  9. package/dist/decorators/decorator.util.d.ts +1 -1
  10. package/dist/decorators/logMethod.decorator.d.ts +1 -1
  11. package/dist/decorators/memo.decorator.d.ts +2 -2
  12. package/dist/decorators/memo.util.d.ts +1 -1
  13. package/dist/decorators/memoFn.d.ts +2 -2
  14. package/dist/decorators/memoFnAsync.d.ts +2 -2
  15. package/dist/decorators/memoSimple.decorator.d.ts +1 -1
  16. package/dist/decorators/retry.decorator.d.ts +1 -1
  17. package/dist/decorators/timeout.decorator.d.ts +1 -1
  18. package/dist/enum.util.d.ts +1 -1
  19. package/dist/error/app.error.d.ts +1 -1
  20. package/dist/error/assert.d.ts +1 -1
  21. package/dist/error/error.util.d.ts +2 -1
  22. package/dist/error/http.error.d.ts +1 -1
  23. package/dist/error/try.d.ts +1 -1
  24. package/dist/error/tryCatch.d.ts +2 -2
  25. package/dist/index.d.ts +27 -19
  26. package/dist/index.js +0 -1
  27. package/dist/is.util.d.ts +2 -2
  28. package/dist/json-schema/from-data/generateJsonSchemaFromData.d.ts +1 -1
  29. package/dist/json-schema/jsonSchema.cnst.d.ts +1 -1
  30. package/dist/json-schema/jsonSchema.model.d.ts +1 -1
  31. package/dist/json-schema/jsonSchema.util.d.ts +1 -1
  32. package/dist/json-schema/jsonSchemaBuilder.d.ts +2 -2
  33. package/dist/json-schema/jsonSchemas.d.ts +1 -1
  34. package/dist/lazy.d.ts +1 -1
  35. package/dist/object/object.util.d.ts +2 -2
  36. package/dist/object/sortObject.d.ts +1 -1
  37. package/dist/promise/pFilter.d.ts +1 -1
  38. package/dist/promise/pMap.d.ts +2 -1
  39. package/dist/promise/pQueue.d.ts +1 -1
  40. package/dist/promise/pRetry.d.ts +1 -1
  41. package/dist/promise/pTimeout.d.ts +2 -2
  42. package/dist/seq/seq.d.ts +2 -1
  43. package/dist/string/readingTime.d.ts +13 -2
  44. package/dist/string/safeJsonStringify.d.ts +1 -1
  45. package/dist/string/stringifyAny.d.ts +1 -1
  46. package/dist/string/url.util.d.ts +1 -1
  47. package/dist/types.d.ts +4 -6
  48. package/dist/types.js +3 -14
  49. package/dist-esm/error/error.util.js +1 -1
  50. package/dist-esm/index.js +2 -3
  51. package/dist-esm/json-schema/from-data/generateJsonSchemaFromData.js +1 -1
  52. package/dist-esm/json-schema/jsonSchemaBuilder.js +1 -1
  53. package/dist-esm/seq/seq.js +1 -1
  54. package/dist-esm/types.js +3 -11
  55. package/package.json +2 -4
  56. package/src/array/array.util.ts +2 -2
  57. package/src/datetime/dateInterval.ts +2 -1
  58. package/src/datetime/localDate.ts +1 -1
  59. package/src/datetime/localTime.ts +3 -2
  60. package/src/datetime/timeInterval.ts +4 -3
  61. package/src/decorators/asyncMemo.decorator.ts +4 -3
  62. package/src/decorators/debounce.decorator.ts +2 -1
  63. package/src/decorators/debounce.ts +1 -1
  64. package/src/decorators/decorator.util.ts +1 -1
  65. package/src/decorators/logMethod.decorator.ts +2 -1
  66. package/src/decorators/memo.decorator.ts +4 -3
  67. package/src/decorators/memo.util.ts +1 -1
  68. package/src/decorators/memoFn.ts +3 -2
  69. package/src/decorators/memoFnAsync.ts +3 -2
  70. package/src/decorators/memoSimple.decorator.ts +3 -2
  71. package/src/decorators/retry.decorator.ts +2 -1
  72. package/src/decorators/timeout.decorator.ts +2 -1
  73. package/src/enum.util.ts +1 -1
  74. package/src/error/app.error.ts +1 -1
  75. package/src/error/assert.ts +2 -1
  76. package/src/error/error.util.ts +2 -4
  77. package/src/error/http.error.ts +1 -1
  78. package/src/error/try.ts +1 -1
  79. package/src/error/tryCatch.ts +3 -2
  80. package/src/index.ts +27 -27
  81. package/src/is.util.ts +2 -2
  82. package/src/json-schema/from-data/generateJsonSchemaFromData.ts +2 -3
  83. package/src/json-schema/jsonSchema.cnst.ts +1 -1
  84. package/src/json-schema/jsonSchema.model.ts +1 -1
  85. package/src/json-schema/jsonSchema.util.ts +1 -1
  86. package/src/json-schema/jsonSchemaBuilder.ts +3 -5
  87. package/src/json-schema/jsonSchemas.ts +1 -1
  88. package/src/lazy.ts +1 -1
  89. package/src/object/object.util.ts +2 -2
  90. package/src/object/sortObject.ts +2 -1
  91. package/src/promise/pFilter.ts +1 -1
  92. package/src/promise/pMap.ts +2 -1
  93. package/src/promise/pQueue.ts +3 -2
  94. package/src/promise/pRetry.ts +2 -1
  95. package/src/promise/pTimeout.ts +2 -2
  96. package/src/seq/seq.ts +2 -3
  97. package/src/string/readingTime.ts +14 -2
  98. package/src/string/safeJsonStringify.ts +1 -1
  99. package/src/string/stringifyAny.ts +1 -1
  100. package/src/string/url.util.ts +1 -1
  101. package/src/types.ts +4 -12
@@ -1,5 +1,5 @@
1
- import { RecursiveArray } from '../lodash.types';
2
- import { FalsyValue, Mapper, Predicate, StringMap } from '../types';
1
+ import type { RecursiveArray } from '../lodash.types';
2
+ import type { FalsyValue, Mapper, Predicate, StringMap } from '../types';
3
3
  /**
4
4
  * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
5
5
  * final chunk will be the remaining elements.
@@ -1,4 +1,5 @@
1
- import { Inclusiveness, LocalDate, LocalDateConfig, LocalDateUnit } from './localDate';
1
+ import type { Inclusiveness, LocalDateConfig, LocalDateUnit } from './localDate';
2
+ import { LocalDate } from './localDate';
2
3
  export declare type DateIntervalConfig = DateInterval | DateIntervalString;
3
4
  export declare type DateIntervalString = string;
4
5
  /**
@@ -1,4 +1,4 @@
1
- import { IsoDateString, IsoDateTimeString, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
1
+ import type { IsoDateString, IsoDateTimeString, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
2
2
  import { LocalTime } from './localTime';
3
3
  export declare type LocalDateUnit = LocalDateUnitStrict | 'week';
4
4
  export declare type LocalDateUnitStrict = 'year' | 'month' | 'day';
@@ -1,5 +1,6 @@
1
- import { IsoDateString, IsoDateTimeString, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
2
- import { Inclusiveness, LocalDate } from './localDate';
1
+ import type { IsoDateString, IsoDateTimeString, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
2
+ import type { Inclusiveness } from './localDate';
3
+ import { LocalDate } from './localDate';
3
4
  export declare type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
4
5
  export declare enum ISODayOfWeek {
5
6
  MONDAY = 1,
@@ -1,6 +1,7 @@
1
- import { UnixTimestampNumber } from '../types';
2
- import { Inclusiveness } from './localDate';
3
- import { LocalTime, LocalTimeConfig } from './localTime';
1
+ import type { UnixTimestampNumber } from '../types';
2
+ import type { Inclusiveness } from './localDate';
3
+ import type { LocalTimeConfig } from './localTime';
4
+ import { LocalTime } from './localTime';
4
5
  export declare type TimeIntervalConfig = TimeInterval | TimeIntervalString;
5
6
  export declare type TimeIntervalString = string;
6
7
  /**
@@ -1,5 +1,5 @@
1
- import { CommonLogger } from '../log/commonLogger';
2
- import { AsyncMemoCache } from './memo.util';
1
+ import type { CommonLogger } from '../log/commonLogger';
2
+ import type { AsyncMemoCache } from './memo.util';
3
3
  export interface AsyncMemoOptions {
4
4
  /**
5
5
  * Provide a custom implementation of MemoCache.
@@ -1,4 +1,4 @@
1
- import { AnyFunction } from '../types';
1
+ import type { AnyFunction } from '../types';
2
2
  export interface Cancelable {
3
3
  cancel(): void;
4
4
  flush(): void;
@@ -1,3 +1,3 @@
1
- import { DebounceOptions, ThrottleOptions } from './debounce';
1
+ import type { DebounceOptions, ThrottleOptions } from './debounce';
2
2
  export declare function _Debounce(wait: number, opt?: DebounceOptions): MethodDecorator;
3
3
  export declare function _Throttle(wait: number, opt?: ThrottleOptions): MethodDecorator;
@@ -1,4 +1,4 @@
1
- import { AnyObject } from '../index';
1
+ import type { AnyObject } from '../index';
2
2
  /**
3
3
  * @returns
4
4
  * e.g `NameOfYourClass.methodName`
@@ -1,4 +1,4 @@
1
- import { CommonLogger } from '..';
1
+ import type { CommonLogger } from '..';
2
2
  /**
3
3
  * $r - result
4
4
  *
@@ -1,5 +1,5 @@
1
- import { CommonLogger } from '../log/commonLogger';
2
- import { MemoCache } from './memo.util';
1
+ import type { CommonLogger } from '../log/commonLogger';
2
+ import type { MemoCache } from './memo.util';
3
3
  export interface MemoOptions {
4
4
  /**
5
5
  * Provide a custom implementation of MemoCache.
@@ -1,4 +1,4 @@
1
- import { Promisable } from '../typeFest';
1
+ import type { Promisable } from '../typeFest';
2
2
  export declare type MemoSerializer = (args: any[]) => any;
3
3
  export declare const jsonMemoSerializer: MemoSerializer;
4
4
  export interface MemoCache<KEY = any, VALUE = any> {
@@ -1,5 +1,5 @@
1
- import { MemoOptions } from './memo.decorator';
2
- import { MemoCache } from './memo.util';
1
+ import type { MemoOptions } from './memo.decorator';
2
+ import type { MemoCache } from './memo.util';
3
3
  export interface MemoizedFunction {
4
4
  cache: MemoCache;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { AsyncMemoOptions } from './asyncMemo.decorator';
2
- import { AsyncMemoCache } from './memo.util';
1
+ import type { AsyncMemoOptions } from './asyncMemo.decorator';
2
+ import type { AsyncMemoCache } from './memo.util';
3
3
  export interface MemoizedAsyncFunction {
4
4
  cache: AsyncMemoCache;
5
5
  }
@@ -1,4 +1,4 @@
1
- import { CommonLogger } from '../log/commonLogger';
1
+ import type { CommonLogger } from '../log/commonLogger';
2
2
  export interface MemoOpts {
3
3
  logHit?: boolean;
4
4
  logMiss?: boolean;
@@ -1,2 +1,2 @@
1
- import { PRetryOptions } from '..';
1
+ import type { PRetryOptions } from '..';
2
2
  export declare function _Retry(opt?: PRetryOptions): MethodDecorator;
@@ -1,2 +1,2 @@
1
- import { PTimeoutOptions } from '../promise/pTimeout';
1
+ import type { PTimeoutOptions } from '../promise/pTimeout';
2
2
  export declare function _Timeout(opt: PTimeoutOptions): MethodDecorator;
@@ -1,4 +1,4 @@
1
- import { NumberEnum, StringEnum } from './types';
1
+ import type { NumberEnum, StringEnum } from './types';
2
2
  /**
3
3
  * Returns all number keys of a number-enum.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ErrorData } from './error.model';
1
+ import type { ErrorData } from './error.model';
2
2
  /**
3
3
  * Base class for all our (not system) errors.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { ErrorData } from '..';
1
+ import type { ErrorData } from '..';
2
2
  import { AppError } from './app.error';
3
3
  /**
4
4
  * Evaluates the `condition` (casts it to Boolean).
@@ -1,4 +1,5 @@
1
- import { AppError, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, StringifyAnyOptions, Class } from '..';
1
+ import type { ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, StringifyAnyOptions, Class } from '..';
2
+ import { AppError } from '..';
2
3
  /**
3
4
  * Useful to ensure that error in `catch (err) { ... }`
4
5
  * is indeed an Error (and not e.g `string` or `undefined`).
@@ -1,5 +1,5 @@
1
1
  import { AppError } from './app.error';
2
- import { HttpErrorData } from './error.model';
2
+ import type { HttpErrorData } from './error.model';
3
3
  /**
4
4
  * Base class for HTTP errors - errors that define HTTP error code.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { AnyFunction } from '../types';
1
+ import type { AnyFunction } from '../types';
2
2
  import { AppError } from './app.error';
3
3
  /**
4
4
  * Calls a function, returns a Tuple of [error, value].
@@ -1,5 +1,5 @@
1
- import { CommonLogger } from '../index';
2
- import { AnyFunction } from '../types';
1
+ import type { CommonLogger } from '../index';
2
+ import type { AnyFunction } from '../types';
3
3
  export interface TryCatchOptions {
4
4
  /**
5
5
  * The value returned from the function will be returned from the wrapped method (!).
package/dist/index.d.ts CHANGED
@@ -2,14 +2,15 @@ export * from './array/array.util';
2
2
  export * from './lazy';
3
3
  export * from './string/url.util';
4
4
  export * from './array/range';
5
- import { PromiseDecoratorCfg, PromiseDecoratorResp, _createPromiseDecorator } from './decorators/createPromiseDecorator';
5
+ import type { PromiseDecoratorCfg, PromiseDecoratorResp } from './decorators/createPromiseDecorator';
6
+ import { _createPromiseDecorator } from './decorators/createPromiseDecorator';
6
7
  export * from './decorators/debounce';
7
8
  export * from './decorators/debounce.decorator';
8
9
  export * from './decorators/decorator.util';
9
10
  export * from './decorators/logMethod.decorator';
10
11
  export * from './decorators/memo.decorator';
11
12
  export * from './decorators/asyncMemo.decorator';
12
- import { MemoCache, AsyncMemoCache } from './decorators/memo.util';
13
+ import type { MemoCache, AsyncMemoCache } from './decorators/memo.util';
13
14
  export * from './decorators/memoFn';
14
15
  export * from './decorators/memoFnAsync';
15
16
  export * from './decorators/retry.decorator';
@@ -17,17 +18,19 @@ export * from './decorators/timeout.decorator';
17
18
  export * from './error/app.error';
18
19
  export * from './error/assert';
19
20
  export * from './enum.util';
20
- import { Admin401ErrorData, Admin403ErrorData, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse } from './error/error.model';
21
+ import type { Admin401ErrorData, Admin403ErrorData, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse } from './error/error.model';
21
22
  export * from './error/error.util';
22
23
  import { ErrorMode } from './error/errorMode';
23
24
  export * from './error/http.error';
24
25
  export * from './error/try';
25
- import { TryCatchOptions, _TryCatch, _tryCatch } from './error/tryCatch';
26
+ import type { TryCatchOptions } from './error/tryCatch';
27
+ import { _TryCatch, _tryCatch } from './error/tryCatch';
26
28
  export * from './json-schema/from-data/generateJsonSchemaFromData';
27
29
  export * from './json-schema/jsonSchema.cnst';
28
- import { JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaConst, JsonSchemaEnum, JsonSchemaNot, JsonSchemaNull, JsonSchemaNumber, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaOneOf, JsonSchemaRef, JsonSchemaString, JsonSchemaTuple } from './json-schema/jsonSchema.model';
30
+ import type { JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaConst, JsonSchemaEnum, JsonSchemaNot, JsonSchemaNull, JsonSchemaNumber, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaOneOf, JsonSchemaRef, JsonSchemaString, JsonSchemaTuple } from './json-schema/jsonSchema.model';
29
31
  export * from './json-schema/jsonSchema.util';
30
- import { jsonSchema, JsonSchemaAnyBuilder, JsonSchemaBuilder } from './json-schema/jsonSchemaBuilder';
32
+ import type { JsonSchemaBuilder } from './json-schema/jsonSchemaBuilder';
33
+ import { jsonSchema, JsonSchemaAnyBuilder } from './json-schema/jsonSchemaBuilder';
31
34
  export * from './math/math.util';
32
35
  export * from './math/sma';
33
36
  export * from './number/createDeterministicRandom';
@@ -37,33 +40,38 @@ export * from './object/object.util';
37
40
  export * from './object/sortObject';
38
41
  export * from './object/sortObjectDeep';
39
42
  import { AggregatedError } from './promise/AggregatedError';
40
- import { DeferredPromise, pDefer } from './promise/pDefer';
43
+ import type { DeferredPromise } from './promise/pDefer';
44
+ import { pDefer } from './promise/pDefer';
41
45
  export * from './promise/pDelay';
42
46
  export * from './promise/pFilter';
43
47
  export * from './promise/pHang';
44
- import { pMap, PMapOptions } from './promise/pMap';
48
+ import type { PMapOptions } from './promise/pMap';
49
+ import { pMap } from './promise/pMap';
45
50
  export * from './promise/pProps';
46
- import { pRetry, pRetryFn, PRetryOptions } from './promise/pRetry';
51
+ import type { PRetryOptions } from './promise/pRetry';
52
+ import { pRetry, pRetryFn } from './promise/pRetry';
47
53
  export * from './promise/pState';
48
- import { pTimeout, pTimeoutFn, PTimeoutOptions } from './promise/pTimeout';
54
+ import type { PTimeoutOptions } from './promise/pTimeout';
55
+ import { pTimeout, pTimeoutFn } from './promise/pTimeout';
49
56
  export * from './string/case';
50
57
  export * from './string/json.util';
51
58
  export * from './string/string.util';
52
59
  export * from './string/readingTime';
53
60
  export * from './string/escape';
54
61
  export * from './string/pupa';
55
- import { JsonStringifyFunction, StringifyAnyOptions, _stringifyAny } from './string/stringifyAny';
62
+ import type { JsonStringifyFunction, StringifyAnyOptions } from './string/stringifyAny';
63
+ import { _stringifyAny } from './string/stringifyAny';
56
64
  export * from './time/time.util';
57
65
  export * from './is.util';
58
- import { Class, ConditionalExcept, ConditionalPick, Merge, Promisable, ReadonlyDeep, Simplify } from './typeFest';
59
- import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, UnsavedId, BatchResult, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyEnum, NumberEnum, StringEnum, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestampNumber, UnixTimestampMillisNumber, UnixTimestamp, Integer, ValueOf, ValuesOf, AbortableMapper, AbortableAsyncPredicate, AbortableAsyncMapper, AbortablePredicate, NullishValue, FalsyValue } from './types';
66
+ import type { Class, ConditionalExcept, ConditionalPick, Merge, Promisable, ReadonlyDeep, Simplify } from './typeFest';
67
+ import type { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, UnsavedId, BatchResult, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyEnum, NumberEnum, StringEnum, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestampNumber, UnixTimestampMillisNumber, UnixTimestamp, Integer, ValueOf, ValuesOf, AbortableMapper, AbortableAsyncPredicate, AbortableAsyncMapper, AbortablePredicate, NullishValue, FalsyValue } from './types';
60
68
  export * from './types';
61
69
  export * from './unit/size.util';
62
70
  import { is } from './vendor/is';
63
- import { CommonLogLevel, CommonLogFunction, CommonLogger, CommonLogWithLevelFunction } from './log/commonLogger';
71
+ import type { CommonLogLevel, CommonLogFunction, CommonLogger, CommonLogWithLevelFunction } from './log/commonLogger';
64
72
  export * from './log/commonLogger';
65
73
  export * from './string/safeJsonStringify';
66
- import { PQueueCfg } from './promise/pQueue';
74
+ import type { PQueueCfg } from './promise/pQueue';
67
75
  export * from './promise/pQueue';
68
76
  export * from './seq/seq';
69
77
  export * from './math/stack.util';
@@ -72,9 +80,9 @@ export * from './datetime/localDate';
72
80
  export * from './datetime/localTime';
73
81
  export * from './datetime/dateInterval';
74
82
  export * from './datetime/timeInterval';
75
- import { LocalDateConfig, LocalDateFormatter, LocalDateUnit, LocalDateUnitStrict, Inclusiveness } from './datetime/localDate';
76
- import { LocalTimeConfig, LocalTimeFormatter, LocalTimeUnit, LocalTimeComponents, ISODayOfWeek } from './datetime/localTime';
77
- import { DateIntervalConfig, DateIntervalString } from './datetime/dateInterval';
78
- import { TimeIntervalConfig, TimeIntervalString } from './datetime/timeInterval';
83
+ import type { LocalDateConfig, LocalDateFormatter, LocalDateUnit, LocalDateUnitStrict, Inclusiveness } from './datetime/localDate';
84
+ import type { LocalTimeConfig, LocalTimeFormatter, LocalTimeUnit, LocalTimeComponents, ISODayOfWeek } from './datetime/localTime';
85
+ import type { DateIntervalConfig, DateIntervalString } from './datetime/dateInterval';
86
+ import type { TimeIntervalConfig, TimeIntervalString } from './datetime/timeInterval';
79
87
  export type { DateIntervalConfig, DateIntervalString, TimeIntervalConfig, TimeIntervalString, LocalDateConfig, LocalDateFormatter, LocalDateUnit, LocalDateUnitStrict, Inclusiveness, LocalTimeConfig, LocalTimeFormatter, LocalTimeUnit, ISODayOfWeek, LocalTimeComponents, AbortableMapper, AbortablePredicate, AbortableAsyncPredicate, AbortableAsyncMapper, PQueueCfg, MemoCache, AsyncMemoCache, PromiseDecoratorCfg, PromiseDecoratorResp, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, Admin401ErrorData, Admin403ErrorData, StringMap, PromiseMap, AnyObject, AnyEnum, NumberEnum, StringEnum, AnyFunction, ValuesOf, ValueOf, KeyValueTuple, ObjectMapper, ObjectPredicate, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, Reviver, FalsyValue, NullishValue, PMapOptions, Mapper, AsyncMapper, Predicate, AsyncPredicate, BatchResult, DeferredPromise, PRetryOptions, PTimeoutOptions, TryCatchOptions, StringifyAnyOptions, JsonStringifyFunction, Merge, ReadonlyDeep, Promisable, Simplify, ConditionalPick, ConditionalExcept, Class, UnixTimestampNumber, UnixTimestampMillisNumber, UnixTimestamp, Integer, BaseDBEntity, SavedDBEntity, Saved, Unsaved, UnsavedId, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, JsonSchema, JsonSchemaAny, JsonSchemaOneOf, JsonSchemaAllOf, JsonSchemaAnyOf, JsonSchemaNot, JsonSchemaRef, JsonSchemaConst, JsonSchemaEnum, JsonSchemaString, JsonSchemaNumber, JsonSchemaBoolean, JsonSchemaNull, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaArray, JsonSchemaTuple, JsonSchemaBuilder, CommonLogLevel, CommonLogWithLevelFunction, CommonLogFunction, CommonLogger, };
80
88
  export { is, _createPromiseDecorator, pMap, ErrorMode, pDefer, AggregatedError, pRetry, pRetryFn, pTimeout, pTimeoutFn, _tryCatch, _TryCatch, _stringifyAny, jsonSchema, JsonSchemaAnyBuilder, };
package/dist/index.js CHANGED
@@ -84,4 +84,3 @@ tslib_1.__exportStar(require("./datetime/localDate"), exports);
84
84
  tslib_1.__exportStar(require("./datetime/localTime"), exports);
85
85
  tslib_1.__exportStar(require("./datetime/dateInterval"), exports);
86
86
  tslib_1.__exportStar(require("./datetime/timeInterval"), exports);
87
- const localTime_1 = require("./datetime/localTime");
package/dist/is.util.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Primitive } from './typeFest';
2
- import { AnyObject, FalsyValue, NullishValue } from './types';
1
+ import type { Primitive } from './typeFest';
2
+ import type { AnyObject, FalsyValue, NullishValue } from './types';
3
3
  declare type Nullish<T> = T extends NullishValue ? T : never;
4
4
  declare type Truthy<T> = T extends FalsyValue ? never : T;
5
5
  declare type Falsy<T> = T extends FalsyValue ? T : never;
@@ -1,4 +1,4 @@
1
- import { JsonSchemaObject, AnyObject } from '../..';
1
+ import type { JsonSchemaObject, AnyObject } from '../..';
2
2
  /**
3
3
  * Each row must be an object (current limitation).
4
4
  *
@@ -1,2 +1,2 @@
1
- import { JsonSchema, JsonSchemaAny, JsonSchemaNumber, JsonSchemaObject, JsonSchemaString } from './jsonSchema.model';
1
+ import type { JsonSchema, JsonSchemaAny, JsonSchemaNumber, JsonSchemaObject, JsonSchemaString } from './jsonSchema.model';
2
2
  export declare const JSON_SCHEMA_ORDER: (keyof JsonSchema | keyof JsonSchemaAny | keyof JsonSchemaObject | keyof JsonSchemaString | keyof JsonSchemaNumber)[];
@@ -1,4 +1,4 @@
1
- import { AnyObject, StringMap } from '../types';
1
+ import type { AnyObject, StringMap } from '../types';
2
2
  export declare type JsonSchema<T = unknown> = JsonSchemaAny<T> | JsonSchemaOneOf<T> | JsonSchemaAllOf<T> | JsonSchemaAnyOf<T> | JsonSchemaNot<T> | JsonSchemaRef<T> | JsonSchemaConst<T> | JsonSchemaEnum<T> | JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaNull | JsonSchemaObject<T> | JsonSchemaArray<T> | JsonSchemaTuple<T>;
3
3
  export interface JsonSchemaAny<T = unknown> {
4
4
  $schema?: string;
@@ -1,4 +1,4 @@
1
- import { JsonSchemaObject } from './jsonSchema.model';
1
+ import type { JsonSchemaObject } from './jsonSchema.model';
2
2
  /**
3
3
  * Merges s2 into s1 (mutates s1) and returns s1.
4
4
  * Does not mutate s2.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { BaseDBEntity, JsonSchemaAllOf, JsonSchemaArray, JsonSchemaOneOf, JsonSchemaTuple, SavedDBEntity, AnyObject } from '../index';
3
- import { JsonSchema, JsonSchemaAny, JsonSchemaBoolean, JsonSchemaConst, JsonSchemaEnum, JsonSchemaNull, JsonSchemaNumber, JsonSchemaObject, JsonSchemaRef, JsonSchemaString } from './jsonSchema.model';
2
+ import type { BaseDBEntity, JsonSchemaAllOf, JsonSchemaArray, JsonSchemaOneOf, JsonSchemaTuple, SavedDBEntity, AnyObject } from '../index';
3
+ import type { JsonSchema, JsonSchemaAny, JsonSchemaBoolean, JsonSchemaConst, JsonSchemaEnum, JsonSchemaNull, JsonSchemaNumber, JsonSchemaObject, JsonSchemaRef, JsonSchemaString } from './jsonSchema.model';
4
4
  export interface JsonSchemaBuilder<T = unknown> {
5
5
  build(): JsonSchema<T>;
6
6
  }
@@ -1,3 +1,3 @@
1
- import { SavedDBEntity } from '../types';
1
+ import type { SavedDBEntity } from '../types';
2
2
  export declare const baseDBEntityJsonSchema: import("./jsonSchemaBuilder").JsonSchemaObjectBuilder<Partial<SavedDBEntity<string>>>;
3
3
  export declare const savedDBEntityJsonSchema: import("./jsonSchemaBuilder").JsonSchemaObjectBuilder<SavedDBEntity<string>>;
package/dist/lazy.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnyFunction, AnyObject } from './types';
1
+ import type { AnyFunction, AnyObject } from './types';
2
2
  /**
3
3
  * const value = lazyValue(() => expensiveComputation())
4
4
  *
@@ -1,5 +1,5 @@
1
- import { PropertyPath } from '../lodash.types';
2
- import { AnyObject, ObjectMapper, ObjectPredicate, StringMap, ValueOf } from '../types';
1
+ import type { PropertyPath } from '../lodash.types';
2
+ import type { AnyObject, ObjectMapper, ObjectPredicate, StringMap, ValueOf } from '../types';
3
3
  /**
4
4
  * Returns clone of `obj` with only `props` preserved.
5
5
  * Opposite of Omit.
@@ -1,4 +1,4 @@
1
- import { AnyObject } from '../index';
1
+ import type { AnyObject } from '../index';
2
2
  /**
3
3
  * Returns new object with keys sorder in the given order.
4
4
  * All keys that are not listed in `keyOrder` go last.
@@ -1,2 +1,2 @@
1
- import { AsyncPredicate } from '../types';
1
+ import type { AsyncPredicate } from '../types';
2
2
  export declare function pFilter<T>(iterable: Iterable<T>, filterFn: AsyncPredicate<T>): Promise<T[]>;
@@ -1,4 +1,5 @@
1
- import { AbortableAsyncMapper, ErrorMode } from '..';
1
+ import type { AbortableAsyncMapper } from '..';
2
+ import { ErrorMode } from '..';
2
3
  export interface PMapOptions {
3
4
  /**
4
5
  * Number of concurrently pending promises returned by `mapper`.
@@ -1,5 +1,5 @@
1
1
  import { ErrorMode } from '../error/errorMode';
2
- import { CommonLogger } from '../log/commonLogger';
2
+ import type { CommonLogger } from '../log/commonLogger';
3
3
  export interface PQueueCfg {
4
4
  concurrency: number;
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { AnyFunction, CommonLogger, ErrorData } from '..';
1
+ import type { AnyFunction, CommonLogger, ErrorData } from '..';
2
2
  export interface PRetryOptions {
3
3
  /**
4
4
  * If set - will be included in the error message.
@@ -1,6 +1,6 @@
1
1
  import { AppError } from '../error/app.error';
2
- import { ErrorData } from '../error/error.model';
3
- import { AnyFunction } from '../types';
2
+ import type { ErrorData } from '../error/error.model';
3
+ import type { AnyFunction } from '../types';
4
4
  export declare class TimeoutError extends AppError {
5
5
  }
6
6
  export interface PTimeoutOptions {
package/dist/seq/seq.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { AbortableAsyncMapper, AbortableAsyncPredicate, AbortableMapper, AbortablePredicate, END } from '../types';
1
+ import type { AbortableAsyncMapper, AbortableAsyncPredicate, AbortableMapper, AbortablePredicate } from '../types';
2
+ import { END } from '../types';
2
3
  /**
3
4
  * Inspired by Kotlin Sequences.
4
5
  * Similar to arrays, but with lazy evaluation, abortable.
@@ -1,10 +1,21 @@
1
+ import type { Integer } from '../types';
1
2
  export interface ReadingTimeOptions {
3
+ /**
4
+ * A function that returns a boolean value depending on if a character is considered as a word bound.
5
+ * Default: spaces, new lines and tabs
6
+ */
2
7
  wordBound?: (char: string) => boolean;
8
+ /**
9
+ * Default 200
10
+ */
3
11
  wordsPerMinute?: number;
4
12
  }
5
13
  export interface ReadingTimeStats {
6
- time: number;
7
- minutes: number;
14
+ /**
15
+ * Number of milliseconds.
16
+ */
17
+ time: Integer;
18
+ minutes: Integer;
8
19
  }
9
20
  export interface WordCountStats {
10
21
  total: number;
@@ -1,4 +1,4 @@
1
- import { Reviver } from '../types';
1
+ import type { Reviver } from '../types';
2
2
  /**
3
3
  * JSON.stringify that avoids circular references, prints them as [Circular ~]
4
4
  *
@@ -1,4 +1,4 @@
1
- import { Reviver } from '../types';
1
+ import type { Reviver } from '../types';
2
2
  export declare type JsonStringifyFunction = (obj: any, reviver?: Reviver, space?: number) => string;
3
3
  export interface StringifyAnyOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { StringMap } from '../types';
1
+ import type { StringMap } from '../types';
2
2
  /**
3
3
  * Parses `location.search` string (e.g `?a=1&b=2`) into a StringMap, e.g:
4
4
  * `{ a: '1', b: '2' }`
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Except, Merge, Promisable } from './typeFest';
1
+ import type { Except, Merge, Promisable } from './typeFest';
2
2
  /**
3
3
  * Map from String to String (or <T>).
4
4
  *
@@ -179,19 +179,17 @@ export declare type Reviver = (this: any, key: string, value: any) => any;
179
179
  * Needed due to https://github.com/microsoft/TypeScript/issues/13778
180
180
  * Only affects typings, no runtime effect.
181
181
  */
182
- export declare function _stringMapValues<T>(m: StringMap<T>): T[];
182
+ export declare const _stringMapValues: <T>(m: StringMap<T>) => T[];
183
183
  /**
184
184
  * Needed due to https://github.com/microsoft/TypeScript/issues/13778
185
185
  * Only affects typings, no runtime effect.
186
186
  */
187
- export declare function _stringMapEntries<T>(m: StringMap<T>): [k: string, v: T][];
187
+ export declare const _stringMapEntries: <T>(m: StringMap<T>) => [k: string, v: T][];
188
188
  /**
189
189
  * Like `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
190
190
  * This is how TypeScript should work, actually.
191
- *
192
- * @experimental
193
191
  */
194
- export declare function _objectKeys<T extends AnyObject>(obj: T): (keyof T)[];
192
+ export declare const _objectKeys: <T extends AnyObject>(obj: T) => (keyof T)[];
195
193
  export declare type NullishValue = null | undefined;
196
194
  export declare type FalsyValue = false | '' | 0 | null | undefined;
197
195
  /**
package/dist/types.js CHANGED
@@ -26,28 +26,17 @@ exports._passNothingPredicate = _passNothingPredicate;
26
26
  * Needed due to https://github.com/microsoft/TypeScript/issues/13778
27
27
  * Only affects typings, no runtime effect.
28
28
  */
29
- function _stringMapValues(m) {
30
- return Object.values(m);
31
- }
32
- exports._stringMapValues = _stringMapValues;
29
+ exports._stringMapValues = Object.values;
33
30
  /**
34
31
  * Needed due to https://github.com/microsoft/TypeScript/issues/13778
35
32
  * Only affects typings, no runtime effect.
36
33
  */
37
- function _stringMapEntries(m) {
38
- return Object.entries(m);
39
- }
40
- exports._stringMapEntries = _stringMapEntries;
34
+ exports._stringMapEntries = Object.entries;
41
35
  /**
42
36
  * Like `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
43
37
  * This is how TypeScript should work, actually.
44
- *
45
- * @experimental
46
38
  */
47
- function _objectKeys(obj) {
48
- return Object.keys(obj);
49
- }
50
- exports._objectKeys = _objectKeys;
39
+ exports._objectKeys = Object.keys;
51
40
  /**
52
41
  * Utility function that helps to cast *existing variable* to needed type T.
53
42
  *
@@ -1,4 +1,4 @@
1
- import { AppError, _jsonParseIfPossible, _stringifyAny, } from '..';
1
+ import { AppError, _jsonParseIfPossible, _stringifyAny } from '..';
2
2
  /**
3
3
  * Useful to ensure that error in `catch (err) { ... }`
4
4
  * is indeed an Error (and not e.g `string` or `undefined`).
package/dist-esm/index.js CHANGED
@@ -2,7 +2,7 @@ export * from './array/array.util';
2
2
  export * from './lazy';
3
3
  export * from './string/url.util';
4
4
  export * from './array/range';
5
- import { _createPromiseDecorator, } from './decorators/createPromiseDecorator';
5
+ import { _createPromiseDecorator } from './decorators/createPromiseDecorator';
6
6
  export * from './decorators/debounce';
7
7
  export * from './decorators/debounce.decorator';
8
8
  export * from './decorators/decorator.util';
@@ -24,7 +24,7 @@ import { _TryCatch, _tryCatch } from './error/tryCatch';
24
24
  export * from './json-schema/from-data/generateJsonSchemaFromData';
25
25
  export * from './json-schema/jsonSchema.cnst';
26
26
  export * from './json-schema/jsonSchema.util';
27
- import { jsonSchema, JsonSchemaAnyBuilder, } from './json-schema/jsonSchemaBuilder';
27
+ import { jsonSchema, JsonSchemaAnyBuilder } from './json-schema/jsonSchemaBuilder';
28
28
  export * from './math/math.util';
29
29
  export * from './math/sma';
30
30
  export * from './number/createDeterministicRandom';
@@ -65,5 +65,4 @@ export * from './datetime/localDate';
65
65
  export * from './datetime/localTime';
66
66
  export * from './datetime/dateInterval';
67
67
  export * from './datetime/timeInterval';
68
- import { ISODayOfWeek, } from './datetime/localTime';
69
68
  export { is, _createPromiseDecorator, pMap, ErrorMode, pDefer, AggregatedError, pRetry, pRetryFn, pTimeout, pTimeoutFn, _tryCatch, _TryCatch, _stringifyAny, jsonSchema, JsonSchemaAnyBuilder, };
@@ -1,4 +1,4 @@
1
- import { _stringMapEntries, _uniq, } from '../..';
1
+ import { _stringMapEntries, _uniq } from '../..';
2
2
  /**
3
3
  * Each row must be an object (current limitation).
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { _uniq } from '../array/array.util';
2
- import { mergeJsonSchemaObjects, _deepCopy, _sortObject, } from '../index';
2
+ import { mergeJsonSchemaObjects, _deepCopy, _sortObject } from '../index';
3
3
  import { JSON_SCHEMA_ORDER } from './jsonSchema.cnst';
4
4
  /**
5
5
  * Fluent (chainable) API to manually create Json Schemas.
@@ -1,4 +1,4 @@
1
- import { END, SKIP, } from '../types';
1
+ import { END, SKIP } from '../types';
2
2
  /**
3
3
  * Inspired by Kotlin Sequences.
4
4
  * Similar to arrays, but with lazy evaluation, abortable.