Skip to main content

Function: getDeepObjectKeys()

getDeepObjectKeys<T>(obj: AnyObject<T>, options?: GetDeepObjectKeysOptions): string[]

Flattens an object to a list of its keys, traversing deeply into nested objects and arrays of objects.

Type parameters

Type parameter
T

Parameters

ParameterTypeDescription
objAnyObject<T>The object of which to deeply retrieve its keys
options?GetDeepObjectKeysOptionsThe options with which to customize the output of this function

Returns

string[]

An array of strings holding the keys of the object

Note

By default Nested array values are flattened to arrayKey.${index}.subKey. This can be changed to arrayKey[${index}].subKey by setting options.arrayKeysIndexStyle to 'braces-with-dot'. Or it can also be changed to arrayKey[${index}]subKey by setting options.arrayKeysIndexStyle to 'braces'.

Source

lib/getDeepObjectKeys.ts:15