Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 2.24 KB

api.md

File metadata and controls

58 lines (36 loc) · 2.24 KB

Table of Contents

DataMutator

Mutate node data.

It treats the node atomically and create a deep clone of it. Structural properties should be left untouched and modified in the layout mutator instead. If null is returned, the node is marked as removed and processed by the layout mutator.

Type: Function

Parameters

  • node Object Node to be mutated.
  • context Context Walk context.

Returns (Object | undefined | null) The node itself, nothing or null.

LayoutMutator

Mutate node layout.

It treats the node as a black box that has a position in the tree. It modifies its structural properties and may alter ancestors, siblings or descendants nodes.

Type: Function

Parameters

  • node (Object | null) Node to be mutated.
  • parentNode Object Parent of the node to be mutated.

morph

Walk over an immutable tree and invoke mutators on each node.

Mutators implements mutations at 2 different levels:

  • data level: mutate node data
  • layout level: mutate node layout

Parameters

Returns Object The mutated tree.