mirror of
https://github.com/mmahdium/portfolio.git
synced 2026-08-14 20:22:49 +03:30
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)
|