@zelgadis87/utils-core 5.2.3 → 5.2.4
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/CHANGELOG.md +6 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/arrays.d.ts +1 -0
- package/esbuild/index.cjs +6 -0
- package/esbuild/index.cjs.map +2 -2
- package/esbuild/index.mjs +5 -0
- package/esbuild/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/utils/arrays.ts +5 -0
package/esbuild/index.mjs
CHANGED
|
@@ -856,6 +856,10 @@ function shallowArrayEquals(a, b) {
|
|
|
856
856
|
function findInArray(arr, predicate) {
|
|
857
857
|
return Optional_default.ofNullable(arr.find(predicate));
|
|
858
858
|
}
|
|
859
|
+
function findIndexInArray(arr, predicate) {
|
|
860
|
+
const idx = arr.findIndex(predicate);
|
|
861
|
+
return idx === -1 ? Optional_default.empty() : Optional_default.of(idx);
|
|
862
|
+
}
|
|
859
863
|
function zip(ts, rs) {
|
|
860
864
|
if (ts.length !== rs.length)
|
|
861
865
|
throw new Error(`Arrays must have the same length. Got ${ts.length} and ${rs.length}`);
|
|
@@ -2862,6 +2866,7 @@ export {
|
|
|
2862
2866
|
filterMapReduce,
|
|
2863
2867
|
filterWithTypePredicate,
|
|
2864
2868
|
findInArray,
|
|
2869
|
+
findIndexInArray,
|
|
2865
2870
|
first,
|
|
2866
2871
|
flatMapTruthys,
|
|
2867
2872
|
getCauseMessageFromError,
|