mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
7 lines
192 B
TypeScript
7 lines
192 B
TypeScript
export const findMapFirst = <T, R>(array: T[], map: (item: T) => R): R | null => {
|
|
for (const item of array) {
|
|
const result = map(item)
|
|
if (result) return result
|
|
}
|
|
return null
|
|
}
|