@ls-stack/utils 3.40.0 → 3.42.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.
Files changed (159) hide show
  1. package/dist/arrayUtils.d.cts +70 -57
  2. package/dist/arrayUtils.d.ts +70 -57
  3. package/dist/assertions.d.cts +128 -117
  4. package/dist/assertions.d.ts +128 -117
  5. package/dist/asyncQueue.cjs +117 -112
  6. package/dist/asyncQueue.d.cts +217 -215
  7. package/dist/asyncQueue.d.ts +217 -215
  8. package/dist/asyncQueue.js +117 -112
  9. package/dist/awaitDebounce.d.cts +26 -23
  10. package/dist/awaitDebounce.d.ts +26 -23
  11. package/dist/cache.cjs +2 -1
  12. package/dist/cache.d.cts +15 -9
  13. package/dist/cache.d.ts +15 -9
  14. package/dist/cache.js +2 -1
  15. package/dist/{chunk-ADM37GSC.js → chunk-7L4KCZJJ.js} +12 -10
  16. package/dist/{chunk-KW55OTUG.js → chunk-B3KFV2MH.js} +2 -2
  17. package/dist/chunk-GMJTLFM6.js +60 -0
  18. package/dist/{chunk-GHAQOUA6.js → chunk-Y45CE75W.js} +22 -1
  19. package/dist/concurrentCalls.d.cts +8 -4
  20. package/dist/concurrentCalls.d.ts +8 -4
  21. package/dist/concurrentCalls.js +1 -1
  22. package/dist/debounce.d.cts +12 -20
  23. package/dist/debounce.d.ts +12 -20
  24. package/dist/dedent.d.cts +31 -31
  25. package/dist/dedent.d.ts +31 -31
  26. package/dist/deepEqual.d.cts +10 -9
  27. package/dist/deepEqual.d.ts +10 -9
  28. package/dist/filterObjectOrArrayKeys.d.cts +44 -19
  29. package/dist/filterObjectOrArrayKeys.d.ts +44 -19
  30. package/dist/getAutoIncrementId.d.cts +25 -23
  31. package/dist/getAutoIncrementId.d.ts +25 -23
  32. package/dist/getCompositeKey.d.cts +2 -1
  33. package/dist/getCompositeKey.d.ts +2 -1
  34. package/dist/getValueStableKey.d.cts +4 -3
  35. package/dist/getValueStableKey.d.ts +4 -3
  36. package/dist/mutationUtils.d.cts +2 -2
  37. package/dist/mutationUtils.d.ts +2 -2
  38. package/dist/objUtils.cjs +51 -2
  39. package/dist/objUtils.d.cts +8 -3
  40. package/dist/objUtils.d.ts +8 -3
  41. package/dist/objUtils.js +11 -3
  42. package/dist/parallelAsyncCalls.cjs +2 -1
  43. package/dist/parallelAsyncCalls.d.cts +5 -4
  44. package/dist/parallelAsyncCalls.d.ts +5 -4
  45. package/dist/parallelAsyncCalls.js +2 -1
  46. package/dist/retryOnError.d.cts +23 -20
  47. package/dist/retryOnError.d.ts +23 -20
  48. package/dist/runShellCmd.d.cts +40 -40
  49. package/dist/runShellCmd.d.ts +40 -40
  50. package/dist/safeJson.d.cts +6 -2
  51. package/dist/safeJson.d.ts +6 -2
  52. package/dist/saferTyping.d.cts +21 -14
  53. package/dist/saferTyping.d.ts +21 -14
  54. package/dist/shallowEqual.d.cts +1 -1
  55. package/dist/shallowEqual.d.ts +1 -1
  56. package/dist/stringUtils.cjs +2 -2
  57. package/dist/stringUtils.d.cts +6 -7
  58. package/dist/stringUtils.d.ts +6 -7
  59. package/dist/stringUtils.js +1 -1
  60. package/dist/testUtils.cjs +11 -9
  61. package/dist/testUtils.d.cts +32 -14
  62. package/dist/testUtils.d.ts +32 -14
  63. package/dist/testUtils.js +4 -3
  64. package/dist/throttle.d.cts +57 -48
  65. package/dist/throttle.d.ts +57 -48
  66. package/dist/timers.d.cts +68 -63
  67. package/dist/timers.d.ts +68 -63
  68. package/dist/tsResult.d.cts +7 -6
  69. package/dist/tsResult.d.ts +7 -6
  70. package/dist/typeGuards.d.cts +65 -64
  71. package/dist/typeGuards.d.ts +65 -64
  72. package/dist/typeUtils.d.cts +18 -4
  73. package/dist/typeUtils.d.ts +18 -4
  74. package/dist/typedStrings.d.cts +68 -57
  75. package/dist/typedStrings.d.ts +68 -57
  76. package/dist/typingFnUtils.cjs +15 -0
  77. package/dist/typingFnUtils.d.cts +34 -7
  78. package/dist/typingFnUtils.d.ts +34 -7
  79. package/dist/typingFnUtils.js +18 -35
  80. package/dist/typingTestUtils.cjs +7 -1
  81. package/dist/typingTestUtils.d.cts +52 -11
  82. package/dist/typingTestUtils.d.ts +52 -11
  83. package/dist/typingTestUtils.js +7 -1
  84. package/dist/typingUtils.d.cts +4 -1
  85. package/dist/typingUtils.d.ts +4 -1
  86. package/dist/yamlStringify.cjs +11 -9
  87. package/dist/yamlStringify.js +2 -2
  88. package/package.json +5 -1
  89. package/docs/README.md +0 -72
  90. package/docs/_media/modules.md +0 -58
  91. package/docs/arrayUtils/-internal-.md +0 -179
  92. package/docs/arrayUtils/README.md +0 -550
  93. package/docs/assertions/-internal-.md +0 -63
  94. package/docs/assertions/README.md +0 -565
  95. package/docs/asyncQueue/-internal-.md +0 -297
  96. package/docs/asyncQueue/README.md +0 -1485
  97. package/docs/awaitDebounce.md +0 -66
  98. package/docs/cache/-internal-.md +0 -168
  99. package/docs/cache/README.md +0 -360
  100. package/docs/castValues.md +0 -47
  101. package/docs/concurrentCalls/-internal-.md +0 -490
  102. package/docs/concurrentCalls/README.md +0 -299
  103. package/docs/consoleFmt.md +0 -115
  104. package/docs/conversions.md +0 -27
  105. package/docs/createThrottleController/-internal-.md +0 -73
  106. package/docs/createThrottleController/README.md +0 -31
  107. package/docs/debounce.md +0 -188
  108. package/docs/dedent/-internal-.md +0 -17
  109. package/docs/dedent/README.md +0 -204
  110. package/docs/deepEqual.md +0 -94
  111. package/docs/enhancedMap.md +0 -358
  112. package/docs/exhaustiveMatch/-internal-.md +0 -39
  113. package/docs/exhaustiveMatch/README.md +0 -146
  114. package/docs/filterObjectOrArrayKeys.md +0 -109
  115. package/docs/getAutoIncrementId.md +0 -93
  116. package/docs/getCompositeKey.md +0 -39
  117. package/docs/getValueStableKey.md +0 -57
  118. package/docs/hash.md +0 -31
  119. package/docs/interpolate/-internal-.md +0 -61
  120. package/docs/interpolate/README.md +0 -62
  121. package/docs/keepPrevIfUnchanged.md +0 -43
  122. package/docs/levenshtein.md +0 -93
  123. package/docs/main.md +0 -21
  124. package/docs/mathUtils.md +0 -137
  125. package/docs/modules.md +0 -58
  126. package/docs/mutationUtils.md +0 -44
  127. package/docs/objUtils.md +0 -237
  128. package/docs/parallelAsyncCalls/-internal-.md +0 -347
  129. package/docs/parallelAsyncCalls/README.md +0 -45
  130. package/docs/promiseUtils/-internal-.md +0 -69
  131. package/docs/promiseUtils/README.md +0 -31
  132. package/docs/retryOnError/-internal-.md +0 -111
  133. package/docs/retryOnError/README.md +0 -168
  134. package/docs/runShellCmd/-internal-.md +0 -111
  135. package/docs/runShellCmd/README.md +0 -201
  136. package/docs/safeJson.md +0 -51
  137. package/docs/saferTyping.md +0 -228
  138. package/docs/serializeXML.md +0 -100
  139. package/docs/shallowEqual.md +0 -33
  140. package/docs/sleep.md +0 -27
  141. package/docs/stringUtils/-internal-.md +0 -17
  142. package/docs/stringUtils/README.md +0 -270
  143. package/docs/testUtils.md +0 -382
  144. package/docs/throttle/-internal-.md +0 -47
  145. package/docs/throttle/README.md +0 -178
  146. package/docs/time.md +0 -274
  147. package/docs/timers.md +0 -256
  148. package/docs/tsResult/-internal-.md +0 -327
  149. package/docs/tsResult/README.md +0 -702
  150. package/docs/typeGuards.md +0 -399
  151. package/docs/typeUtils/-internal-.md +0 -99
  152. package/docs/typeUtils/README.md +0 -195
  153. package/docs/typeUtils.typesTest.md +0 -7
  154. package/docs/typedStrings.md +0 -458
  155. package/docs/typingFnUtils/-internal-.md +0 -43
  156. package/docs/typingFnUtils/README.md +0 -317
  157. package/docs/typingTestUtils.md +0 -172
  158. package/docs/typingUtils.md +0 -135
  159. package/docs/yamlStringify.md +0 -83
