GitHub

daffArrayToDict

import { daffArrayToDict } from '@daffodil/core'

Converts an array into a dictionary. Dictionary values are keyed by the return of the specified getKey.

const daffArrayToDict: <T extends Record<string | number | symbol, any>>(array: T[], getKey: (val: T) => string | number | symbol) => Record<string | number | symbol, T>