getObject()function

getObject(obj: PossibleObject<T>): T
ParamType
objPossibleObject<T>
The object or iterable set of key/value entry tuples to convert. required
Return
T
The corresponding object.

Turn a possible object into an object.

  • If the value is iterable it is converted to an object using Object.fromEntries(), otherwise it is returned as-is.

Examples

getObject([["a", 1], ["b", 2]]); // { a: 1, b: 2 }