@naturalcycles/js-lib 14.70.0 → 14.72.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.
- package/dist/error/error.util.js +2 -0
- package/dist/error/try.d.ts +1 -1
- package/dist/error/try.js +2 -0
- package/dist/index.d.ts +28 -26
- package/dist/index.js +28 -122
- package/dist/math/sma.d.ts +2 -2
- package/dist/math/stack.util.d.ts +21 -0
- package/dist/math/stack.util.js +36 -0
- package/dist/promise/pBatch.d.ts +2 -3
- package/dist/promise/pFilter.d.ts +2 -2
- package/dist/promise/pMap.d.ts +2 -3
- package/dist/promise/pMap.js +13 -7
- package/dist/promise/pProps.d.ts +3 -1
- package/dist/promise/pProps.js +4 -5
- package/dist/seq/seq.d.ts +30 -0
- package/dist/seq/seq.js +141 -0
- package/dist/string/json.util.js +4 -1
- package/dist/typeFest.d.ts +0 -30
- package/dist/types.d.ts +13 -1
- package/dist/types.js +9 -1
- package/dist-esm/error/error.util.js +2 -0
- package/dist-esm/error/try.js +2 -0
- package/dist-esm/index.js +26 -24
- package/dist-esm/math/stack.util.js +32 -0
- package/dist-esm/promise/pMap.js +14 -8
- package/dist-esm/promise/pProps.js +4 -5
- package/dist-esm/seq/seq.js +136 -0
- package/dist-esm/string/json.util.js +4 -1
- package/dist-esm/types.js +8 -0
- package/package.json +1 -1
- package/src/error/error.util.ts +2 -0
- package/src/error/try.ts +4 -1
- package/src/index.ts +36 -195
- package/src/math/sma.ts +1 -1
- package/src/math/stack.util.ts +35 -0
- package/src/promise/pBatch.ts +2 -3
- package/src/promise/pFilter.ts +2 -2
- package/src/promise/pMap.ts +16 -11
- package/src/promise/pProps.ts +6 -7
- package/src/seq/seq.ts +143 -0
- package/src/string/json.util.ts +5 -1
- package/src/typeFest.ts +0 -32
- package/src/types.ts +22 -1
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Merge } from './typeFest'
|
|
1
|
+
import { Merge, Promisable } from './typeFest'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Map from String to String (or <T>).
|
|
@@ -45,6 +45,16 @@ export interface AnyObjectWithId extends AnyObject, ObjectWithId {}
|
|
|
45
45
|
*/
|
|
46
46
|
export type AnyFunction = (...args: any[]) => any
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Symbol to indicate END of Sequence.
|
|
50
|
+
*/
|
|
51
|
+
export const END = Symbol('END')
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Symbol to indicate SKIP of item (e.g in AbortableMapper)
|
|
55
|
+
*/
|
|
56
|
+
export const SKIP = Symbol('SKIP')
|
|
57
|
+
|
|
48
58
|
/**
|
|
49
59
|
* Function which is called for every item in `input`. Expected to return a `Promise` or value.
|
|
50
60
|
*/
|
|
@@ -62,6 +72,17 @@ export const _noop = (..._args: any[]): undefined => undefined
|
|
|
62
72
|
export type Predicate<T> = (item: T, index: number) => boolean
|
|
63
73
|
export type AsyncPredicate<T> = (item: T, index: number) => boolean | PromiseLike<boolean>
|
|
64
74
|
|
|
75
|
+
export type AbortablePredicate<T> = (item: T, i: number) => boolean | typeof END
|
|
76
|
+
export type AbortableAsyncPredicate<T> = (item: T, i: number) => Promisable<boolean | typeof END>
|
|
77
|
+
export type AbortableMapper<IN = any, OUT = any> = (
|
|
78
|
+
input: IN,
|
|
79
|
+
i: number,
|
|
80
|
+
) => OUT | typeof SKIP | typeof END
|
|
81
|
+
export type AbortableAsyncMapper<IN = any, OUT = any> = (
|
|
82
|
+
input: IN,
|
|
83
|
+
i: number,
|
|
84
|
+
) => Promisable<OUT | typeof SKIP | typeof END>
|
|
85
|
+
|
|
65
86
|
export const _passthroughPredicate: Predicate<any> = () => true
|
|
66
87
|
export const _passNothingPredicate: Predicate<any> = () => false
|
|
67
88
|
|