UNPKG

rambda

Version:

Lightweight and faster alternative to Ramda with included TS definitions

15 lines (13 loc) 259 B
export function indexBy(property){ return list => { const toReturn = {} for (let i = 0; i < list.length; i++){ const item = list[ i ] const key = item[property] if(key !== undefined){ toReturn[ key ] = item } } return toReturn } }