@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
@@ -9,14 +9,26 @@ Reasons:
9
9
 
10
10
  */
11
11
 
12
+ import type { Integer } from '../types'
13
+
12
14
  export interface ReadingTimeOptions {
15
+ /**
16
+ * A function that returns a boolean value depending on if a character is considered as a word bound.
17
+ * Default: spaces, new lines and tabs
18
+ */
13
19
  wordBound?: (char: string) => boolean
20
+ /**
21
+ * Default 200
22
+ */
14
23
  wordsPerMinute?: number
15
24
  }
16
25
 
17
26
  export interface ReadingTimeStats {
18
- time: number
19
- minutes: number
27
+ /**
28
+ * Number of milliseconds.
29
+ */
30
+ time: Integer
31
+ minutes: Integer
20
32
  }
21
33
 
22
34
  export interface WordCountStats {
@@ -1,4 +1,4 @@
1
- import { Reviver } from '../types'
1
+ import type { Reviver } from '../types'
2
2
 
3
3
  /**
4
4
  * JSON.stringify that avoids circular references, prints them as [Circular ~]
@@ -1,5 +1,5 @@
1
1
  import { _isErrorObject, _isHttpErrorObject, _isHttpErrorResponse } from '../error/error.util'
2
- import { Reviver } from '../types'
2
+ import type { Reviver } from '../types'
3
3
  import { _jsonParseIfPossible } from './json.util'
4
4
  import { _safeJsonStringify } from './safeJsonStringify'
5
5
 
@@ -1,4 +1,4 @@
1
- import { StringMap } from '../types'
1
+ import type { StringMap } from '../types'
2
2
 
3
3
  /**
4
4
  * Parses `location.search` string (e.g `?a=1&b=2`) into a StringMap, e.g:
package/src/types.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
  /**
4
4
  * Map from String to String (or <T>).
@@ -243,27 +243,19 @@ export type Reviver = (this: any, key: string, value: any) => any
243
243
  * Needed due to https://github.com/microsoft/TypeScript/issues/13778
244
244
  * Only affects typings, no runtime effect.
245
245
  */
246
- export function _stringMapValues<T>(m: StringMap<T>): T[] {
247
- return Object.values(m) as T[]
248
- }
246
+ export const _stringMapValues = Object.values as <T>(m: StringMap<T>) => T[]
249
247
 
250
248
  /**
251
249
  * Needed due to https://github.com/microsoft/TypeScript/issues/13778
252
250
  * Only affects typings, no runtime effect.
253
251
  */
254
- export function _stringMapEntries<T>(m: StringMap<T>): [k: string, v: T][] {
255
- return Object.entries(m) as [string, T][]
256
- }
252
+ export const _stringMapEntries = Object.entries as <T>(m: StringMap<T>) => [k: string, v: T][]
257
253
 
258
254
  /**
259
255
  * Like `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
260
256
  * This is how TypeScript should work, actually.
261
- *
262
- * @experimental
263
257
  */
264
- export function _objectKeys<T extends AnyObject>(obj: T): (keyof T)[] {
265
- return Object.keys(obj)
266
- }
258
+ export const _objectKeys = Object.keys as <T extends AnyObject>(obj: T) => (keyof T)[]
267
259
 
268
260
  export type NullishValue = null | undefined
269
261
  export type FalsyValue = false | '' | 0 | null | undefined