Skip to content

feature request: mapToObj for mapping array K[] to Record<K, V> with builder K => V #1468

@hyp3rflow

Description

@hyp3rflow

Hi, I'd like to suggest a new utility function mapToObj
You can find reference of it in remeda.js: https://remedajs.com/docs/#mapToObj

declare const mapToObj: <K extends keyof any, V>(keys: readonly K[], fn: (key: K) => V) => Record<K, V>

mapToObj(["foo", "bar"], (key) => [key]) // returns { foo: [foo], bar: [bar] }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions