@oscarpalmer/atoms 0.179.1 → 0.181.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/array/filter.d.mts +36 -28
- package/dist/array/filter.mjs +5 -5
- package/dist/array/find.d.mts +42 -1
- package/dist/array/find.mjs +5 -1
- package/dist/array/first.d.mts +13 -5
- package/dist/array/first.mjs +1 -1
- package/dist/array/get.mjs +2 -2
- package/dist/array/group-by.d.mts +13 -1
- package/dist/array/group-by.mjs +1 -1
- package/dist/array/index.d.mts +3 -3
- package/dist/array/index.mjs +3 -3
- package/dist/array/last.d.mts +9 -1
- package/dist/array/last.mjs +1 -1
- package/dist/array/move.d.mts +9 -1
- package/dist/array/move.mjs +3 -1
- package/dist/array/reverse.d.mts +5 -0
- package/dist/array/reverse.mjs +5 -0
- package/dist/array/select.d.mts +2 -2
- package/dist/array/sort.d.mts +23 -9
- package/dist/array/sort.mjs +22 -22
- package/dist/array/swap.d.mts +2 -0
- package/dist/array/swap.mjs +2 -0
- package/dist/array/to-map.d.mts +13 -1
- package/dist/array/to-map.mjs +1 -1
- package/dist/array/to-record.d.mts +13 -1
- package/dist/array/to-record.mjs +1 -1
- package/dist/function/assert.d.mts +9 -1
- package/dist/function/assert.mjs +9 -1
- package/dist/function/limit.d.mts +5 -1
- package/dist/function/limit.mjs +5 -1
- package/dist/function/once.d.mts +3 -1
- package/dist/function/once.mjs +3 -1
- package/dist/function/retry.d.mts +4 -0
- package/dist/function/retry.mjs +2 -0
- package/dist/function/work.d.mts +49 -1
- package/dist/function/work.mjs +1 -1
- package/dist/index.d.mts +540 -266
- package/dist/index.mjs +272 -178
- package/dist/internal/array/find.d.mts +4 -3
- package/dist/internal/array/find.mjs +5 -2
- package/dist/internal/array/index-of.d.mts +42 -1
- package/dist/internal/array/index-of.mjs +5 -1
- package/dist/internal/function/timer.mjs +3 -1
- package/dist/internal/math/aggregate.mjs +2 -2
- package/dist/internal/result.mjs +2 -2
- package/dist/internal/string.d.mts +5 -3
- package/dist/internal/string.mjs +14 -5
- package/dist/internal/value/compare.d.mts +13 -9
- package/dist/internal/value/compare.mjs +13 -9
- package/dist/internal/value/equal.d.mts +29 -15
- package/dist/internal/value/equal.mjs +43 -37
- package/dist/internal/value/handlers.d.mts +4 -4
- package/dist/internal/value/handlers.mjs +21 -13
- package/dist/internal/value/has.d.mts +9 -8
- package/dist/internal/value/has.mjs +3 -3
- package/dist/internal/value/misc.d.mts +4 -8
- package/dist/internal/value/misc.mjs +6 -17
- package/dist/promise/index.d.mts +11 -1
- package/dist/promise/index.mjs +1 -1
- package/dist/result/index.d.mts +9 -1
- package/dist/result/index.mjs +1 -1
- package/dist/result/match.d.mts +5 -1
- package/dist/result/match.mjs +1 -1
- package/dist/result/misc.d.mts +3 -3
- package/dist/result/work/flow.d.mts +49 -1
- package/dist/result/work/flow.mjs +1 -1
- package/dist/result/work/pipe.d.mts +67 -155
- package/dist/result/work/pipe.mjs +3 -3
- package/dist/string/fuzzy.d.mts +11 -1
- package/dist/string/fuzzy.mjs +22 -6
- package/dist/string/template.d.mts +3 -1
- package/dist/string/template.mjs +3 -1
- package/dist/value/clone.d.mts +13 -9
- package/dist/value/clone.mjs +21 -17
- package/dist/value/index.d.mts +2 -1
- package/dist/value/index.mjs +2 -1
- package/dist/value/merge.d.mts +22 -7
- package/dist/value/merge.mjs +10 -6
- package/dist/value/shake.d.mts +7 -0
- package/dist/value/shake.mjs +16 -0
- package/package.json +2 -2
- package/plugin/helpers.js +2 -2
- package/src/array/exists.ts +1 -1
- package/src/array/filter.ts +44 -36
- package/src/array/find.ts +58 -0
- package/src/array/first.ts +18 -9
- package/src/array/get.ts +2 -2
- package/src/array/group-by.ts +22 -10
- package/src/array/last.ts +17 -5
- package/src/array/move.ts +18 -5
- package/src/array/reverse.ts +5 -0
- package/src/array/select.ts +2 -2
- package/src/array/sort.ts +110 -86
- package/src/array/swap.ts +2 -0
- package/src/array/to-map.ts +22 -10
- package/src/array/to-record.ts +22 -10
- package/src/function/assert.ts +12 -4
- package/src/function/limit.ts +6 -2
- package/src/function/once.ts +3 -1
- package/src/function/retry.ts +8 -2
- package/src/function/work.ts +92 -26
- package/src/internal/array/find.ts +24 -4
- package/src/internal/array/index-of.ts +59 -1
- package/src/internal/function/timer.ts +4 -2
- package/src/internal/math/aggregate.ts +2 -2
- package/src/internal/result.ts +6 -3
- package/src/internal/string.ts +28 -8
- package/src/internal/value/compare.ts +14 -11
- package/src/internal/value/equal.ts +80 -68
- package/src/internal/value/handlers.ts +21 -13
- package/src/internal/value/has.ts +16 -16
- package/src/internal/value/misc.ts +10 -8
- package/src/promise/index.ts +14 -4
- package/src/result/index.ts +15 -5
- package/src/result/match.ts +7 -3
- package/src/result/misc.ts +3 -3
- package/src/result/work/flow.ts +68 -13
- package/src/result/work/pipe.ts +97 -392
- package/src/string/fuzzy.ts +34 -8
- package/src/string/template.ts +3 -1
- package/src/value/clone.ts +25 -22
- package/src/value/index.ts +1 -0
- package/src/value/merge.ts +31 -13
- package/src/value/shake.ts +36 -0
package/dist/array/sort.mjs
CHANGED
|
@@ -18,23 +18,7 @@ function getComparisonValue(first, second, sorters, length) {
|
|
|
18
18
|
}
|
|
19
19
|
return 0;
|
|
20
20
|
}
|
|
21
|
-
function getIndex(array, item,
|
|
22
|
-
return getSortedIndex(array, item, getSorters(first, getModifier(first, second)));
|
|
23
|
-
}
|
|
24
|
-
function getModifier(first, second) {
|
|
25
|
-
return modifiers[first === true || second === true ? SORT_DIRECTION_DESCENDING : SORT_DIRECTION_ASCENDING];
|
|
26
|
-
}
|
|
27
|
-
function getObjectSorter(obj, modifier) {
|
|
28
|
-
let sorter;
|
|
29
|
-
if (typeof obj.comparison === "function") sorter = getComparisonSorter(obj.comparison, modifier);
|
|
30
|
-
else if (typeof obj.key === "string") {
|
|
31
|
-
sorter = getValueSorter(obj.key, modifier);
|
|
32
|
-
if (typeof obj.compare === "function") sorter.compare = { complex: obj.compare };
|
|
33
|
-
} else if (typeof obj.value === "function") sorter = getValueSorter(obj.value, modifier);
|
|
34
|
-
if (sorter != null && typeof obj.direction === "string") sorter.modifier = modifiers[obj.direction] ?? modifier;
|
|
35
|
-
return sorter;
|
|
36
|
-
}
|
|
37
|
-
function getSortedIndex(array, item, sorters) {
|
|
21
|
+
function getIndex(array, item, sorters) {
|
|
38
22
|
if (!Array.isArray(array)) return -1;
|
|
39
23
|
const { length } = array;
|
|
40
24
|
if (length === 0) return 0;
|
|
@@ -50,6 +34,22 @@ function getSortedIndex(array, item, sorters) {
|
|
|
50
34
|
}
|
|
51
35
|
return low;
|
|
52
36
|
}
|
|
37
|
+
function getModifier(first, second) {
|
|
38
|
+
return modifiers[first === true || second === true ? SORT_DIRECTION_DESCENDING : SORT_DIRECTION_ASCENDING];
|
|
39
|
+
}
|
|
40
|
+
function getObjectSorter(obj, modifier) {
|
|
41
|
+
let sorter;
|
|
42
|
+
if (typeof obj.comparison === "function") sorter = getComparisonSorter(obj.comparison, modifier);
|
|
43
|
+
else if (typeof obj.key === "string") {
|
|
44
|
+
sorter = getValueSorter(obj.key, modifier);
|
|
45
|
+
if (typeof obj.compare === "function") sorter.compare = { complex: obj.compare };
|
|
46
|
+
} else if (typeof obj.value === "function") sorter = getValueSorter(obj.value, modifier);
|
|
47
|
+
if (sorter != null && typeof obj.direction === "string") sorter.modifier = modifiers[obj.direction] ?? modifier;
|
|
48
|
+
return sorter;
|
|
49
|
+
}
|
|
50
|
+
function getSortedIndex(array, item, first, second) {
|
|
51
|
+
return getIndex(array, item, getSorters(first, getModifier(first, second)));
|
|
52
|
+
}
|
|
53
53
|
function getSorter(value, modifier) {
|
|
54
54
|
switch (true) {
|
|
55
55
|
case typeof value === "function": return getComparisonSorter(value, modifier);
|
|
@@ -82,10 +82,10 @@ function getValueSorter(value, modifier) {
|
|
|
82
82
|
value: typeof value === "function" ? value : (item) => item[value]
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function initializeSorter(first, second) {
|
|
86
86
|
const sorters = getSorters(first, getModifier(first, second));
|
|
87
87
|
const sorter = (array) => sortArray(array, sorters);
|
|
88
|
-
sorter.index = (array, item) =>
|
|
88
|
+
sorter.index = (array, item) => getIndex(array, item, sorters);
|
|
89
89
|
sorter.is = (array) => isSortedArray(array, sorters);
|
|
90
90
|
return sorter;
|
|
91
91
|
}
|
|
@@ -124,8 +124,8 @@ function sortArray(array, sorters) {
|
|
|
124
124
|
const { length } = sorters;
|
|
125
125
|
return array.length > 1 ? array.sort((first, second) => getComparisonValue(first, second, sorters, length)) : array;
|
|
126
126
|
}
|
|
127
|
-
sort.index =
|
|
128
|
-
sort.initialize =
|
|
127
|
+
sort.index = getSortedIndex;
|
|
128
|
+
sort.initialize = initializeSorter;
|
|
129
129
|
sort.is = isSorted;
|
|
130
130
|
const ARRAY_PEEK_PERCENTAGE = 10;
|
|
131
131
|
const ARRAY_THRESHOLD = 100;
|
|
@@ -136,4 +136,4 @@ const modifiers = {
|
|
|
136
136
|
[SORT_DIRECTION_DESCENDING]: -1
|
|
137
137
|
};
|
|
138
138
|
//#endregion
|
|
139
|
-
export { SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, sort };
|
|
139
|
+
export { SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, getSortedIndex, initializeSorter, isSorted, sort };
|
package/dist/array/swap.d.mts
CHANGED
|
@@ -70,6 +70,8 @@ declare namespace swap {
|
|
|
70
70
|
* Swap two indiced items in an array
|
|
71
71
|
*
|
|
72
72
|
* If either index is out of bounds, the array will be returned unchanged
|
|
73
|
+
*
|
|
74
|
+
* Available as `swapIndices` and `swap.indices`
|
|
73
75
|
* @param array Array of items to swap
|
|
74
76
|
* @param first First index _(can be negative to count from the end)_
|
|
75
77
|
* @param second Second index _(can be negative to count from the end)_
|
package/dist/array/swap.mjs
CHANGED
|
@@ -32,6 +32,8 @@ function swapArrays(array, from, to, key) {
|
|
|
32
32
|
* Swap two indiced items in an array
|
|
33
33
|
*
|
|
34
34
|
* If either index is out of bounds, the array will be returned unchanged
|
|
35
|
+
*
|
|
36
|
+
* Available as `swapIndices` and `swap.indices`
|
|
35
37
|
* @param array Array of items to swap
|
|
36
38
|
* @param first First index _(can be negative to count from the end)_
|
|
37
39
|
* @param second Second index _(can be negative to count from the end)_
|
package/dist/array/to-map.d.mts
CHANGED
|
@@ -70,6 +70,8 @@ declare namespace toMap {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Create a Map from an array of items using callbacks, grouping values into arrays
|
|
73
|
+
*
|
|
74
|
+
* Available as `toMapArrays` and `toMap.arrays`
|
|
73
75
|
* @param array Array to convert
|
|
74
76
|
* @param key Callback to get an item's grouping key
|
|
75
77
|
* @param value Callback to get an item's value
|
|
@@ -78,6 +80,8 @@ declare namespace toMap {
|
|
|
78
80
|
declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
|
|
79
81
|
/**
|
|
80
82
|
* Create a Map from an array of items using a callback and value, grouping values into arrays
|
|
83
|
+
*
|
|
84
|
+
* Available as `toMapArrays` and `toMap.arrays`
|
|
81
85
|
* @param array Array to convert
|
|
82
86
|
* @param key Callback to get an item's grouping key
|
|
83
87
|
* @param value Key to use for value
|
|
@@ -86,6 +90,8 @@ declare function toMapArrays<Item, KeyCallback extends (item: Item, index: numbe
|
|
|
86
90
|
declare function toMapArrays<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue][]>;
|
|
87
91
|
/**
|
|
88
92
|
* Create a Map from an array of items using a key and callback, grouping values into arrays
|
|
93
|
+
*
|
|
94
|
+
* Available as `toMapArrays` and `toMap.arrays`
|
|
89
95
|
* @param array Array to convert
|
|
90
96
|
* @param key Key to use for grouping
|
|
91
97
|
* @param value Callback to get an item's value
|
|
@@ -94,6 +100,8 @@ declare function toMapArrays<Item extends PlainObject, KeyCallback extends (item
|
|
|
94
100
|
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Map<Item[ItemKey], ReturnType<ValueCallback>[]>;
|
|
95
101
|
/**
|
|
96
102
|
* Create a Map from an array of items using a key and value, grouping values into arrays
|
|
103
|
+
*
|
|
104
|
+
* Available as `toMapArrays` and `toMap.arrays`
|
|
97
105
|
* @param array Array to convert
|
|
98
106
|
* @param key Key to use for grouping
|
|
99
107
|
* @param value Key to use for value
|
|
@@ -102,6 +110,8 @@ declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Ite
|
|
|
102
110
|
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ItemValue extends keyof Item>(array: Item[], key: ItemKey, value: ItemValue): Map<Item[ItemKey], Item[ItemValue][]>;
|
|
103
111
|
/**
|
|
104
112
|
* Create a Map from an array of items using a callback, grouping items into arrays
|
|
113
|
+
*
|
|
114
|
+
* Available as `toMapArrays` and `toMap.arrays`
|
|
105
115
|
* @param array Array to convert
|
|
106
116
|
* @param callback Callback to get an item's grouping key
|
|
107
117
|
* @returns Map of keyed arrays of items
|
|
@@ -109,10 +119,12 @@ declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Ite
|
|
|
109
119
|
declare function toMapArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item[]>;
|
|
110
120
|
/**
|
|
111
121
|
* Create a Map from an array of items using a key, grouping items into arrays
|
|
122
|
+
*
|
|
123
|
+
* Available as `toMapArrays` and `toMap.arrays`
|
|
112
124
|
* @param array Array to convert
|
|
113
125
|
* @param key Key to use for grouping
|
|
114
126
|
* @returns Map of keyed arrays of items
|
|
115
127
|
*/
|
|
116
128
|
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Map<Item[ItemKey], Item[]>;
|
|
117
129
|
//#endregion
|
|
118
|
-
export { toMap };
|
|
130
|
+
export { toMap, toMapArrays };
|
package/dist/array/to-map.mjs
CHANGED
|
@@ -70,6 +70,8 @@ declare namespace toRecord {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Create a record from an array of items using callbacks, grouping values into arrays
|
|
73
|
+
*
|
|
74
|
+
* Available as `toRecordArrays` and `toRecord.arrays`
|
|
73
75
|
* @param array Array to convert
|
|
74
76
|
* @param key Callback to get an item's grouping key
|
|
75
77
|
* @param value Callback to get an item's value
|
|
@@ -78,6 +80,8 @@ declare namespace toRecord {
|
|
|
78
80
|
declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
|
|
79
81
|
/**
|
|
80
82
|
* Create a record from an array of items using a callback and value, grouping values into arrays
|
|
83
|
+
*
|
|
84
|
+
* Available as `toRecordArrays` and `toRecord.arrays`
|
|
81
85
|
* @param array Array to convert
|
|
82
86
|
* @param callback Callback to get an item's grouping key
|
|
83
87
|
* @param value Key to use for value
|
|
@@ -86,6 +90,8 @@ declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: nu
|
|
|
86
90
|
declare function toRecordArrays<Item extends PlainObject, Callback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], callback: Callback, value: ItemValue): Record<ReturnType<Callback>, Item[ItemValue][]>;
|
|
87
91
|
/**
|
|
88
92
|
* Create a record from an array of items using a key and callback, grouping values into arrays
|
|
93
|
+
*
|
|
94
|
+
* Available as `toRecordArrays` and `toRecord.arrays`
|
|
89
95
|
* @param array Array to convert
|
|
90
96
|
* @param key Key to use for grouping
|
|
91
97
|
* @param callback Callback to get an item's value
|
|
@@ -94,6 +100,8 @@ declare function toRecordArrays<Item extends PlainObject, Callback extends (item
|
|
|
94
100
|
declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, callback: Callback): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<Callback>[]>>;
|
|
95
101
|
/**
|
|
96
102
|
* Create a record from an array of items using a key and value, grouping values into arrays
|
|
103
|
+
*
|
|
104
|
+
* Available as `toRecordArrays` and `toRecord.arrays`
|
|
97
105
|
* @param array Array to convert
|
|
98
106
|
* @param key Key to use for grouping
|
|
99
107
|
* @param value Key to use for value
|
|
@@ -102,6 +110,8 @@ declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof
|
|
|
102
110
|
declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item, ItemValue extends keyof Item>(array: Item[], key: ItemKey, value: ItemValue): Simplify<Record<KeyedValue<Item, ItemKey>, Item[ItemValue][]>>;
|
|
103
111
|
/**
|
|
104
112
|
* Create a record from an array of items using a callback, grouping items into arrays
|
|
113
|
+
*
|
|
114
|
+
* Available as `toRecordArrays` and `toRecord.arrays`
|
|
105
115
|
* @param array Array to convert
|
|
106
116
|
* @param callback Callback to get an item's grouping key
|
|
107
117
|
* @returns Record of keyed arrays of items
|
|
@@ -109,10 +119,12 @@ declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof
|
|
|
109
119
|
declare function toRecordArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item[]>;
|
|
110
120
|
/**
|
|
111
121
|
* Create a record from an array of items using a key, grouping items into arrays
|
|
122
|
+
*
|
|
123
|
+
* Available as `toRecordArrays` and `toRecord.arrays`
|
|
112
124
|
* @param array Array to convert
|
|
113
125
|
* @param key Key to use for grouping
|
|
114
126
|
* @returns Record of keyed arrays of items
|
|
115
127
|
*/
|
|
116
128
|
declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
|
|
117
129
|
//#endregion
|
|
118
|
-
export { toRecord };
|
|
130
|
+
export { toRecord, toRecordArrays };
|
package/dist/array/to-record.mjs
CHANGED
|
@@ -17,6 +17,8 @@ declare namespace assert {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Creates an asserter that asserts a condition is true, throwing an error if it is not
|
|
20
|
+
*
|
|
21
|
+
* Available as `assertCondition` and `assert.condition`
|
|
20
22
|
* @param condition Condition to assert
|
|
21
23
|
* @param message Error message
|
|
22
24
|
* @param error Error constructor
|
|
@@ -25,12 +27,16 @@ declare namespace assert {
|
|
|
25
27
|
declare function assertCondition<Value>(condition: (value: unknown) => boolean, message: string, error?: ErrorConstructor): Asserter<Value>;
|
|
26
28
|
/**
|
|
27
29
|
* Asserts that a value is defined throwing an error if it is not
|
|
30
|
+
*
|
|
31
|
+
* Available as `assertDefined` and `assert.defined`
|
|
28
32
|
* @param value Value to assert
|
|
29
33
|
* @param message Error message
|
|
30
34
|
*/
|
|
31
35
|
declare function assertDefined<Value>(value: unknown, message?: string): asserts value is Exclude<Value, null | undefined>;
|
|
32
36
|
/**
|
|
33
37
|
* Creates an asserter that asserts a value is an instance of a constructor, throwing an error if it is not
|
|
38
|
+
*
|
|
39
|
+
* Available as `assertInstanceOf` and `assert.instanceOf`
|
|
34
40
|
* @param constructor Constructor to check against
|
|
35
41
|
* @param message Error message
|
|
36
42
|
* @param error Error constructor
|
|
@@ -39,6 +45,8 @@ declare function assertDefined<Value>(value: unknown, message?: string): asserts
|
|
|
39
45
|
declare function assertInstanceOf<Value>(constructor: Constructor<Value>, message: string, error?: ErrorConstructor): Asserter<Value>;
|
|
40
46
|
/**
|
|
41
47
|
* Creates an asserter that asserts a value is of a specific type, throwing an error if it is not
|
|
48
|
+
*
|
|
49
|
+
* Available as `assertIs` and `assert.is`
|
|
42
50
|
* @param condition Type guard function to check the value
|
|
43
51
|
* @param message Error message
|
|
44
52
|
* @param error Error constructor
|
|
@@ -46,4 +54,4 @@ declare function assertInstanceOf<Value>(constructor: Constructor<Value>, messag
|
|
|
46
54
|
*/
|
|
47
55
|
declare function assertIs<Value>(condition: (value: unknown) => value is Value, message: string, error?: ErrorConstructor): Asserter<Value>;
|
|
48
56
|
//#endregion
|
|
49
|
-
export { Asserter, assert };
|
|
57
|
+
export { Asserter, assert, assertCondition, assertDefined, assertInstanceOf, assertIs };
|
package/dist/function/assert.mjs
CHANGED
|
@@ -14,6 +14,8 @@ assert.instanceOf = assertInstanceOf;
|
|
|
14
14
|
assert.is = assertIs;
|
|
15
15
|
/**
|
|
16
16
|
* Creates an asserter that asserts a condition is true, throwing an error if it is not
|
|
17
|
+
*
|
|
18
|
+
* Available as `assertCondition` and `assert.condition`
|
|
17
19
|
* @param condition Condition to assert
|
|
18
20
|
* @param message Error message
|
|
19
21
|
* @param error Error constructor
|
|
@@ -26,6 +28,8 @@ function assertCondition(condition, message, error) {
|
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Asserts that a value is defined throwing an error if it is not
|
|
31
|
+
*
|
|
32
|
+
* Available as `assertDefined` and `assert.defined`
|
|
29
33
|
* @param value Value to assert
|
|
30
34
|
* @param message Error message
|
|
31
35
|
*/
|
|
@@ -34,6 +38,8 @@ function assertDefined(value, message) {
|
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* Creates an asserter that asserts a value is an instance of a constructor, throwing an error if it is not
|
|
41
|
+
*
|
|
42
|
+
* Available as `assertInstanceOf` and `assert.instanceOf`
|
|
37
43
|
* @param constructor Constructor to check against
|
|
38
44
|
* @param message Error message
|
|
39
45
|
* @param error Error constructor
|
|
@@ -46,6 +52,8 @@ function assertInstanceOf(constructor, message, error) {
|
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
48
54
|
* Creates an asserter that asserts a value is of a specific type, throwing an error if it is not
|
|
55
|
+
*
|
|
56
|
+
* Available as `assertIs` and `assert.is`
|
|
49
57
|
* @param condition Type guard function to check the value
|
|
50
58
|
* @param message Error message
|
|
51
59
|
* @param error Error constructor
|
|
@@ -58,4 +66,4 @@ function assertIs(condition, message, error) {
|
|
|
58
66
|
}
|
|
59
67
|
const MESSAGE_VALUE_DEFINED = "Expected value to be defined";
|
|
60
68
|
//#endregion
|
|
61
|
-
export { assert };
|
|
69
|
+
export { assert, assertCondition, assertDefined, assertInstanceOf, assertIs };
|
|
@@ -7,6 +7,8 @@ import { AsyncCancelableCallback, CancelableCallback, GenericAsyncCallback, Gene
|
|
|
7
7
|
* When called, successful _(finished)_ results will resolve and errors will reject.
|
|
8
8
|
*
|
|
9
9
|
* On subsequent calls, existing calls will be canceled _(rejected)_, the timer reset, and will wait another `time` milliseconds before the new call is made _(and so on...)_
|
|
10
|
+
*
|
|
11
|
+
* Available as `asyncDebounce` and `debounce.async`
|
|
10
12
|
* @param callback Callback to debounce
|
|
11
13
|
* @param time Time in milliseconds to wait before calling the callback _(defaults to `0`; e.g., as soon as possible)_
|
|
12
14
|
* @returns Debounced callback handler with a `cancel` method
|
|
@@ -18,6 +20,8 @@ declare function asyncDebounce<Callback extends GenericAsyncCallback | GenericCa
|
|
|
18
20
|
* When called, successful _(finished)_ results will resolve and errors will reject.
|
|
19
21
|
*
|
|
20
22
|
* On subsequent calls, existing calls will be canceled _(rejected)_ and will wait until the next valid time to call the callback again _(and so on...)_
|
|
23
|
+
*
|
|
24
|
+
* Available as `asyncThrottle` and `throttle.async`
|
|
21
25
|
* @param callback Callback to throttle
|
|
22
26
|
* @param time Time in milliseconds to wait before calling the callback again _(defaults to `0`; e.g., as soon as possible)_
|
|
23
27
|
* @returns Throttled callback handler with a `cancel` method
|
|
@@ -46,4 +50,4 @@ declare namespace throttle {
|
|
|
46
50
|
var async: typeof asyncThrottle;
|
|
47
51
|
}
|
|
48
52
|
//#endregion
|
|
49
|
-
export { debounce, throttle };
|
|
53
|
+
export { asyncDebounce, asyncThrottle, debounce, throttle };
|
package/dist/function/limit.mjs
CHANGED
|
@@ -6,6 +6,8 @@ import { TIMER_DEBOUNCE, TIMER_THROTTLE, getAsyncTimer, getTimer } from "../inte
|
|
|
6
6
|
* When called, successful _(finished)_ results will resolve and errors will reject.
|
|
7
7
|
*
|
|
8
8
|
* On subsequent calls, existing calls will be canceled _(rejected)_, the timer reset, and will wait another `time` milliseconds before the new call is made _(and so on...)_
|
|
9
|
+
*
|
|
10
|
+
* Available as `asyncDebounce` and `debounce.async`
|
|
9
11
|
* @param callback Callback to debounce
|
|
10
12
|
* @param time Time in milliseconds to wait before calling the callback _(defaults to `0`; e.g., as soon as possible)_
|
|
11
13
|
* @returns Debounced callback handler with a `cancel` method
|
|
@@ -19,6 +21,8 @@ function asyncDebounce(callback, time) {
|
|
|
19
21
|
* When called, successful _(finished)_ results will resolve and errors will reject.
|
|
20
22
|
*
|
|
21
23
|
* On subsequent calls, existing calls will be canceled _(rejected)_ and will wait until the next valid time to call the callback again _(and so on...)_
|
|
24
|
+
*
|
|
25
|
+
* Available as `asyncThrottle` and `throttle.async`
|
|
22
26
|
* @param callback Callback to throttle
|
|
23
27
|
* @param time Time in milliseconds to wait before calling the callback again _(defaults to `0`; e.g., as soon as possible)_
|
|
24
28
|
* @returns Throttled callback handler with a `cancel` method
|
|
@@ -49,4 +53,4 @@ function throttle(callback, time) {
|
|
|
49
53
|
}
|
|
50
54
|
throttle.async = asyncThrottle;
|
|
51
55
|
//#endregion
|
|
52
|
-
export { debounce, throttle };
|
|
56
|
+
export { asyncDebounce, asyncThrottle, debounce, throttle };
|
package/dist/function/once.d.mts
CHANGED
|
@@ -3,6 +3,8 @@ import { GenericAsyncCallback, GenericCallback, OnceAsyncCallback, OnceCallback
|
|
|
3
3
|
//#region src/function/once.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Create an asynchronous function that can only be called once, rejecting or resolving the same result on subsequent calls
|
|
6
|
+
*
|
|
7
|
+
* Available as `asyncOnce` and `once.async`
|
|
6
8
|
* @param callback Callback to use once
|
|
7
9
|
* @returns Once callback
|
|
8
10
|
*/
|
|
@@ -17,4 +19,4 @@ declare namespace once {
|
|
|
17
19
|
var async: typeof asyncOnce;
|
|
18
20
|
}
|
|
19
21
|
//#endregion
|
|
20
|
-
export { once };
|
|
22
|
+
export { asyncOnce, once };
|
package/dist/function/once.mjs
CHANGED
|
@@ -2,6 +2,8 @@ import { assert } from "./assert.mjs";
|
|
|
2
2
|
//#region src/function/once.ts
|
|
3
3
|
/**
|
|
4
4
|
* Create an asynchronous function that can only be called once, rejecting or resolving the same result on subsequent calls
|
|
5
|
+
*
|
|
6
|
+
* Available as `asyncOnce` and `once.async`
|
|
5
7
|
* @param callback Callback to use once
|
|
6
8
|
* @returns Once callback
|
|
7
9
|
*/
|
|
@@ -96,4 +98,4 @@ once.async = asyncOnce;
|
|
|
96
98
|
const MESSAGE_CLEARED = "Once has been cleared";
|
|
97
99
|
const MESSAGE_EXPECTATION = "Once expected a function";
|
|
98
100
|
//#endregion
|
|
99
|
-
export { once };
|
|
101
|
+
export { asyncOnce, once };
|
|
@@ -12,6 +12,8 @@ type RetryOptions = {
|
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Retry a callback a specified number of times, with a delay between attempts
|
|
15
|
+
*
|
|
16
|
+
* Available as `asyncRetry` and `retry.async`
|
|
15
17
|
* @param callback Callback to retry
|
|
16
18
|
* @param options Retry options
|
|
17
19
|
* @returns Callback result
|
|
@@ -19,6 +21,8 @@ type RetryOptions = {
|
|
|
19
21
|
declare function asyncRetry<Callback extends GenericAsyncCallback>(callback: Callback, options?: RetryOptions): Promise<Awaited<ReturnType<Callback>>>;
|
|
20
22
|
/**
|
|
21
23
|
* Retry a callback a specified number of times, with a delay between attempts
|
|
24
|
+
*
|
|
25
|
+
* Available as `asyncRetry` and `retry.async`
|
|
22
26
|
* @param callback Callback to retry
|
|
23
27
|
* @param options Retry options
|
|
24
28
|
* @returns Callback result
|
package/dist/function/retry.mjs
CHANGED
|
@@ -10,6 +10,8 @@ var RetryError = class extends Error {
|
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Retry a callback a specified number of times, with a delay between attempts
|
|
13
|
+
*
|
|
14
|
+
* Available as `asyncRetry` and `retry.async`
|
|
13
15
|
* @param callback Callback to retry
|
|
14
16
|
* @param options Retry options
|
|
15
17
|
* @returns Callback result
|
package/dist/function/work.d.mts
CHANGED
|
@@ -12,61 +12,85 @@ type Flow<Callback extends GenericCallback, Value> = (...args: Parameters<Callba
|
|
|
12
12
|
type FlowPromise<Callback extends GenericCallback, Value> = (...args: Parameters<Callback>) => Promise<UnwrapValue<Value>>;
|
|
13
13
|
/**
|
|
14
14
|
* Create an asynchronous Flow, a function that pipes values through a function
|
|
15
|
+
*
|
|
16
|
+
* Available as `asyncFlow` and `flow.async`
|
|
15
17
|
* @returns Flow function
|
|
16
18
|
*/
|
|
17
19
|
declare function asyncFlow<Fn extends GenericCallback>(fn: Fn): FlowPromise<Fn, ReturnType<Fn>>;
|
|
18
20
|
/**
|
|
19
21
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
22
|
+
*
|
|
23
|
+
* Available as `asyncFlow` and `flow.async`
|
|
20
24
|
* @returns Flow function
|
|
21
25
|
*/
|
|
22
26
|
declare function asyncFlow<First extends GenericCallback, Second>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second): FlowPromise<First, Second>;
|
|
23
27
|
/**
|
|
24
28
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
29
|
+
*
|
|
30
|
+
* Available as `asyncFlow` and `flow.async`
|
|
25
31
|
* @returns Flow function
|
|
26
32
|
*/
|
|
27
33
|
declare function asyncFlow<First extends GenericCallback, Second, Third>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third): FlowPromise<First, Third>;
|
|
28
34
|
/**
|
|
29
35
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
36
|
+
*
|
|
37
|
+
* Available as `asyncFlow` and `flow.async`
|
|
30
38
|
* @returns Flow function
|
|
31
39
|
*/
|
|
32
40
|
declare function asyncFlow<First extends GenericCallback, Second, Third, Fourth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth): FlowPromise<First, Fourth>;
|
|
33
41
|
/**
|
|
34
42
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
43
|
+
*
|
|
44
|
+
* Available as `asyncFlow` and `flow.async`
|
|
35
45
|
* @returns Flow function
|
|
36
46
|
*/
|
|
37
47
|
declare function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth): FlowPromise<First, Fifth>;
|
|
38
48
|
/**
|
|
39
49
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
50
|
+
*
|
|
51
|
+
* Available as `asyncFlow` and `flow.async`
|
|
40
52
|
* @returns Flow function
|
|
41
53
|
*/
|
|
42
54
|
declare function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth): FlowPromise<First, Sixth>;
|
|
43
55
|
/**
|
|
44
56
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
57
|
+
*
|
|
58
|
+
* Available as `asyncFlow` and `flow.async`
|
|
45
59
|
* @returns Flow function
|
|
46
60
|
*/
|
|
47
61
|
declare function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh): FlowPromise<First, Seventh>;
|
|
48
62
|
/**
|
|
49
63
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
64
|
+
*
|
|
65
|
+
* Available as `asyncFlow` and `flow.async`
|
|
50
66
|
* @returns Flow function
|
|
51
67
|
*/
|
|
52
68
|
declare function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth): FlowPromise<First, Eighth>;
|
|
53
69
|
/**
|
|
54
70
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
71
|
+
*
|
|
72
|
+
* Available as `asyncFlow` and `flow.async`
|
|
55
73
|
* @returns Flow function
|
|
56
74
|
*/
|
|
57
75
|
declare function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth): FlowPromise<First, Ninth>;
|
|
58
76
|
/**
|
|
59
77
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
78
|
+
*
|
|
79
|
+
* Available as `asyncFlow` and `flow.async`
|
|
60
80
|
* @returns Flow function
|
|
61
81
|
*/
|
|
62
82
|
declare function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth, tenth: (value: Awaited<UnwrapValue<Ninth>>) => Tenth): FlowPromise<First, Tenth>;
|
|
63
83
|
/**
|
|
64
84
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
85
|
+
*
|
|
86
|
+
* Available as `asyncFlow` and `flow.async`
|
|
65
87
|
* @returns Flow function
|
|
66
88
|
*/
|
|
67
89
|
declare function asyncFlow<Fn extends GenericCallback>(fn: Fn, ...fns: Array<(value: Awaited<UnwrapValue<ReturnType<Fn>>>) => unknown>): FlowPromise<Fn, ReturnType<Fn>>;
|
|
68
90
|
/**
|
|
69
91
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
92
|
+
*
|
|
93
|
+
* Available as `asyncFlow` and `flow.async`
|
|
70
94
|
* @returns Flow function
|
|
71
95
|
*/
|
|
72
96
|
declare function asyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<unknown>;
|
|
@@ -135,72 +159,96 @@ declare namespace flow {
|
|
|
135
159
|
}
|
|
136
160
|
/**
|
|
137
161
|
* Pipe a value through a function
|
|
162
|
+
*
|
|
163
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
138
164
|
* @param value Initial value
|
|
139
165
|
* @returns Piped result
|
|
140
166
|
*/
|
|
141
167
|
declare function asyncPipe<Initial, Piped>(value: Initial, pipe: (value: UnwrapValue<Initial>) => Piped): Promise<UnwrapValue<Piped>>;
|
|
142
168
|
/**
|
|
143
169
|
* Pipe a value through a series of functions
|
|
170
|
+
*
|
|
171
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
144
172
|
* @param value Initial value
|
|
145
173
|
* @returns Piped result
|
|
146
174
|
*/
|
|
147
175
|
declare function asyncPipe<Initial, First, Second>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second): Promise<UnwrapValue<Second>>;
|
|
148
176
|
/**
|
|
149
177
|
* Pipe a value through a series of functions
|
|
178
|
+
*
|
|
179
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
150
180
|
* @param value Initial value
|
|
151
181
|
* @returns Piped result
|
|
152
182
|
*/
|
|
153
183
|
declare function asyncPipe<Initial, First, Second, Third>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third): Promise<UnwrapValue<Third>>;
|
|
154
184
|
/**
|
|
155
185
|
* Pipe a value through a series of functions
|
|
186
|
+
*
|
|
187
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
156
188
|
* @param value Initial value
|
|
157
189
|
* @returns Piped result
|
|
158
190
|
*/
|
|
159
191
|
declare function asyncPipe<Initial, First, Second, Third, Fourth>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): Promise<UnwrapValue<Fourth>>;
|
|
160
192
|
/**
|
|
161
193
|
* Pipe a value through a series of functions
|
|
194
|
+
*
|
|
195
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
162
196
|
* @param value Initial value
|
|
163
197
|
* @returns Piped result
|
|
164
198
|
*/
|
|
165
199
|
declare function asyncPipe<Initial, First, Second, Third, Fourth, Fifth>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): Promise<UnwrapValue<Fifth>>;
|
|
166
200
|
/**
|
|
167
201
|
* Pipe a value through a series of functions
|
|
202
|
+
*
|
|
203
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
168
204
|
* @param value Initial value
|
|
169
205
|
* @returns Piped result
|
|
170
206
|
*/
|
|
171
207
|
declare function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): Promise<UnwrapValue<Sixth>>;
|
|
172
208
|
/**
|
|
173
209
|
* Pipe a value through a series of functions
|
|
210
|
+
*
|
|
211
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
174
212
|
* @param value Initial value
|
|
175
213
|
* @returns Piped result
|
|
176
214
|
*/
|
|
177
215
|
declare function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): Promise<UnwrapValue<Seventh>>;
|
|
178
216
|
/**
|
|
179
217
|
* Pipe a value through a series of functions
|
|
218
|
+
*
|
|
219
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
180
220
|
* @param value Initial value
|
|
181
221
|
* @returns Piped result
|
|
182
222
|
*/
|
|
183
223
|
declare function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): Promise<UnwrapValue<Eighth>>;
|
|
184
224
|
/**
|
|
185
225
|
* Pipe a value through a series of functions
|
|
226
|
+
*
|
|
227
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
186
228
|
* @param value Initial value
|
|
187
229
|
* @returns Piped result
|
|
188
230
|
*/
|
|
189
231
|
declare function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): Promise<UnwrapValue<Ninth>>;
|
|
190
232
|
/**
|
|
191
233
|
* Pipe a value through a series of functions
|
|
234
|
+
*
|
|
235
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
192
236
|
* @param value Initial value
|
|
193
237
|
* @returns Piped result
|
|
194
238
|
*/
|
|
195
239
|
declare function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(value: Initial, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): Promise<UnwrapValue<Tenth>>;
|
|
196
240
|
/**
|
|
197
241
|
* Pipe a value through a series of functions
|
|
242
|
+
*
|
|
243
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
198
244
|
* @param value Initial value
|
|
199
245
|
* @returns Piped result
|
|
200
246
|
*/
|
|
201
247
|
declare function asyncPipe<Value>(value: Value, ...pipes: Array<(value: Value) => Value>): Promise<UnwrapValue<Value>>;
|
|
202
248
|
/**
|
|
203
249
|
* Pipe a value through a series of functions
|
|
250
|
+
*
|
|
251
|
+
* Available as `asyncPipe` and `pipe.async`
|
|
204
252
|
* @param value Initial value
|
|
205
253
|
* @returns Piped result
|
|
206
254
|
*/
|
|
@@ -281,4 +329,4 @@ declare namespace pipe {
|
|
|
281
329
|
var async: typeof asyncPipe;
|
|
282
330
|
}
|
|
283
331
|
//#endregion
|
|
284
|
-
export { Flow, FlowPromise, flow, pipe };
|
|
332
|
+
export { Flow, FlowPromise, asyncFlow, asyncPipe, flow, pipe };
|
package/dist/function/work.mjs
CHANGED
|
@@ -60,4 +60,4 @@ const MESSAGE_PIPE_PROMISE = "Synchronous Pipe received a promise. Use `pipe.asy
|
|
|
60
60
|
const assertFlowFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), MESSAGE_FLOW_ARRAY, TypeError);
|
|
61
61
|
const assertPipeFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), MESSAGE_PIPE_ARRAY, TypeError);
|
|
62
62
|
//#endregion
|
|
63
|
-
export { flow, pipe };
|
|
63
|
+
export { asyncFlow, asyncPipe, flow, pipe };
|