fix(core): update

This commit is contained in:
2024-04-26 14:05:48 +02:00
parent d608aa81a8
commit cbfe7927e7
6 changed files with 1255 additions and 1425 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartarray',
version: '1.0.5',
version: '1.0.6',
description: 'a package exposing async manipulation for arrays'
}

View File

@ -1,3 +1,17 @@
export const map = async <T = any, R = any>(
arrayArg: T[],
mapFunction: (itemArg: T) => Promise<R>
): Promise<R[]> => {
const returnArray: R[] = [];
for (const itemArg of arrayArg) {
const mapResult = await mapFunction(itemArg);
if (mapResult !== undefined) {
returnArray.push(mapResult);
}
}
return returnArray;
};
export const filter = async <T>(
arrayArg: T[],
filterFunction: (itemArg: T) => Promise<boolean>