type Pred = (v: T, index: number, arr: ArrayLike) => string; interface IndexBy { (fn: Pred, list: ArrayLike): Record; (fn: Pred): (list: ArrayLike) => Record; } /** * Given a function that generates a key, turns a list of objects into an * object indexing the objects by the given key. Note that if multiple * objects generate the same value for the indexing key only the last value * will be included in the generated object. * * @param {Function} fn Function :: a -> String * @param {Array} arr The array of objects to index * @return {Object} An object indexing each array element by the given property. * @example * * var list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; * indexBy(x => x.id, list); * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} */ declare const _default: IndexBy; export default _default;