mirror of
https://github.com/mmahdium/portfolio.git
synced 2025-12-20 09:23:54 +01:00
4 lines
193 B
TypeScript
4 lines
193 B
TypeScript
// Find an item in `items` array, given a specific key/value.
|
|
export const findBy = <T>(key: keyof T, value: T[keyof T], items: T[]): T | undefined =>
|
|
items.find((obj) => obj[key] === value)
|