Hash Node

Dynamic object node

Name

HashNode

Access

public

Hierarchy (view full)

Constructors

  • Constructor

    Initialises the instance

    Parameters

    • details: Record<string, any>

      Node structure

    • Optional extend: false | Record<string, any>

      Extend the base node structure, if false, don't copy the base node structure details

    Returns Hash

    a new instance

    Name

    HashNode

    Access

    public

Properties

_class: string
_key: Node
_node: Base
_optional: boolean
_special: Record<string, any>
validationFailures: string[][]

Methods

  • Child

    Returns the child node associated with the hash

    Returns Base

    the instance of the value node

    Name

    child

    Access

    public

  • Class

    Returns a string representation of the Node's class

    Returns string

    string

    Name

    class

    Access

    public

  • Clean

    Makes sure both the key and value are properly stored in their correct representation

    Parameters

    • Optional value: null | Record<any, any>

      The value to clean

    • Optional level: string[]

    Returns null | Record<any, any>

    the cleaned object values

    Name

    clean

    Access

    public

  • Optional

    Getter/Setter for the optional flag

    Parameters

    • Optional value: boolean

      The value to set

    Returns boolean | void

    bool | void

    Name

    optional

  • Special

    Getter/Setter method for special values associated with nodes that are not fields. To retrieve a value or values, pass only the name or names, to set a single special value, pass a name and value

    Parameters

    • name: string

      The name of the value to either set or get

    • Optional value: any

      The value to set, must be something that can be converted directly to JSON

    Returns any

    mixed | void

    Name

    special

    Access

    public

  • To JSON

    Returns a JSON string representation of the instance

    Returns string

    json reprentation of the node

    Name

    toJSON

    Access

    public

  • To Object

    Returns the basic node as a dictionary in the same format as is used in constructing it

    Returns Record<string, any>

    an object that can be converted to JSON

    Name

    toObject

    Access

    public

  • Valid

    Checks if a value is valid based on the instance's values

    Parameters

    • value: null | Record<any, any>

      The value to validate

    • Optional level: string[]

      Names of parents to this node

    Returns boolean

    if the value is valid or not

    Name

    valid

    Access

    public

  • Create

    Figure out the child node type necessary and create an instance of it

    Parameters

    • details: Record<string, any>

      An object describing a data point

    Returns Base

    any

    Name

    create

    Access

    public

    Static

  • Register

    Registers the classes that can be children because we can't require them in this file as webpack can't handle file A that requires file B that requires file A

    Parameters

    • name: string | object

      Name / value object of all classes to register, or the name of the constructor that will be added

    • Optional constructor: any

      The class to associate with the given name

    Returns void

    Name

    register

    Access

    public

    Static