radashi 12.2.0-beta.2c63f67 → 12.2.0-beta.362659f

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/index.cjs CHANGED
@@ -315,10 +315,9 @@ var replaceOrAppend = (list2, newItem, match) => {
315
315
  // src/array/select.ts
316
316
  var select = (array, mapper, condition) => {
317
317
  if (!array) return [];
318
- let mapped;
319
318
  return array.reduce((acc, item, index) => {
320
- if (condition) condition(item, index) && acc.push(mapper(item, index));
321
- else (mapped = mapper(item, index)) != null && acc.push(mapped);
319
+ if (!condition(item, index)) return acc;
320
+ acc.push(mapper(item, index));
322
321
  return acc;
323
322
  }, []);
324
323
  };
package/dist/index.d.cts CHANGED
@@ -156,7 +156,7 @@ declare const replaceOrAppend: <T>(list: readonly T[], newItem: T, match: (a: T,
156
156
  * @example
157
157
  * select([1, 2, 3, 4], x => x*x, x > 2) == [9, 16]
158
158
  */
159
- declare const select: <T, K>(array: readonly T[], mapper: (item: T, index: number) => K, condition?: ((item: T, index: number) => boolean) | undefined) => K[];
159
+ declare const select: <T, K>(array: readonly T[], mapper: (item: T, index: number) => K, condition: (item: T, index: number) => boolean) => K[];
160
160
 
161
161
  /**
162
162
  * Shift array items by n steps If n > 0 items will shift n steps to
package/dist/index.d.ts CHANGED
@@ -156,7 +156,7 @@ declare const replaceOrAppend: <T>(list: readonly T[], newItem: T, match: (a: T,
156
156
  * @example
157
157
  * select([1, 2, 3, 4], x => x*x, x > 2) == [9, 16]
158
158
  */
159
- declare const select: <T, K>(array: readonly T[], mapper: (item: T, index: number) => K, condition?: ((item: T, index: number) => boolean) | undefined) => K[];
159
+ declare const select: <T, K>(array: readonly T[], mapper: (item: T, index: number) => K, condition: (item: T, index: number) => boolean) => K[];
160
160
 
161
161
  /**
162
162
  * Shift array items by n steps If n > 0 items will shift n steps to
package/dist/index.js CHANGED
@@ -193,10 +193,9 @@ var replaceOrAppend = (list2, newItem, match) => {
193
193
  // src/array/select.ts
194
194
  var select = (array, mapper, condition) => {
195
195
  if (!array) return [];
196
- let mapped;
197
196
  return array.reduce((acc, item, index) => {
198
- if (condition) condition(item, index) && acc.push(mapper(item, index));
199
- else (mapped = mapper(item, index)) != null && acc.push(mapped);
197
+ if (!condition(item, index)) return acc;
198
+ acc.push(mapper(item, index));
200
199
  return acc;
201
200
  }, []);
202
201
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radashi",
3
- "version": "12.2.0-beta.2c63f67",
3
+ "version": "12.2.0-beta.362659f",
4
4
  "description": "Functional utility library - modern, simple, typed, powerful",
5
5
  "sideEffects": false,
6
6
  "author": "Alec Larson",