fix(core): update
This commit is contained in:
@ -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'
|
||||
}
|
||||
|
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