Skip to content

Latest commit

 

History

History
273 lines (197 loc) · 10.7 KB

triply.md

File metadata and controls

273 lines (197 loc) · 10.7 KB

Triply

Tree interface for convenient method chaining

Kind: global class

new Triply([props])

Create a new tree, using the provided object as the first node

Param Type Default Description
[props] Object {} Object / node-formatted

triply.insertAfter([props], [ref]) ⇒ Triply

append a sibling after the provided reference or the insertion point

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Default Description
[props] Object {} Object / node-formatted
[ref] Object Reference node

triply.appendChild([props], [ref]) ⇒ Triply

append a child node to the provided reference or the insertion point

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Default Description
[props] Object {} Object / node-formatted
[ref] Object Reference node

triply.push([props]) ⇒ Triply

Alias for insertAfter

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Default Description
[props] Object {} Object / node-formatted

triply.remove() ⇒ Object

Remove the node at the insertion point returns the removed node so it can be reused

Kind: instance method of Triply
Returns: Object - The removed node-formatted object

triply.pop() ⇒ Object

Alias for remove

Kind: instance method of Triply
Returns: Object - The removed node-formatted object

triply.insertBefore([props], [ref]) ⇒ Triply

insert (new) node before insertion point

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Default Description
[props] Object {} Object / node-formatted
[ref] Object Reference node

triply.open([props]) ⇒ Triply

insert new child in current insertion point

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Default Description
[props] Object {} Object / node-formatted

triply.close() ⇒ Triply

move insertion point down one level (if possible)

Kind: instance method of Triply
Returns: Triply - The updated object

triply.movePrevious() ⇒ Triply

move insertion point back

Kind: instance method of Triply
Returns: Triply - The updated object

triply.moveNext() ⇒ Triply

move insertion point forward

Kind: instance method of Triply
Returns: Triply - The updated object

triply.movePreviousSibling() ⇒ Triply

move insertion point to previous sibling

Kind: instance method of Triply
Returns: Triply - The updated object

triply.moveNextSibling() ⇒ Triply

move insertion point to next sibling

Kind: instance method of Triply
Returns: Triply - The updated object

triply.moveFirstChild() ⇒ Triply

move insertion point to first child (if have)

Kind: instance method of Triply
Returns: Triply - The updated object

triply.moveLastChild() ⇒ Triply

move insertion point to last child (if have)

Kind: instance method of Triply
Returns: Triply - The updated object

triply.mark(name) ⇒ Triply

store the insertion point into a bookmark

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Description
name String | Number The name of the bookmark

triply.unmark(name) ⇒ Triply

Restore the insertion point to the set bookmark

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Description
name String | Number The name of the bookmark

triply.traverse()

Traverse

Kind: instance method of Triply

triply.next() ⇒ Object | void

Look at next node in traversal after insertion point, skipping closes

Kind: instance method of Triply
Returns: Object | void - Node-formatted object (if any)

triply.previous() ⇒ Object | void

Look at previous node in traversal before insertion point, skipping closes

Kind: instance method of Triply
Returns: Object | void - Node-formatted object (if any)

triply.peek() ⇒ Object | void

Look at the insertion point

Kind: instance method of Triply
Returns: Object | void - Node-formatted object (if any)

triply.firstChild() ⇒ Object | void

Look at the first child of the insertion point

Kind: instance method of Triply
Returns: Object | void - Node-formatted object (if any)

triply.lastChild() ⇒ Object | void

Look at the last child of the insertion point

Kind: instance method of Triply
Returns: Object | void - Node-formatted object (if any)

triply.nextSibling() ⇒ Object | void

Look at the next sibling of the insertion point

Kind: instance method of Triply
Returns: Object | void - Node-formatted object (if any)

triply.previousSibling() ⇒ Object | void

Look at the previous sibling of the insertion point

Kind: instance method of Triply
Returns: Object | void - Node-formatted object (if any)

triply.openBefore(props, [lastSib]) ⇒ Triply

Create a new branch before the insertion point and add all its siblings up to lastSibling

Kind: instance method of Triply
Returns: Triply - The updated object

Param Type Description
props Object Initial object
[lastSib] Object The last sibling to add to the branch

triply.moveRoot() ⇒ Triply

Move insertion point to root

Kind: instance method of Triply
Returns: Triply - The updated object