User
Examples
Flat output with mapping
1import { convertObject } from "hbh-nodes";3const data = {4 user: { name: "Alice", age: 25 },5 settings: { theme: "dark" }6};8const result = convertObject(data, {9 outputFormat: 'flat',10 mapFn: (v, k) => String(v).toUpperCase()11});13console.log(result);14// ["ALICE", "25", "DARK"]
Tree output with filtering
1const tree = convertObject(data, {2 outputFormat: 'tree',3 filterFn: (val, key) => typeof val === 'string'4});6console.log(tree);7// [8// { key: 'user', children: [{ key: 'name', value: 'Alice' }] },9// { key: 'settings', children: [{ key: 'theme', value: 'dark' }] }10// ]
Nested keys output
1const keys = convertObject(data, { outputFormat: 'nestedKeys' });2console.log(keys);3// [["user", ["name", "age"]], ["settings", ["theme"]]]