GuobaGuoba Utils

construct

@guoba-ai/utils / object / construct

Function: construct()

function construct<T>(obj): T;

Defined in: object.ts:379

Build a nested object from a flat object with dot-path keys (reverse of crush).

Type Parameters

T

T extends object

Parameters

obj

Record<string, unknown>

A flat object with dot-path keys

Returns

T

A deeply nested object

Example

construct({ 'a.b': 1, 'a.c.d': 2 })
// { a: { b: 1, c: { d: 2 } } }

On this page