MCPcopy
hub / github.com/puckeditor/puck / flattenNode

Function flattenNode

packages/core/lib/data/flatten-node.ts:54–65  ·  view source on GitHub ↗
(
  node: ComponentData | RootData,
  config: UserConfig
)

Source from the content-addressed store, hash-verified

52}
53
54export const flattenNode = <
55 UserConfig extends Config = Config,
56 G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>
57>(
58 node: ComponentData | RootData,
59 config: UserConfig
60) => {
61 return {
62 ...node,
63 props: encodeEmptyObjects(flatten(stripSlots(node, config).props)),
64 };
65};
66
67export const expandNode = (node: ComponentData | RootData) => {
68 const props = unflatten(decodeEmptyObjects(node.props));

Callers 3

expectIndexedFunction · 0.90
processItemFunction · 0.90
expectIndexedFunction · 0.90

Calls 3

stripSlotsFunction · 0.90
encodeEmptyObjectsFunction · 0.85
flattenFunction · 0.85

Tested by 1

expectIndexedFunction · 0.72