@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.
- package/dist/array/array.util.d.ts +2 -2
- package/dist/datetime/dateInterval.d.ts +2 -1
- package/dist/datetime/localDate.d.ts +1 -1
- package/dist/datetime/localTime.d.ts +3 -2
- package/dist/datetime/timeInterval.d.ts +4 -3
- package/dist/decorators/asyncMemo.decorator.d.ts +2 -2
- package/dist/decorators/debounce.d.ts +1 -1
- package/dist/decorators/debounce.decorator.d.ts +1 -1
- package/dist/decorators/decorator.util.d.ts +1 -1
- package/dist/decorators/logMethod.decorator.d.ts +1 -1
- package/dist/decorators/memo.decorator.d.ts +2 -2
- package/dist/decorators/memo.util.d.ts +1 -1
- package/dist/decorators/memoFn.d.ts +2 -2
- package/dist/decorators/memoFnAsync.d.ts +2 -2
- package/dist/decorators/memoSimple.decorator.d.ts +1 -1
- package/dist/decorators/retry.decorator.d.ts +1 -1
- package/dist/decorators/timeout.decorator.d.ts +1 -1
- package/dist/enum.util.d.ts +1 -1
- package/dist/error/app.error.d.ts +1 -1
- package/dist/error/assert.d.ts +1 -1
- package/dist/error/error.util.d.ts +2 -1
- package/dist/error/http.error.d.ts +1 -1
- package/dist/error/try.d.ts +1 -1
- package/dist/error/tryCatch.d.ts +2 -2
- package/dist/index.d.ts +27 -19
- package/dist/index.js +0 -1
- package/dist/is.util.d.ts +2 -2
- package/dist/json-schema/from-data/generateJsonSchemaFromData.d.ts +1 -1
- package/dist/json-schema/jsonSchema.cnst.d.ts +1 -1
- package/dist/json-schema/jsonSchema.model.d.ts +1 -1
- package/dist/json-schema/jsonSchema.util.d.ts +1 -1
- package/dist/json-schema/jsonSchemaBuilder.d.ts +2 -2
- package/dist/json-schema/jsonSchemas.d.ts +1 -1
- package/dist/lazy.d.ts +1 -1
- package/dist/object/object.util.d.ts +2 -2
- package/dist/object/sortObject.d.ts +1 -1
- package/dist/promise/pFilter.d.ts +1 -1
- package/dist/promise/pMap.d.ts +2 -1
- package/dist/promise/pQueue.d.ts +1 -1
- package/dist/promise/pRetry.d.ts +1 -1
- package/dist/promise/pTimeout.d.ts +2 -2
- package/dist/seq/seq.d.ts +2 -1
- package/dist/string/readingTime.d.ts +13 -2
- package/dist/string/safeJsonStringify.d.ts +1 -1
- package/dist/string/stringifyAny.d.ts +1 -1
- package/dist/string/url.util.d.ts +1 -1
- package/dist/types.d.ts +4 -6
- package/dist/types.js +3 -14
- package/dist-esm/error/error.util.js +1 -1
- package/dist-esm/index.js +2 -3
- package/dist-esm/json-schema/from-data/generateJsonSchemaFromData.js +1 -1
- package/dist-esm/json-schema/jsonSchemaBuilder.js +1 -1
- package/dist-esm/seq/seq.js +1 -1
- package/dist-esm/types.js +3 -11
- package/package.json +2 -4
- package/src/array/array.util.ts +2 -2
- package/src/datetime/dateInterval.ts +2 -1
- package/src/datetime/localDate.ts +1 -1
- package/src/datetime/localTime.ts +3 -2
- package/src/datetime/timeInterval.ts +4 -3
- package/src/decorators/asyncMemo.decorator.ts +4 -3
- package/src/decorators/debounce.decorator.ts +2 -1
- package/src/decorators/debounce.ts +1 -1
- package/src/decorators/decorator.util.ts +1 -1
- package/src/decorators/logMethod.decorator.ts +2 -1
- package/src/decorators/memo.decorator.ts +4 -3
- package/src/decorators/memo.util.ts +1 -1
- package/src/decorators/memoFn.ts +3 -2
- package/src/decorators/memoFnAsync.ts +3 -2
- package/src/decorators/memoSimple.decorator.ts +3 -2
- package/src/decorators/retry.decorator.ts +2 -1
- package/src/decorators/timeout.decorator.ts +2 -1
- package/src/enum.util.ts +1 -1
- package/src/error/app.error.ts +1 -1
- package/src/error/assert.ts +2 -1
- package/src/error/error.util.ts +2 -4
- package/src/error/http.error.ts +1 -1
- package/src/error/try.ts +1 -1
- package/src/error/tryCatch.ts +3 -2
- package/src/index.ts +27 -27
- package/src/is.util.ts +2 -2
- package/src/json-schema/from-data/generateJsonSchemaFromData.ts +2 -3
- package/src/json-schema/jsonSchema.cnst.ts +1 -1
- package/src/json-schema/jsonSchema.model.ts +1 -1
- package/src/json-schema/jsonSchema.util.ts +1 -1
- package/src/json-schema/jsonSchemaBuilder.ts +3 -5
- package/src/json-schema/jsonSchemas.ts +1 -1
- package/src/lazy.ts +1 -1
- package/src/object/object.util.ts +2 -2
- package/src/object/sortObject.ts +2 -1
- package/src/promise/pFilter.ts +1 -1
- package/src/promise/pMap.ts +2 -1
- package/src/promise/pQueue.ts +3 -2
- package/src/promise/pRetry.ts +2 -1
- package/src/promise/pTimeout.ts +2 -2
- package/src/seq/seq.ts +2 -3
- package/src/string/readingTime.ts +14 -2
- package/src/string/safeJsonStringify.ts +1 -1
- package/src/string/stringifyAny.ts +1 -1
- package/src/string/url.util.ts +1 -1
- 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
|
-
|
|
19
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Number of milliseconds.
|
|
29
|
+
*/
|
|
30
|
+
time: Integer
|
|
31
|
+
minutes: Integer
|
|
20
32
|
}
|
|
21
33
|
|
|
22
34
|
export interface WordCountStats {
|
|
@@ -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
|
|
package/src/string/url.util.ts
CHANGED
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
|
|
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
|
|
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
|
|
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
|