radashi 12.9.4 → 12.9.6
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/radashi.cjs +12 -7
- package/dist/radashi.js +12 -7
- package/package.json +1 -1
package/dist/radashi.cjs
CHANGED
|
@@ -303,12 +303,12 @@ function selectFirst(array, mapper, condition) {
|
|
|
303
303
|
if (!array) {
|
|
304
304
|
return void 0;
|
|
305
305
|
}
|
|
306
|
-
let
|
|
307
|
-
const
|
|
308
|
-
|
|
306
|
+
let foundItem;
|
|
307
|
+
const foundIndex = array.findIndex((item, index) => {
|
|
308
|
+
foundItem = item;
|
|
309
309
|
return condition ? condition(item, index) : mapper(item, index) != null;
|
|
310
310
|
});
|
|
311
|
-
return
|
|
311
|
+
return foundIndex === -1 ? void 0 : mapper(foundItem, foundIndex);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
// src/array/shift.ts
|
|
@@ -352,8 +352,8 @@ function toggle(array, item, toKey, options) {
|
|
|
352
352
|
} else {
|
|
353
353
|
matcher = (x) => x === item;
|
|
354
354
|
}
|
|
355
|
-
const
|
|
356
|
-
if (
|
|
355
|
+
const existingIndex = array.findIndex(matcher);
|
|
356
|
+
if (existingIndex !== -1) {
|
|
357
357
|
return array.filter((x, idx) => !matcher(x, idx));
|
|
358
358
|
}
|
|
359
359
|
return (options == null ? void 0 : options.strategy) === "prepend" ? [item, ...array] : [...array, item];
|
|
@@ -740,7 +740,12 @@ function memoize(cache, func, keyFunc, ttl) {
|
|
|
740
740
|
};
|
|
741
741
|
}
|
|
742
742
|
function memo(func, options = {}) {
|
|
743
|
-
return memoize(
|
|
743
|
+
return memoize(
|
|
744
|
+
/* @__PURE__ */ Object.create(null),
|
|
745
|
+
func,
|
|
746
|
+
options.key ?? null,
|
|
747
|
+
options.ttl ?? null
|
|
748
|
+
);
|
|
744
749
|
}
|
|
745
750
|
|
|
746
751
|
// src/curry/memoLastCall.ts
|
package/dist/radashi.js
CHANGED
|
@@ -301,12 +301,12 @@ function selectFirst(array, mapper, condition) {
|
|
|
301
301
|
if (!array) {
|
|
302
302
|
return void 0;
|
|
303
303
|
}
|
|
304
|
-
let
|
|
305
|
-
const
|
|
306
|
-
|
|
304
|
+
let foundItem;
|
|
305
|
+
const foundIndex = array.findIndex((item, index) => {
|
|
306
|
+
foundItem = item;
|
|
307
307
|
return condition ? condition(item, index) : mapper(item, index) != null;
|
|
308
308
|
});
|
|
309
|
-
return
|
|
309
|
+
return foundIndex === -1 ? void 0 : mapper(foundItem, foundIndex);
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
// src/array/shift.ts
|
|
@@ -350,8 +350,8 @@ function toggle(array, item, toKey, options) {
|
|
|
350
350
|
} else {
|
|
351
351
|
matcher = (x) => x === item;
|
|
352
352
|
}
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
353
|
+
const existingIndex = array.findIndex(matcher);
|
|
354
|
+
if (existingIndex !== -1) {
|
|
355
355
|
return array.filter((x, idx) => !matcher(x, idx));
|
|
356
356
|
}
|
|
357
357
|
return (options == null ? void 0 : options.strategy) === "prepend" ? [item, ...array] : [...array, item];
|
|
@@ -738,7 +738,12 @@ function memoize(cache, func, keyFunc, ttl) {
|
|
|
738
738
|
};
|
|
739
739
|
}
|
|
740
740
|
function memo(func, options = {}) {
|
|
741
|
-
return memoize(
|
|
741
|
+
return memoize(
|
|
742
|
+
/* @__PURE__ */ Object.create(null),
|
|
743
|
+
func,
|
|
744
|
+
options.key ?? null,
|
|
745
|
+
options.ttl ?? null
|
|
746
|
+
);
|
|
742
747
|
}
|
|
743
748
|
|
|
744
749
|
// src/curry/memoLastCall.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "radashi",
|
|
3
|
-
"version": "12.9.
|
|
3
|
+
"version": "12.9.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.",
|
|
6
6
|
"repository": {
|