JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q37332F
  • License MIT

ES2015 Class versions of a Node and Tree data structure

Package Exports

  • structz

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (structz) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

structz

ES2015 Class versions of a Node and Tree

Build Status

Install

npm instal structz or yarn add structz

const Structz = require('structz'),
  Node = Structz.Node,
  Tree = Structz.Tree;

Documentation

See docs/index.html for up to date documentation.

Node

Class representing a Node data structure type

Kind: global class

node.children ⇒ Array

Returns an array of child nodes.

Kind: instance property of Node

node.value ⇒ *

Returns the value of the this.attributes.

Kind: instance property of Node

node.value

Sets the value of this.attributes.

Kind: instance property of Node

Param
attribute

node.isRoot() ⇒ boolean

Detects if this Node is a parent node or not.

Kind: instance method of Node

node.hasChildren() ⇒ boolean

Detects if this node has children or not.

Kind: instance method of Node

node.append(child) ⇒ Node

Appends a child Node to this Node.

Kind: instance method of Node

Param
child

node.toString() ⇒ string

Returns a String that represents this Node.

Kind: instance method of Node

Classes

Tree

Class representing a Tree data structure type that contains a Root node

Constants

_

Created by codeforcoffee on 6/2/17.

Tree

Class representing a Tree data structure type that contains a Root node

Kind: global class

new Tree(root)

Instantiates a Node as a Binary Tree

Param
root

tree.root ⇒ *

Returns the root of the Node.

Kind: instance property of Tree

Tree.map(node, func, tree) ⇒ *

Performs a function on a Node with the provided function and returns the output. Optionally accepts a Tree to perform this otherwise a new Tree is instantiated and returned (breaks immutability).

Kind: static method of Tree

Param Default
node
func
tree

_

Created by codeforcoffee on 6/2/17.

Kind: global constant

Changelog

  • 0.1.1 - Added Test Coverage
  • 0.1.0 - Initial release.