@@ -1,27 +1,26 @@
1
1
  /**
2
- * allow to filter and map with better typing ergonomics
2
+ * Allow to filter and map with better typing ergonomics
3
3
  *
4
4
  * In the `mapFilter` function return `false` to reject the item, or any other
5
5
  * value to map it.
6
6
  *
7
- * @param array
8
- * @param mapFilter
9
7
  * @example
10
- * // Filter reject and turn value into `value mapped`
11
- * const items = ['value', 'value', 'reject', 'reject'];
8
+ * // Filter reject and turn value into `value mapped`
9
+ * const items = ['value', 'value', 'reject', 'reject'];
10
+ *
11
+ * const mappedItems = filterAndMap(items, (item) =>
12
+ * item === 'reject' ? false : `${item} mapped`,
13
+ * );
12
14
  *
13
- * const mappedItems = filterAndMap(items, (item) =>
14
- * item === 'reject'
15
- * ? false
16
- * : `${item} mapped`,
17
- * );
15
+ * mappedItems; // ['value mapped', 'value mapped']
18
16
  *
19
- * mappedItems; // ['value mapped', 'value mapped']
17
+ * @param array
18
+ * @param mapFilter
20
19
  */
21
20
  declare function filterAndMap<T, R>(array: IterableIterator<T> | readonly T[], mapFilter: (item: T, index: number) => false | R): R[];
