Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/object/index.ts>flatKeys

A JavaScript extension package for building strong and modern applications.
Latest
function flatKeys
import { flatKeys } from "https://deno.land/x/ayonli_jsext@v0.9.72/object/index.ts";

Create an object with flatted keys of the original object, the children nodes' properties will be transformed to a string-represented path.

NOTE: This function only operates on plain objects and arrays.

Examples

Example 1

import { flatKeys } from "@ayonli/jsext/object";

const obj = flatKeys({ foo: { bar: "Hello", baz: "World" } });

console.log(obj); // { "foo.bar": "Hello", "foo.baz": "World" }

Type Parameters

T extends object

Parameters

obj: T

Default value: 1.

optional
depth = [UNSUPPORTED]
optional
options: { flatArrayIndices?: boolean; } = [UNSUPPORTED]

Returns

OmitChildrenNodes<T> & Record<string | number | symbol, any>