collectype

collectype v0.11.0


collectype / utils/pipe/pipeFunctions / parseObject

Function: parseObject()

parseObject(str): Record<string, any>

Defined in: utils/pipe/pipeFunctions.ts:222

Parses an object string into an object.

Parameters

str

string

The object string (e.g., “{a: 1, b: ‘x’}”)

Returns

Record<string, any>

The parsed object (Record<string, any>)

Throws

Error if an object entry is invalid

Example

parseObject('{a: 1, b: "x"}'); // { a: 1, b: 'x' }
parseObject('{}'); // {}