22
21
  type FilterAndMapReturn<T> = false | T;
23
22
  type SortOrder = 'desc' | 'asc';
24
- type SortByValue<T> = (item: T) => (number | string)[] | number | string;
23
+ type SortByValueFn<T> = (item: T) => (number | string)[] | number | string;
25
24
  type SortByProps = {
26
25
  order?: SortOrder | SortOrder[];
27
26
  } | SortOrder | SortOrder[];
@@ -32,37 +31,42 @@ type SortByProps = {
32
31
  *
33
32
  * Use `Infinity` as as wildcard to absolute max and min values
34
33
  *
35
- * @param arr
36
- * @param sortByValue
37
- * @param props
38
34
  * @example
39
- * const items = [1, 3, 2, 4];
35
+ * const items = [1, 3, 2, 4];
36
+ *
37
+ * const sortedItems = sortBy(items, (item) => item);
38
+ * // [1, 2, 3, 4]
40
39
  *
41
- * const sortedItems = sortBy(items, (item) => item);
42
- * // [1, 2, 3, 4]
40
+ * const items2 = [
41
+ * { a: 1, b: 2 },
42
+ * { a: 2, b: 1 },
43
+ * { a: 1, b: 1 },
44
+ * ];
43
45
  *
44
- * const items2 = [{ a: 1, b: 2 }, { a: 2, b: 1 }, { a: 1, b: 1}]
46
+ * // return a array to sort by multiple values
47
+ * const sortedItems = sortBy(items, (item) => [item.a, item.b]);
45
48
  *
46
- * // return a array to sort by multiple values
47
- * const sortedItems = sortBy(items, (item) => [item.a, item.b]);
49
+ * @param arr
50
+ * @param sortByValue
51
+ * @param props
48
52
  */
49
- declare function sortBy<T>(arr: T[], sortByValue: SortByValue<T>, props?: SortByProps): T[];
53
+ declare function sortBy<T>(arr: T[], sortByValue: SortByValueFn<T>, props?: SortByProps): T[];
50
54
  /**
51
55
  * Get the correct 0 based value for sync with other array in ascending order
52
56
  *
53
- * @param index
54
- *
55
57
  * @example
56
- * ```ts
57
- * const items = [1, 2, 3];
58
- *
59
- * const index = sortBy(
60
- * items,
61
- * (item) => getAscIndexOrder(
62
- * followOrder.findIndex((order) => order === item)
63
- * )
64
- * );
65
- * ```
58
+ * ```ts
59
+ * const items = [1, 2, 3];
60
+ *
61
+ * const index = sortBy(
62
+ * items,
63
+ * (item) => getAscIndexOrder(
64
+ * followOrder.findIndex((order) => order === item)
65
+ * )
66
+ * );
67
+ * ```;
68
+ *
69
+ * @param index
66
70
  */
67
71
  declare function getAscIndexOrder(index: number | undefined): number;
68
72
  declare function arrayWithPrev<T>(array: T[]): [current: T, prev: T | null][];
@@ -82,50 +86,59 @@ type ArrayOps<T> = {
82
86
  /**
83
87
  * Filter and map an array
84
88
  *
85
- * @param mapFilter - A function that takes an item and returns a value or `false`
86
- * to reject the item.
87
89
  * @example
88
- * const items = [1, 2, 3];
90
+ * const items = [1, 2, 3];
91
+ *
92
+ * const enhancedItems = arrayOps(items);
89
93
  *
90
- * const enhancedItems = arrayOps(items);
94
+ * enhancedItems.filterAndMap((item) => (item === 2 ? false : item));
91
95
  *
92
- * enhancedItems.filterAndMap((item) => item === 2 ? false : item);
96
+ * @param mapFilter - A function that takes an item and returns a value or
97
+ * `false` to reject the item.
93
98
  */
94
99
  filterAndMap: <R>(mapFilter: (item: T, index: number) => false | R) => R[];
95
- sortBy: (sortByValue: SortByValue<T>, props: SortByProps) => T[];
100
+ sortBy: (sortByValue: SortByValueFn<T>, props: SortByProps) => T[];
96
101
  rejectDuplicates: (getKey: (item: T) => unknown) => T[];
97
102
  findAndMap: <R>(predicate: (value: T) => R | false) => R | undefined;
98
103
  };
99
104
  /**
100
- * Finds the first item in an array where the predicate returns a non-false value and returns that mapped value.
105
+ * Finds the first item in an array where the predicate returns a non-false
106
+ * value and returns that mapped value.
101
107
  *
102
- * Combines find and map operations - applies the predicate to each item until one returns
103
- * a value that is not `false`, then returns that mapped value. If no item matches, returns `undefined`.
108
+ * Combines find and map operations - applies the predicate to each item until
109
+ * one returns a value that is not `false`, then returns that mapped value. If
110
+ * no item matches, returns `undefined`.
104
111
  *
105
- * @param array - The array to search through
106
- * @param predicate - Function that returns a mapped value or `false` to skip the item
107
- * @returns The first mapped value that is not `false`, or `undefined` if no item matches
108
112
  * @example
109
- * const users = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }];
113
+ * const users = [
114
+ * { id: 1, name: 'Alice' },
115
+ * { id: 2, name: 'Bob' },
116
+ * ];
117
+ *
118
+ * const foundName = findAndMap(users, (user) =>
119
+ * user.id === 2 ? user.name.toUpperCase() : false,
120
+ * );
121
+ * // foundName is 'BOB'
110
122
  *
111
- * const foundName = findAndMap(users, (user) =>
112
- * user.id === 2 ? user.name.toUpperCase() : false
113
- * );
114
- * // foundName is 'BOB'
123
+ * @param array - The array to search through
124
+ * @param predicate - Function that returns a mapped value or `false` to skip
125
+ * the item
126
+ * @returns The first mapped value that is not `false`, or `undefined` if no
127
+ * item matches
115
128
  */
116
129
  declare function findAndMap<T, R>(array: T[], predicate: (value: T) => R | false): R | undefined;
117
130
  /**
118
131
  * Enhance an array with extra methods
119
132
  *
120
- * @param array
121
133
  * @example
134
+ * const enhancedItems = arrayOps(array);
122
135
  *
123
- * const enhancedItems = arrayOps(array);
136
+ * enhancedItems.filterAndMap((item) => (item === 2 ? false : item));
137
+ * enhancedItems.sortBy((item) => item);
138
+ * enhancedItems.rejectDuplicates((item) => item);
124
139
  *
125
- * enhancedItems.filterAndMap((item) => item === 2 ? false : item);
126
- * enhancedItems.sortBy((item) => item);
127
- * enhancedItems.rejectDuplicates((item) => item);
140
+ * @param array
128
141
  */
129
142
  declare function arrayOps<T>(array: T[]): ArrayOps<T>;
130
143
 
131
- export { type FilterAndMapReturn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findAndMap, findBeforeIndex, getAscIndexOrder, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };
144
+ export { type FilterAndMapReturn, type SortByProps, type SortByValueFn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findAndMap, findBeforeIndex, getAscIndexOrder, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };
@@ -1,27 +1,26 @@
1
1
  /**
2
- * allow to filter and map with better typing ergonomics
2
+ * Allow to filter and map with better typing ergonomics
3
3
  *
4
4
  * In the `mapFilter` function return `false` to reject the item, or any other
5
5
  * value to map it.
6
6
  *
7
- * @param array
8
- * @param mapFilter
9
7
  * @example
10
- * // Filter reject and turn value into `value mapped`
11
- * const items = ['value', 'value', 'reject', 'reject'];
8
+ * // Filter reject and turn value into `value mapped`
9
+ * const items = ['value', 'value', 'reject', 'reject'];
10
+ *
11
+ * const mappedItems = filterAndMap(items, (item) =>
12
+ * item === 'reject' ? false : `${item} mapped`,
13
+ * );
12
14
  *
13
- * const mappedItems = filterAndMap(items, (item) =>
14
- * item === 'reject'
15
- * ? false
16
- * : `${item} mapped`,
17
- * );
15
+ * mappedItems; // ['value mapped', 'value mapped']
18
16
  *
19
- * mappedItems; // ['value mapped', 'value mapped']
17
+ * @param array
18
+ * @param mapFilter
20
19
  */
21
20
  declare function filterAndMap<T, R>(array: IterableIterator<T> | readonly T[], mapFilter: (item: T, index: number) => false | R): R[];
22
21
  type FilterAndMapReturn<T> = false | T;
23
22
  type SortOrder = 'desc' | 'asc';
24
- type SortByValue<T> = (item: T) => (number | string)[] | number | string;
23
+ type SortByValueFn<T> = (item: T) => (number | string)[] | number | string;
25
24
  type SortByProps = {
26
25
  order?: SortOrder | SortOrder[];
27
26
  } | SortOrder | SortOrder[];
@@ -32,37 +31,42 @@ type SortByProps = {
32
31
  *
33
32
  * Use `Infinity` as as wildcard to absolute max and min values
34
33
  *
35
- * @param arr
36
- * @param sortByValue
37
- * @param props
38
34
  * @example
39
- * const items = [1, 3, 2, 4];
35
+ * const items = [1, 3, 2, 4];
36
+ *
37
+ * const sortedItems = sortBy(items, (item) => item);
38
+ * // [1, 2, 3, 4]
40
39
  *
41
- * const sortedItems = sortBy(items, (item) => item);
42
- * // [1, 2, 3, 4]
40
+ * const items2 = [
41
+ * { a: 1, b: 2 },
42
+ * { a: 2, b: 1 },
43
+ * { a: 1, b: 1 },
44
+ * ];
43
45
  *
44
- * const items2 = [{ a: 1, b: 2 }, { a: 2, b: 1 }, { a: 1, b: 1}]
46
+ * // return a array to sort by multiple values
47
+ * const sortedItems = sortBy(items, (item) => [item.a, item.b]);
45
48
  *
46
- * // return a array to sort by multiple values
47
- * const sortedItems = sortBy(items, (item) => [item.a, item.b]);
49
+ * @param arr
50
+ * @param sortByValue
51
+ * @param props
48
52
  */
49
- declare function sortBy<T>(arr: T[], sortByValue: SortByValue<T>, props?: SortByProps): T[];
53
+ declare function sortBy<T>(arr: T[], sortByValue: SortByValueFn<T>, props?: SortByProps): T[];
50
54
  /**
51
55
  * Get the correct 0 based value for sync with other array in ascending order
52
56
  *
53
- * @param index
54
- *
55
57
  * @example
56
- * ```ts
57
- * const items = [1, 2, 3];
58
- *
59
- * const index = sortBy(
60
- * items,
61
- * (item) => getAscIndexOrder(
62
- * followOrder.findIndex((order) => order === item)
63
- * )
64
- * );
65
- * ```
58
+ * ```ts
59
+ * const items = [1, 2, 3];
60
+ *
61
+ * const index = sortBy(
62
+ * items,
63
+ * (item) => getAscIndexOrder(
64
+ * followOrder.findIndex((order) => order === item)
65
+ * )
66
+ * );
67
+ * ```;
68
+ *
69
+ * @param index
66
70
  */
67
71
  declare function getAscIndexOrder(index: number | undefined): number;
68
72
  declare function arrayWithPrev<T>(array: T[]): [current: T, prev: T | null][];
@@ -82,50 +86,59 @@ type ArrayOps<T> = {
82
86
  /**
83
87
  * Filter and map an array
84
88
  *
85
- * @param mapFilter - A function that takes an item and returns a value or `false`
86
- * to reject the item.
87
89
  * @example
88
- * const items = [1, 2, 3];
90
+ * const items = [1, 2, 3];
91
+ *
92
+ * const enhancedItems = arrayOps(items);
89
93
  *
90
- * const enhancedItems = arrayOps(items);
94
+ * enhancedItems.filterAndMap((item) => (item === 2 ? false : item));
91
95
  *
92
- * enhancedItems.filterAndMap((item) => item === 2 ? false : item);
96
+ * @param mapFilter - A function that takes an item and returns a value or
97
+ * `false` to reject the item.
93
98
  */
94
99
  filterAndMap: <R>(mapFilter: (item: T, index: number) => false | R) => R[];
95
- sortBy: (sortByValue: SortByValue<T>, props: SortByProps) => T[];
100
+ sortBy: (sortByValue: SortByValueFn<T>, props: SortByProps) => T[];
96
101
  rejectDuplicates: (getKey: (item: T) => unknown) => T[];
97
102
  findAndMap: <R>(predicate: (value: T) => R | false) => R | undefined;
98
103
  };
99
104
  /**
100
- * Finds the first item in an array where the predicate returns a non-false value and returns that mapped value.
105
+ * Finds the first item in an array where the predicate returns a non-false
106
+ * value and returns that mapped value.
101
107
  *
102
- * Combines find and map operations - applies the predicate to each item until one returns
103
- * a value that is not `false`, then returns that mapped value. If no item matches, returns `undefined`.
108
+ * Combines find and map operations - applies the predicate to each item until
109
+ * one returns a value that is not `false`, then returns that mapped value. If
110
+ * no item matches, returns `undefined`.
104
111
  *
105
- * @param array - The array to search through
106
- * @param predicate - Function that returns a mapped value or `false` to skip the item
107
- * @returns The first mapped value that is not `false`, or `undefined` if no item matches
108
112
  * @example
109
- * const users = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }];
113
+ * const users = [
114
+ * { id: 1, name: 'Alice' },
115
+ * { id: 2, name: 'Bob' },
116
+ * ];
117
+ *
118
+ * const foundName = findAndMap(users, (user) =>
119
+ * user.id === 2 ? user.name.toUpperCase() : false,
120
+ * );
121
+ * // foundName is 'BOB'
110
122
  *
111
- * const foundName = findAndMap(users, (user) =>
112
- * user.id === 2 ? user.name.toUpperCase() : false
113
- * );
114
- * // foundName is 'BOB'
123
+ * @param array - The array to search through
124
+ * @param predicate - Function that returns a mapped value or `false` to skip
125
+ * the item
126
+ * @returns The first mapped value that is not `false`, or `undefined` if no
127
+ * item matches
115
128
  */
116
129
  declare function findAndMap<T, R>(array: T[], predicate: (value: T) => R | false): R | undefined;
117
130
  /**
118
131
  * Enhance an array with extra methods
119
132
  *
120
- * @param array
121
133
  * @example
134
+ * const enhancedItems = arrayOps(array);
122
135
  *
123
- * const enhancedItems = arrayOps(array);
136
+ * enhancedItems.filterAndMap((item) => (item === 2 ? false : item));
137
+ * enhancedItems.sortBy((item) => item);
138
+ * enhancedItems.rejectDuplicates((item) => item);
124
139
  *
125
- * enhancedItems.filterAndMap((item) => item === 2 ? false : item);
126
- * enhancedItems.sortBy((item) => item);
127
- * enhancedItems.rejectDuplicates((item) => item);
140
+ * @param array
128
141
  */
129
142
  declare function arrayOps<T>(array: T[]): ArrayOps<T>;
130
143
 
131
- export { type FilterAndMapReturn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findAndMap, findBeforeIndex, getAscIndexOrder, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };
144
+ export { type FilterAndMapReturn, type SortByProps, type SortByValueFn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findAndMap, findBeforeIndex, getAscIndexOrder, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };