Files
collection.ts/src/collection/mapNotNull.ts
Infendro 24838b8f77
All checks were successful
/ publish (push) Successful in 1m24s
Implement Collection
2026-04-27 19:00:49 +02:00

9 lines
272 B
TypeScript

export function mapNotNull<T, R>(value: T[], transform: (it: T) => R | null): R[] {
const result: R[] = [];
for (const it of value) {
const transformed = transform(it);
if (transformed !== null) result.push(transformed);
}
return result;
}