Node

Handles single elements of data

Name

Node

Access

public

Hierarchy (view full)

Constructors

  • Constructor

    Initialises the instance

    Parameters

    • details: string | 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 Node

    a new instance

    Name

    Node

    Access

    public

Properties

_class: string
_maximum: any
_minimum: any
_optional: boolean
_options: null | any[]
_regex: null | RegExp
_special: Record<string, any>
_type: string
validationFailures: string[][]

Methods

  • Class

    Returns a string representation of the Node's class

    Returns string

    string

    Name

    class

    Access

    public

  • Clean

    Cleans and returns the new value

    Parameters

    • Optional value: any

      The value to clean

    • Optional level: string[]

    Returns any

    the cleaned value

    Name

    clean

    Access

    public

  • Min/Max

    Sets or gets the minimum and/or maximum values for the Node. For getting, returns { "minimum": mixed, "maximum": mixed }

    Parameters

    • Optional minimum: any

      The minimum value

    • Optional maximum: any

      The maximum value

    Returns void | MinMax

    the current min / max on get, or void for set

    Name

    minmax

    Access

    public

  • Optional

    Getter/Setter for the optional flag

    Parameters

    • Optional value: boolean

      The value to set

    Returns boolean | void

    bool | void

    Name

    optional

  • Options

    Sets or gets the list of acceptable values for the Node

    Parameters

    • Optional opts: any[]

      An array of valid values for the node when setting

    Returns null | void | any[]

    void | Array

    Name

    options

    Access

    public

  • Regex

    Sets or gets the regular expression used to validate the Node

    Parameters

    • Optional regex: string | RegExp

      A regular expression string or object

    Returns null | void | RegExp

    void | RegExp

    Name

    regex

    Access

    public

  • 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 Node as an Object 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

  • Type

    Returns the type of Node this is

    Returns string

    the type of node

    Name

    type

    Access

    public

  • Valid

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

    Parameters

    • value: 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