Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/yano3nora_tsutils/main.ts>objects2object

TypeScript Utilities as a npm dual package by Deno.
Latest
variable objects2object
import { objects2object } from "https://deno.land/x/yano3nora_tsutils@v0.29.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