@oscarpalmer/atoms 0.199.0 → 0.201.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/flatten.d.mts +1 -1
- package/dist/array/from.d.mts +1 -1
- package/dist/array/group-by.d.mts +2 -2
- package/dist/array/index.d.mts +2 -2
- package/dist/array/index.mjs +2 -2
- package/dist/array/select.d.mts +71 -64
- package/dist/array/select.mjs +17 -2
- package/dist/array/sort.d.mts +4 -0
- package/dist/array/to-map.d.mts +2 -2
- package/dist/array/to-record.d.mts +2 -2
- package/dist/index.d.mts +131 -113
- package/dist/index.mjs +74 -29
- package/dist/internal/array/compact.d.mts +2 -2
- package/dist/internal/array/find.d.mts +5 -1
- package/dist/internal/array/find.mjs +16 -4
- package/dist/promise/constants.d.mts +3 -1
- package/dist/promise/constants.mjs +3 -1
- package/dist/promise/helpers.d.mts +1 -2
- package/dist/promise/helpers.mjs +9 -1
- package/dist/promise/index.d.mts +34 -36
- package/dist/promise/index.mjs +25 -20
- package/dist/promise/misc.mjs +2 -2
- package/dist/promise/models.d.mts +7 -6
- package/dist/queue.d.mts +4 -0
- package/dist/string/fuzzy.d.mts +2 -0
- package/dist/string/fuzzy.mjs +2 -0
- package/dist/value/freeze.d.mts +2 -0
- package/dist/value/freeze.mjs +2 -0
- package/dist/value/merge.d.mts +1 -1
- package/dist/value/merge.mjs +2 -1
- package/package.json +4 -4
- package/plugin/index.js +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -604,7 +604,7 @@ export declare namespace groupBy {
|
|
|
604
604
|
* // }
|
|
605
605
|
* ```
|
|
606
606
|
*/
|
|
607
|
-
export declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback
|
|
607
|
+
export declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, Array<ReturnType<ValueCallback>>>;
|
|
608
608
|
/**
|
|
609
609
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
610
610
|
*
|
|
@@ -650,7 +650,7 @@ export declare function groupArraysBy<Item extends PlainObject, KeyCallback exte
|
|
|
650
650
|
* // }
|
|
651
651
|
* ```
|
|
652
652
|
*/
|
|
653
|
-
export declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<ValueCallback
|
|
653
|
+
export declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Simplify<Record<KeyedValue<Item, ItemKey>, Array<ReturnType<ValueCallback>>>>;
|
|
654
654
|
/**
|
|
655
655
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
656
656
|
*
|
|
@@ -745,7 +745,7 @@ export declare function chunk<Item>(array: Item[], size?: number): Item[][];
|
|
|
745
745
|
* compact([0, 1, '', 'hello', false, true, null, undefined]); // => [1, 'hello', true]
|
|
746
746
|
* ```
|
|
747
747
|
*/
|
|
748
|
-
export declare function compact<Item>(array: Item[], strict: true): Exclude<Item, 0 | '' | false | null | undefined
|
|
748
|
+
export declare function compact<Item>(array: Item[], strict: true): Array<Exclude<Item, 0 | '' | false | null | undefined>>;
|
|
749
749
|
/**
|
|
750
750
|
* Compact an array _(removing all `null` and `undefined` values)_
|
|
751
751
|
*
|
|
@@ -757,7 +757,7 @@ export declare function compact<Item>(array: Item[], strict: true): Exclude<Item
|
|
|
757
757
|
* compact([0, 1, '', 'hello', false, true, null, undefined]); // => [0, 1, '', 'hello', false, true]
|
|
758
758
|
* ```
|
|
759
759
|
*/
|
|
760
|
-
export declare function compact<Item>(array: Item[]): Exclude<Item, null | undefined
|
|
760
|
+
export declare function compact<Item>(array: Item[]): Array<Exclude<Item, null | undefined>>;
|
|
761
761
|
//#endregion
|
|
762
762
|
//#region src/internal/array/get.d.ts
|
|
763
763
|
/**
|
|
@@ -1516,7 +1516,7 @@ export declare function findLast<Item>(array: Item[], value: Item): Item | undef
|
|
|
1516
1516
|
* flatten([1, [2, [3, 4], 5], 6]); // => [1, 2, 3, 4, 5, 6]
|
|
1517
1517
|
* ```
|
|
1518
1518
|
*/
|
|
1519
|
-
export declare function flatten<Item>(array: Item[]): NestedArray<Item
|
|
1519
|
+
export declare function flatten<Item>(array: Item[]): Array<NestedArray<Item>>;
|
|
1520
1520
|
//#endregion
|
|
1521
1521
|
//#region src/array/from.d.ts
|
|
1522
1522
|
/**
|
|
@@ -1582,7 +1582,7 @@ export declare function times(length: number): number[];
|
|
|
1582
1582
|
* times(5, index => index * 2); // => [0, 2, 4, 6, 8]
|
|
1583
1583
|
* ```
|
|
1584
1584
|
*/
|
|
1585
|
-
export declare function times<Callback extends (index: number) => unknown>(length: number, callback: Callback): ReturnType<Callback
|
|
1585
|
+
export declare function times<Callback extends (index: number) => unknown>(length: number, callback: Callback): Array<ReturnType<Callback>>;
|
|
1586
1586
|
/**
|
|
1587
1587
|
* Get an array with a specified length, filled with a specified value
|
|
1588
1588
|
*
|
|
@@ -1778,110 +1778,112 @@ export declare function push<Item>(array: Item[], pushed: Item[]): number;
|
|
|
1778
1778
|
export declare function reverse<Item>(array: Item[]): Item[];
|
|
1779
1779
|
//#endregion
|
|
1780
1780
|
//#region src/array/select.d.ts
|
|
1781
|
+
type MapKeyOrCallback<Item> = ((item: Item, index: number, array: Item[]) => unknown) | (Item extends PlainObject ? keyof Item : never);
|
|
1782
|
+
type Mapped<Item, Map extends MapKeyOrCallback<Item>> = Map extends ((item: Item, index: number, array: Item[]) => unknown) ? ReturnType<Map> : Map extends keyof Item ? Item[Map] : never;
|
|
1783
|
+
type ObjectKeysOf<Item> = { [Key in keyof Item]: Item[Key] extends PlainObject ? Key : never; }[keyof Item];
|
|
1781
1784
|
/**
|
|
1782
|
-
* Get a
|
|
1785
|
+
* Get a mapped and filtered array of items
|
|
1783
1786
|
*
|
|
1784
1787
|
* @param array Array to search in
|
|
1785
|
-
* @param
|
|
1788
|
+
* @param map Callback or key to map the items
|
|
1789
|
+
* @param filterCallback Callback to get a mapped value's value for matching
|
|
1786
1790
|
* @param filterValue Value to match against
|
|
1787
|
-
* @
|
|
1788
|
-
* @returns Filtered and mapped array of items
|
|
1791
|
+
* @returns Mapped and filtered array of items
|
|
1789
1792
|
*
|
|
1790
1793
|
* @example
|
|
1791
1794
|
* ```typescript
|
|
1792
|
-
*
|
|
1795
|
+
* reverseSelect(
|
|
1793
1796
|
* [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
|
|
1794
|
-
* item => item.id,
|
|
1795
|
-
* 2,
|
|
1796
1797
|
* item => item.name,
|
|
1798
|
+
* value => value.length,
|
|
1799
|
+
* 3,
|
|
1797
1800
|
* ); // => ['Bob']
|
|
1798
1801
|
* ```
|
|
1799
1802
|
*/
|
|
1800
|
-
export declare function
|
|
1803
|
+
export declare function reverseSelect<Item, Map extends MapKeyOrCallback<Item>, FilterCallback extends (item: Mapped<Item, Map>, index: number, array: Item[]) => unknown>(array: Item[], map: Map, filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>): Array<Mapped<Item, Map>>;
|
|
1801
1804
|
/**
|
|
1802
|
-
* Get a
|
|
1805
|
+
* Get a mapped and filtered array of items
|
|
1803
1806
|
*
|
|
1804
1807
|
* @param array Array to search in
|
|
1805
|
-
* @param
|
|
1808
|
+
* @param map Callback to map the items
|
|
1809
|
+
* @param filterKey Key to get a mapped value's value for matching
|
|
1806
1810
|
* @param filterValue Value to match against
|
|
1807
|
-
* @
|
|
1808
|
-
* @returns Filtered and mapped array of items
|
|
1811
|
+
* @returns Mapped and filtered array of items
|
|
1809
1812
|
*
|
|
1810
1813
|
* @example
|
|
1811
1814
|
* ```typescript
|
|
1812
|
-
*
|
|
1815
|
+
* reverseSelect(
|
|
1813
1816
|
* [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
|
|
1814
|
-
* item => item.
|
|
1815
|
-
*
|
|
1816
|
-
* '
|
|
1817
|
-
* ); // => ['Bob']
|
|
1817
|
+
* item => ({label: item.name}),
|
|
1818
|
+
* 'label',
|
|
1819
|
+
* 'Bob',
|
|
1820
|
+
* ); // => [{label: 'Bob'}]
|
|
1818
1821
|
* ```
|
|
1819
1822
|
*/
|
|
1820
|
-
export declare function
|
|
1823
|
+
export declare function reverseSelect<Item, MapCallback extends (item: Item, index: number, array: Item[]) => PlainObject, ItemKey extends keyof ReturnType<MapCallback>>(array: Item[], map: MapCallback, filterKey: ItemKey, filterValue: ReturnType<MapCallback>[ItemKey]): Array<ReturnType<MapCallback>>;
|
|
1821
1824
|
/**
|
|
1822
|
-
* Get a
|
|
1825
|
+
* Get a mapped and filtered array of items
|
|
1823
1826
|
*
|
|
1824
1827
|
* @param array Array to search in
|
|
1825
|
-
* @param
|
|
1828
|
+
* @param map Key to map the items
|
|
1829
|
+
* @param filterKey Key to get a mapped value's value for matching
|
|
1826
1830
|
* @param filterValue Value to match against
|
|
1827
|
-
* @
|
|
1828
|
-
* @returns Filtered and mapped array of items
|
|
1831
|
+
* @returns Mapped and filtered array of items
|
|
1829
1832
|
*
|
|
1830
1833
|
* @example
|
|
1831
1834
|
* ```typescript
|
|
1832
|
-
*
|
|
1833
|
-
* [{
|
|
1834
|
-
* '
|
|
1835
|
-
*
|
|
1836
|
-
*
|
|
1837
|
-
* ); // => ['
|
|
1835
|
+
* reverseSelect(
|
|
1836
|
+
* [{meta: {tag: 'a'}}, {meta: {tag: 'b'}}],
|
|
1837
|
+
* 'meta',
|
|
1838
|
+
* 'tag',
|
|
1839
|
+
* 'b',
|
|
1840
|
+
* ); // => [{tag: 'b'}]
|
|
1838
1841
|
* ```
|
|
1839
1842
|
*/
|
|
1840
|
-
export declare function
|
|
1843
|
+
export declare function reverseSelect<Item, MapKey extends ObjectKeysOf<Item>, ItemKey extends keyof Item[MapKey]>(array: Item[], map: MapKey, filterKey: ItemKey, filterValue: Item[MapKey][ItemKey]): Array<Item[MapKey]>;
|
|
1841
1844
|
/**
|
|
1842
|
-
* Get a
|
|
1845
|
+
* Get a mapped and filtered array of items
|
|
1843
1846
|
*
|
|
1844
1847
|
* @param array Array to search in
|
|
1845
|
-
* @param
|
|
1846
|
-
* @param
|
|
1847
|
-
* @
|
|
1848
|
-
* @returns Filtered and mapped array of items
|
|
1848
|
+
* @param map Callback or key to map the items
|
|
1849
|
+
* @param filter Filter callback to match mapped values
|
|
1850
|
+
* @returns Mapped and filtered array of items
|
|
1849
1851
|
*
|
|
1850
1852
|
* @example
|
|
1851
1853
|
* ```typescript
|
|
1852
|
-
*
|
|
1854
|
+
* reverseSelect(
|
|
1853
1855
|
* [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
|
|
1854
|
-
*
|
|
1855
|
-
*
|
|
1856
|
-
* 'name',
|
|
1856
|
+
* item => item.name,
|
|
1857
|
+
* value => value.startsWith('B'),
|
|
1857
1858
|
* ); // => ['Bob']
|
|
1858
1859
|
* ```
|
|
1859
1860
|
*/
|
|
1860
|
-
export declare function
|
|
1861
|
+
export declare function reverseSelect<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, filter: (item: Mapped<Item, Map>, index: number, array: Item[]) => boolean): Array<Mapped<Item, Map>>;
|
|
1861
1862
|
/**
|
|
1862
|
-
* Get a
|
|
1863
|
+
* Get a mapped and filtered array of items
|
|
1863
1864
|
*
|
|
1864
1865
|
* @param array Array to search in
|
|
1865
|
-
* @param
|
|
1866
|
-
* @param
|
|
1867
|
-
* @returns
|
|
1866
|
+
* @param map Callback or key to map the items
|
|
1867
|
+
* @param value Mapped value to match against
|
|
1868
|
+
* @returns Mapped and filtered array of items
|
|
1868
1869
|
*
|
|
1869
1870
|
* @example
|
|
1870
1871
|
* ```typescript
|
|
1871
|
-
*
|
|
1872
|
-
* [
|
|
1873
|
-
*
|
|
1874
|
-
*
|
|
1875
|
-
* ); // => [
|
|
1872
|
+
* reverseSelect(
|
|
1873
|
+
* [1, 2, 3, 2, 1],
|
|
1874
|
+
* value => value ** 2,
|
|
1875
|
+
* 4,
|
|
1876
|
+
* ); // => [4, 4]
|
|
1876
1877
|
* ```
|
|
1877
1878
|
*/
|
|
1878
|
-
export declare function
|
|
1879
|
+
export declare function reverseSelect<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, value: Mapped<Item, Map>): Array<Mapped<Item, Map>>;
|
|
1879
1880
|
/**
|
|
1880
1881
|
* Get a filtered and mapped array of items
|
|
1881
1882
|
*
|
|
1882
1883
|
* @param array Array to search in
|
|
1883
|
-
* @param filterCallback
|
|
1884
|
-
* @param
|
|
1884
|
+
* @param filterCallback Callback to get an item's value for matching
|
|
1885
|
+
* @param filterValue Value to match against
|
|
1886
|
+
* @param map Callback or key to map the matched items
|
|
1885
1887
|
* @returns Filtered and mapped array of items
|
|
1886
1888
|
*
|
|
1887
1889
|
* @example
|
|
@@ -1890,35 +1892,37 @@ export declare function select<Item, FilterCallback extends (item: Item, index:
|
|
|
1890
1892
|
* [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
|
|
1891
1893
|
* item => item.id,
|
|
1892
1894
|
* 2,
|
|
1893
|
-
*
|
|
1895
|
+
* item => item.name,
|
|
1894
1896
|
* ); // => ['Bob']
|
|
1895
1897
|
* ```
|
|
1896
1898
|
*/
|
|
1897
|
-
export declare function select<Item
|
|
1899
|
+
export declare function select<Item, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, Map extends MapKeyOrCallback<Item>>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, map: Map): Array<Mapped<Item, Map>>;
|
|
1898
1900
|
/**
|
|
1899
1901
|
* Get a filtered and mapped array of items
|
|
1900
1902
|
*
|
|
1901
1903
|
* @param array Array to search in
|
|
1902
|
-
* @param
|
|
1903
|
-
* @param
|
|
1904
|
+
* @param filterKey Key to get an item's value for matching
|
|
1905
|
+
* @param filterValue Value to match against
|
|
1906
|
+
* @param map Callback or key to map the matched items
|
|
1904
1907
|
* @returns Filtered and mapped array of items
|
|
1905
1908
|
*
|
|
1906
1909
|
* @example
|
|
1907
1910
|
* ```typescript
|
|
1908
1911
|
* select(
|
|
1909
1912
|
* [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1913
|
+
* 'id',
|
|
1914
|
+
* 2,
|
|
1915
|
+
* 'name',
|
|
1912
1916
|
* ); // => ['Bob']
|
|
1913
1917
|
* ```
|
|
1914
1918
|
*/
|
|
1915
|
-
export declare function select<Item,
|
|
1919
|
+
export declare function select<Item extends PlainObject, ItemKey extends keyof Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], map: Map): Array<Mapped<Item, Map>>;
|
|
1916
1920
|
/**
|
|
1917
1921
|
* Get a filtered and mapped array of items
|
|
1918
1922
|
*
|
|
1919
1923
|
* @param array Array to search in
|
|
1920
1924
|
* @param filter Filter callback to match items
|
|
1921
|
-
* @param map
|
|
1925
|
+
* @param map Callback or key to map the matched items
|
|
1922
1926
|
* @returns Filtered and mapped array of items
|
|
1923
1927
|
*
|
|
1924
1928
|
* @example
|
|
@@ -1926,17 +1930,17 @@ export declare function select<Item, MapCallback extends (item: Item, index: num
|
|
|
1926
1930
|
* select(
|
|
1927
1931
|
* [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
|
|
1928
1932
|
* item => item.id === 2,
|
|
1929
|
-
*
|
|
1933
|
+
* item => item.name,
|
|
1930
1934
|
* ); // => ['Bob']
|
|
1931
1935
|
* ```
|
|
1932
1936
|
*/
|
|
1933
|
-
export declare function select<Item
|
|
1937
|
+
export declare function select<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: Map): Array<Mapped<Item, Map>>;
|
|
1934
1938
|
/**
|
|
1935
1939
|
* Get a filtered and mapped array of items
|
|
1936
1940
|
*
|
|
1937
1941
|
* @param array Array to search in
|
|
1938
1942
|
* @param item Item to match against
|
|
1939
|
-
* @param map Callback to map the matched items
|
|
1943
|
+
* @param map Callback or key to map the matched items
|
|
1940
1944
|
* @returns Filtered and mapped array of items
|
|
1941
1945
|
*
|
|
1942
1946
|
* @example
|
|
@@ -1948,7 +1952,10 @@ export declare function select<Item extends PlainObject, MapKey extends keyof It
|
|
|
1948
1952
|
* ); // => [9]
|
|
1949
1953
|
* ```
|
|
1950
1954
|
*/
|
|
1951
|
-
export declare function select<Item,
|
|
1955
|
+
export declare function select<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], item: Item, map: Map): Array<Mapped<Item, Map>>;
|
|
1956
|
+
export declare namespace select {
|
|
1957
|
+
var reverse: typeof reverseSelect;
|
|
1958
|
+
}
|
|
1952
1959
|
//#endregion
|
|
1953
1960
|
//#region src/array/single.d.ts
|
|
1954
1961
|
/**
|
|
@@ -3017,6 +3024,8 @@ export declare function initializeSorter<Item>(descending?: boolean): Sorter<Ite
|
|
|
3017
3024
|
/**
|
|
3018
3025
|
* Is the array sorted according to the sorters _(and the optional default direction)_?
|
|
3019
3026
|
*
|
|
3027
|
+
* _Available as `isSorted` and `sort.is`_
|
|
3028
|
+
*
|
|
3020
3029
|
* @param array Array to check
|
|
3021
3030
|
* @param sorters Sorters to determine sorting
|
|
3022
3031
|
* @param descending Sorted in descending order? _(defaults to `false`; overridden by individual sorters)_
|
|
@@ -3026,6 +3035,8 @@ export declare function isSorted<Item>(array: Item[], sorters: Array<ArraySorter
|
|
|
3026
3035
|
/**
|
|
3027
3036
|
* Is the array sorted according to the sorter _(and the optional default direction)_?
|
|
3028
3037
|
*
|
|
3038
|
+
* _Available as `isSorted` and `sort.is`_
|
|
3039
|
+
*
|
|
3029
3040
|
* @param array Array to check
|
|
3030
3041
|
* @param sorter Sorter to determine sorting
|
|
3031
3042
|
* @param descending Sorted in descending order? _(defaults to `false`; overridden by individual sorters)_
|
|
@@ -3430,7 +3441,7 @@ export declare namespace toMap {
|
|
|
3430
3441
|
* ); // => Map { 10 => [1, 3], 20 => [2] }
|
|
3431
3442
|
* ```
|
|
3432
3443
|
*/
|
|
3433
|
-
export declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback
|
|
3444
|
+
export declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, Array<ReturnType<ValueCallback>>>;
|
|
3434
3445
|
/**
|
|
3435
3446
|
* Create a _Map_ from an array of items using a callback and value, grouping values into arrays
|
|
3436
3447
|
*
|
|
@@ -3470,7 +3481,7 @@ export declare function toMapArrays<Item extends PlainObject, KeyCallback extend
|
|
|
3470
3481
|
* ); // => Map { 10 => [1, 3], 20 => [2] }
|
|
3471
3482
|
* ```
|
|
3472
3483
|
*/
|
|
3473
|
-
export 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
|
|
3484
|
+
export 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], Array<ReturnType<ValueCallback>>>;
|
|
3474
3485
|
/**
|
|
3475
3486
|
* Create a _Map_ from an array of items using a key and value, grouping values into arrays
|
|
3476
3487
|
*
|
|
@@ -3681,7 +3692,7 @@ export declare namespace toRecord {
|
|
|
3681
3692
|
* ); // => { 10: [1, 3], 20: [2] }
|
|
3682
3693
|
* ```
|
|
3683
3694
|
*/
|
|
3684
|
-
export declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback
|
|
3695
|
+
export declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, Array<ReturnType<ValueCallback>>>;
|
|
3685
3696
|
/**
|
|
3686
3697
|
* Create a record from an array of items using a callback and value, grouping values into arrays
|
|
3687
3698
|
*
|
|
@@ -3721,7 +3732,7 @@ export declare function toRecordArrays<Item extends PlainObject, Callback extend
|
|
|
3721
3732
|
* ); // => { 10: [1, 3], 20: [2] }
|
|
3722
3733
|
* ```
|
|
3723
3734
|
*/
|
|
3724
|
-
export 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
|
|
3735
|
+
export 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>, Array<ReturnType<Callback>>>>;
|
|
3725
3736
|
/**
|
|
3726
3737
|
* Create a record from an array of items using a key and value, grouping values into arrays
|
|
3727
3738
|
*
|
|
@@ -5008,7 +5019,7 @@ export type FulfilledPromise<Value> = {
|
|
|
5008
5019
|
};
|
|
5009
5020
|
export type PromiseData = {
|
|
5010
5021
|
last: number;
|
|
5011
|
-
result:
|
|
5022
|
+
result: ArrayOrPlainObject;
|
|
5012
5023
|
};
|
|
5013
5024
|
export type PromiseHandlers = {
|
|
5014
5025
|
resolve: (value: unknown[]) => void;
|
|
@@ -5033,6 +5044,7 @@ export type PromiseParameters = {
|
|
|
5033
5044
|
data: PromiseData;
|
|
5034
5045
|
handlers: PromiseHandlers;
|
|
5035
5046
|
index: number;
|
|
5047
|
+
key: Key$1;
|
|
5036
5048
|
value?: unknown;
|
|
5037
5049
|
};
|
|
5038
5050
|
/**
|
|
@@ -5048,7 +5060,7 @@ export type PromiseStrategy = 'complete' | 'first';
|
|
|
5048
5060
|
export declare class PromiseTimeoutError extends Error {
|
|
5049
5061
|
constructor();
|
|
5050
5062
|
}
|
|
5051
|
-
export type PromisesItems<Items extends
|
|
5063
|
+
export type PromisesItems<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Promise<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Promise<Value> : Promise<Items[ItemsKey]>; };
|
|
5052
5064
|
/**
|
|
5053
5065
|
* Options for handling multiple _Promises_
|
|
5054
5066
|
*/
|
|
@@ -5062,10 +5074,10 @@ export type PromisesOptions = {
|
|
|
5062
5074
|
*/
|
|
5063
5075
|
strategy?: PromiseStrategy;
|
|
5064
5076
|
};
|
|
5065
|
-
export type PromisesResult<Items extends
|
|
5066
|
-
export type PromisesUnwrapped<Items extends
|
|
5077
|
+
export type PromisesResult<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends Promise<infer Value> ? Result<Awaited<Value>> : never; };
|
|
5078
|
+
export type PromisesUnwrapped<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Awaited<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Awaited<Value> : never; };
|
|
5067
5079
|
export type PromisesValue<Value> = FulfilledPromise<Value> | RejectedPromise;
|
|
5068
|
-
export type PromisesValues<Items extends
|
|
5080
|
+
export type PromisesValues<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never; };
|
|
5069
5081
|
/**
|
|
5070
5082
|
* A _Promise_ that was rejected
|
|
5071
5083
|
*/
|
|
@@ -5098,7 +5110,7 @@ export declare function delay(time?: number): Promise<void>;
|
|
|
5098
5110
|
//#endregion
|
|
5099
5111
|
//#region src/promise/index.d.ts
|
|
5100
5112
|
/**
|
|
5101
|
-
* Wrap a _Promise_ with safety handlers
|
|
5113
|
+
* Wrap a _Promise_ with safety handlers
|
|
5102
5114
|
*
|
|
5103
5115
|
* @param promise _Promise_ to wrap
|
|
5104
5116
|
* @param options Options for the _Promise_
|
|
@@ -5106,7 +5118,7 @@ export declare function delay(time?: number): Promise<void>;
|
|
|
5106
5118
|
*/
|
|
5107
5119
|
export declare function attemptPromise<Value>(promise: Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
|
|
5108
5120
|
/**
|
|
5109
|
-
* Wrap a _Promise_-returning callback with safety handlers
|
|
5121
|
+
* Wrap a _Promise_-returning callback with safety handlers
|
|
5110
5122
|
*
|
|
5111
5123
|
* @param callback Callback to wrap
|
|
5112
5124
|
* @param options Options for the _Promise_
|
|
@@ -5114,7 +5126,7 @@ export declare function attemptPromise<Value>(promise: Promise<Value>, options?:
|
|
|
5114
5126
|
*/
|
|
5115
5127
|
export declare function attemptPromise<Value>(callback: () => Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
|
|
5116
5128
|
/**
|
|
5117
|
-
* Wrap a callback with a _Promise_ and safety handlers
|
|
5129
|
+
* Wrap a callback with a _Promise_ and safety handlers
|
|
5118
5130
|
*
|
|
5119
5131
|
* @param callback Callback to wrap
|
|
5120
5132
|
* @param options Options for the _Promise_
|
|
@@ -5124,7 +5136,7 @@ export declare function attemptPromise<Value>(callback: () => Value, options?: P
|
|
|
5124
5136
|
/**
|
|
5125
5137
|
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5126
5138
|
*
|
|
5127
|
-
*
|
|
5139
|
+
* _Depending on the strategy, the function will either reject on the first error encountered or return an array of rejected and resolved results_
|
|
5128
5140
|
*
|
|
5129
5141
|
* @param items List of _Promises_
|
|
5130
5142
|
* @param options Options for handling the _Promises_
|
|
@@ -5132,78 +5144,76 @@ export declare function attemptPromise<Value>(callback: () => Value, options?: P
|
|
|
5132
5144
|
*/
|
|
5133
5145
|
export declare function promises<Items extends unknown[], Options extends PromisesOptions>(items: [...Items], options?: Options): Promise<Options['strategy'] extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5134
5146
|
/**
|
|
5135
|
-
* Handle
|
|
5147
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
5136
5148
|
*
|
|
5137
|
-
*
|
|
5149
|
+
* _Depending on the strategy, the function will either reject on the first error encountered or return an object of rejected and resolved results_
|
|
5138
5150
|
*
|
|
5139
|
-
* @param items
|
|
5151
|
+
* @param items Keyed _Promises_
|
|
5140
5152
|
* @param options Options for handling the _Promises_
|
|
5141
|
-
* @returns
|
|
5153
|
+
* @returns Keyed object of results
|
|
5142
5154
|
*/
|
|
5143
|
-
export declare function promises<
|
|
5155
|
+
export declare function promises<Items extends PlainObject, Options extends PromisesOptions>(items: Items, options?: Options): Promise<Options['strategy'] extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5144
5156
|
/**
|
|
5145
5157
|
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5146
5158
|
*
|
|
5147
|
-
*
|
|
5159
|
+
* _If the strategy is `first`, the function will reject on the first error encountered; otherwise, it returns an array of rejected and resolved results_
|
|
5148
5160
|
*
|
|
5149
5161
|
* @param items List of _Promises_
|
|
5150
|
-
* @param strategy Strategy for handling the _Promises_
|
|
5162
|
+
* @param strategy Strategy for handling the _Promises_
|
|
5151
5163
|
* @returns List of results
|
|
5152
5164
|
*/
|
|
5153
|
-
export declare function promises<Items extends unknown[]>(items: [...Items], strategy:
|
|
5165
|
+
export declare function promises<Items extends unknown[], Strategy extends PromiseStrategy>(items: [...Items], strategy: Strategy): Promise<Strategy extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5154
5166
|
/**
|
|
5155
|
-
* Handle
|
|
5167
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
5156
5168
|
*
|
|
5157
|
-
*
|
|
5169
|
+
* _If the strategy is `first`, the function will reject on the first error encountered; otherwise, it returns an object of rejected and resolved results_
|
|
5158
5170
|
*
|
|
5159
|
-
* @param items
|
|
5160
|
-
* @param strategy Strategy for handling the _Promises_
|
|
5161
|
-
* @returns
|
|
5171
|
+
* @param items Keyed _Promises_
|
|
5172
|
+
* @param strategy Strategy for handling the _Promises_
|
|
5173
|
+
* @returns Keyed object of results
|
|
5162
5174
|
*/
|
|
5163
|
-
export declare function promises<
|
|
5175
|
+
export declare function promises<Items extends PlainObject, Strategy extends PromiseStrategy>(items: Items, strategy: Strategy): Promise<Strategy extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5164
5176
|
/**
|
|
5165
|
-
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5177
|
+
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5166
5178
|
*
|
|
5167
5179
|
* @param items List of _Promises_
|
|
5168
|
-
* @param signal
|
|
5180
|
+
* @param signal _AbortSignal_ for aborting all _Promises_
|
|
5169
5181
|
* @returns List of results
|
|
5170
5182
|
*/
|
|
5171
5183
|
export declare function promises<Items extends unknown[]>(items: [...Items], signal?: AbortSignal): Promise<PromisesValues<PromisesItems<Items>>>;
|
|
5172
5184
|
/**
|
|
5173
|
-
* Handle
|
|
5185
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
5174
5186
|
*
|
|
5175
|
-
* @param items
|
|
5176
|
-
* @param signal
|
|
5177
|
-
* @returns
|
|
5187
|
+
* @param items Keyed _Promises_
|
|
5188
|
+
* @param signal _AbortSignal_ for aborting all _Promises_
|
|
5189
|
+
* @returns Keyed object of results
|
|
5178
5190
|
*/
|
|
5179
|
-
export declare function promises<
|
|
5191
|
+
export declare function promises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesValues<PromisesItems<Items>>>;
|
|
5180
5192
|
export declare namespace promises {
|
|
5181
5193
|
var result: typeof resultPromises;
|
|
5182
5194
|
}
|
|
5183
5195
|
/**
|
|
5184
5196
|
* Handle a list of _Promises_, returning their results in an ordered array of results _({@link Result})_
|
|
5185
5197
|
*
|
|
5186
|
-
*
|
|
5198
|
+
* _Depending on the strategy, the function will either reject on the first error encountered or return an array of rejected and resolved results_
|
|
5187
5199
|
*
|
|
5188
5200
|
* _Available as `resultPromises` and `promises.result`_
|
|
5189
5201
|
*
|
|
5190
5202
|
* @param items List of _Promises_
|
|
5191
|
-
* @param signal AbortSignal for aborting
|
|
5203
|
+
* @param signal AbortSignal for aborting all _Promises_
|
|
5192
5204
|
* @returns List of results
|
|
5193
5205
|
*/
|
|
5194
5206
|
export declare function resultPromises<Items extends unknown[]>(items: [...Items], signal?: AbortSignal): Promise<PromisesResult<PromisesItems<Items>>>;
|
|
5195
5207
|
/**
|
|
5196
|
-
* Handle
|
|
5197
|
-
*
|
|
5198
|
-
* Depending on the strategy, the function will either reject on the first error encountered or return an array of rejected and resolved results
|
|
5208
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object of results _({@link Result})_
|
|
5199
5209
|
*
|
|
5200
5210
|
* _Available as `resultPromises` and `promises.result`_
|
|
5201
5211
|
*
|
|
5202
|
-
* @param items
|
|
5203
|
-
* @param signal AbortSignal for aborting
|
|
5204
|
-
* @returns
|
|
5212
|
+
* @param items Keyed _Promises_
|
|
5213
|
+
* @param signal AbortSignal for aborting all _Promises_
|
|
5214
|
+
* @returns Keyed object of results
|
|
5205
5215
|
*/
|
|
5206
|
-
export declare function resultPromises<
|
|
5216
|
+
export declare function resultPromises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesResult<PromisesItems<Items>>>;
|
|
5207
5217
|
//#endregion
|
|
5208
5218
|
//#region src/internal/result/misc.d.ts
|
|
5209
5219
|
/**
|
|
@@ -5947,6 +5957,8 @@ export declare namespace fuzzy {
|
|
|
5947
5957
|
/**
|
|
5948
5958
|
* Does the needle match the haystack in a fuzzy way?
|
|
5949
5959
|
*
|
|
5960
|
+
* _Available as `fuzzyMatch` and `fuzzy.match`_
|
|
5961
|
+
*
|
|
5950
5962
|
* @param haystack Haystack to search through
|
|
5951
5963
|
* @param needle Needle to search for
|
|
5952
5964
|
* @returns `true` if the needle matches the haystack in a fuzzy way, otherwise `false`
|
|
@@ -6486,6 +6498,8 @@ export declare namespace freeze {
|
|
|
6486
6498
|
/**
|
|
6487
6499
|
* Is the value frozen?
|
|
6488
6500
|
*
|
|
6501
|
+
* _Available as `isFrozen` and `freeze.is`_
|
|
6502
|
+
*
|
|
6489
6503
|
* @param value Value to check
|
|
6490
6504
|
* @returns `true` if the value is frozen, otherwise `false`
|
|
6491
6505
|
*/
|
|
@@ -6615,7 +6629,7 @@ export type Merger = {
|
|
|
6615
6629
|
* @param values Values to merge
|
|
6616
6630
|
* @returns Merged value
|
|
6617
6631
|
*/
|
|
6618
|
-
<Values extends ArrayOrPlainObject[]>(values: NestedPartial<Values[number]
|
|
6632
|
+
<Values extends ArrayOrPlainObject[]>(values: Array<NestedPartial<Values[number]>>): UnionToIntersection<Values[number]>;
|
|
6619
6633
|
};
|
|
6620
6634
|
/**
|
|
6621
6635
|
* Assign values from one or more objects to the first one
|
|
@@ -8499,6 +8513,8 @@ export declare function isQueueInstance<Instance>(name: string, value: unknown):
|
|
|
8499
8513
|
/**
|
|
8500
8514
|
* Create a keyed queue for an asynchronous callback function, where each key has its own queue
|
|
8501
8515
|
*
|
|
8516
|
+
* _Available as `keyedQueue` and `queue.keyed`_
|
|
8517
|
+
*
|
|
8502
8518
|
* @param callback Callback function for queued items
|
|
8503
8519
|
* @param options Queue options
|
|
8504
8520
|
*/
|
|
@@ -8506,6 +8522,8 @@ export declare function keyedQueue<Callback extends (key: string, ...parameters:
|
|
|
8506
8522
|
/**
|
|
8507
8523
|
* Create a keyed queue for an asynchronous callback function, where each key has its own queue
|
|
8508
8524
|
*
|
|
8525
|
+
* _Available as `keyedQueue` and `queue.keyed`_
|
|
8526
|
+
*
|
|
8509
8527
|
* @param callback Callback function for queued items
|
|
8510
8528
|
* @param options Queue options
|
|
8511
8529
|
*/
|