Skip to main content
Module

x/yano3nora_tsutils/main.ts>objects2object

TypeScript Utilities as a npm dual package by Deno.
Go to Latest
variable objects2object
import { objects2object } from "https://deno.land/x/yano3nora_tsutils@v0.17.0/main.ts";

Examples

objects2object( [ { id: 1, name: 'john' }, { id: 2, name: 'jane' } ], 'id', ) // => { 1: { id: 1, name: 'john' }, 2: { id: 2, name: 'jane' } }

type

<T extends Record<string, unknown>>(objects: T[], keyField: keyof T) => unknown