fix(core): update
This commit is contained in:
14
ts/index.ts
14
ts/index.ts
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user