radashi 12.2.0-beta.362659f → 12.2.0-beta.437b4fe

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/README.md CHANGED
@@ -51,9 +51,7 @@
51
51
  - ⚠️ **Beware:** Preview releases are not audited by the Radashi team. Always look at their
52
52
  changes in the PR to ensure no malicious code was introduced.
53
53
 
54
-  
55
-
56
- <img src="https://github.com/radashi-org/radashi/raw/main/img/rule.png" width="100%" />
54
+ <img src="https://github.com/radashi-org/radashi/raw/b80a0e4/img/rule.png" width="100%" />
57
55
 
58
56
  ## Install
59
57
 
@@ -69,9 +67,7 @@ yarn add radashi
69
67
  npm install radashi
70
68
  ```
71
69
 
72
- &nbsp;
73
-
74
- <img src="https://github.com/radashi-org/radashi/raw/main/img/rule.png" width="100%" />
70
+ <img src="https://github.com/radashi-org/radashi/raw/b80a0e4/img/rule.png" width="100%" />
75
71
 
76
72
  ## Contributing
77
73
 
@@ -81,9 +77,7 @@ Contributions are welcome and appreciated! Check out the contributing guide befo
81
77
  <img src="https://github.com/radashi-org/radashi/raw/main/img/contributing-button.png" alt="Contributing to Radashi" width="250px" />
82
78
  </a>
83
79
 
84
- &nbsp;
85
-
86
- <img src="https://github.com/radashi-org/radashi/raw/main/img/rule.png" width="100%" />
80
+ <img src="https://github.com/radashi-org/radashi/raw/b80a0e4/img/rule.png" width="100%" />
87
81
 
88
82
  ## Changelog
89
83
 
@@ -97,6 +91,6 @@ This section documents the changes between the original `radash` library and thi
97
91
 
98
92
  <div align="center">
99
93
  <p align="center">
100
- <img src="https://github.com/radashi-org/radashi/raw/main/img/footer.png" alt="Radashi" width="100%" />
94
+ <img src="https://github.com/radashi-org/radashi/raw/46c8897/img/footer.png" alt="Radashi" width="100%" />
101
95
  </p>
102
96
  </div>
package/dist/index.cjs CHANGED
@@ -315,9 +315,10 @@ 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;
318
319
  return array.reduce((acc, item, index) => {
319
- if (!condition(item, index)) return acc;
320
- acc.push(mapper(item, index));
320
+ if (condition) condition(item, index) && acc.push(mapper(item, index));
321
+ else (mapped = mapper(item, index)) != null && acc.push(mapped);
321
322
  return acc;
322
323
  }, []);
323
324
  };
@@ -1045,7 +1046,7 @@ var trim = (str, charsToTrim = " ") => {
1045
1046
  };
1046
1047
 
1047
1048
  // src/typed/isArray.ts
1048
- var isArray = Array.isArray;
1049
+ var isArray = /* @__PURE__ */ (() => Array.isArray)();
1049
1050
 
1050
1051
  // src/typed/isDate.ts
1051
1052
  var isDate = (value) => {
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) => K[];
159
+ declare const select: <T, K>(array: readonly T[], mapper: (item: T, index: number) => K, condition?: ((item: T, index: number) => boolean) | undefined) => K[];
160
160
 
161
161
  /**
162
162
  * Shift array items by n steps If n > 0 items will shift n steps to
@@ -699,7 +699,7 @@ declare const title: (str: string | null | undefined) => string;
699
699
  */
700
700
  declare const trim: (str: string | null | undefined, charsToTrim?: string) => string;
701
701
 
702
- declare const isArray: (arg: any) => arg is any[];
702
+ declare const isArray: (value: unknown) => value is readonly any[];
703
703
 
704
704
  declare const isDate: (value: any) => value is Date;
705
705
 
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) => K[];
159
+ declare const select: <T, K>(array: readonly T[], mapper: (item: T, index: number) => K, condition?: ((item: T, index: number) => boolean) | undefined) => K[];
160
160
 
161
161
  /**
162
162
  * Shift array items by n steps If n > 0 items will shift n steps to
@@ -699,7 +699,7 @@ declare const title: (str: string | null | undefined) => string;
699
699
  */
700
700
  declare const trim: (str: string | null | undefined, charsToTrim?: string) => string;
701
701
 
702
- declare const isArray: (arg: any) => arg is any[];
702
+ declare const isArray: (value: unknown) => value is readonly any[];
703
703
 
704
704
  declare const isDate: (value: any) => value is Date;
705
705
 
package/dist/index.js CHANGED
@@ -193,9 +193,10 @@ 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;
196
197
  return array.reduce((acc, item, index) => {
197
- if (!condition(item, index)) return acc;
198
- acc.push(mapper(item, index));
198
+ if (condition) condition(item, index) && acc.push(mapper(item, index));
199
+ else (mapped = mapper(item, index)) != null && acc.push(mapped);
199
200
  return acc;
200
201
  }, []);
201
202
  };
@@ -923,7 +924,7 @@ var trim = (str, charsToTrim = " ") => {
923
924
  };
924
925
 
925
926
  // src/typed/isArray.ts
926
- var isArray = Array.isArray;
927
+ var isArray = /* @__PURE__ */ (() => Array.isArray)();
927
928
 
928
929
  // src/typed/isDate.ts
929
930
  var isDate = (value) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radashi",
3
- "version": "12.2.0-beta.362659f",
3
+ "version": "12.2.0-beta.437b4fe",
4
4
  "description": "Functional utility library - modern, simple, typed, powerful",
5
5
  "sideEffects": false,
6
6
  "author": "Alec Larson",