Skip to main content

Function: getKeysPaths()

getKeysPaths<T, K>(object, prevKey): string[]

Defined in: utils/system.ts:29

Recursively extracts all key paths from a nested object.

Type Parameters

T

T extends object

K

K extends string | number | symbol

Parameters

object

T

The object to extract paths from

prevKey

string = ''

The previous key path (used for recursion)

Returns

string[]

Array of dot-notation paths to all leaf values

Example

const paths = getKeysPaths({
colors: { primary: '#007AFF', secondary: { light: '#FFF' } }
});
// Returns: ['colors.primary', 'colors.secondary.light']