import { Trees } from "https://unpkg.com/@ixfx/collections/bundle"
const myObj = { name: `Pedro`, size: 45, colour: `orange` };
const root = Trees.FromObject.create(myObj);
for (const v of Trees.Traverse.breadthFirst(root)) {
// v.getValue() yields:
// { name: 'name', sourceValue: 'Pedro' ...},
// { name: 'size', sourceValue: 45 ... }
// ...
}
Reads all fields and sub-fields of
node
, returning as a basic tree structure. The structure is a snapshot of the object. If the object changes afterwards, the tree will remain the same.Alternatively, consider asDynamicTraversable which reads the object dynamically.