Array Node

Handles lists of nodes

Name

ArrayNode

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 ArrayNode

    a new instance

    Name

    ArrayNode

    Access

    public

Properties

_class: string
_maximum: null | number
_minimum: null | number
_node: Base
_optional: boolean
_special: Record<string, any>
_type: "unique" | "duplicates"
validationFailures: string[][]

Methods

  • Child

    Returns the child node associated with the array

    Returns Base

    the instance of the elements node

    Name

    child

    Access

    public

  • Class

    Returns a string representation of the Node's class

    Returns string

    string

    Name

    class

    Access

    public

  • Clean

    Goes through each of the values in the list, cleans it, stores it, and returns a new list

    Parameters

    • Optional value: null | any[]

      The value to clean

    • Optional level: string[]

    Returns null | any[]

    the cleaned array values

    Name

    clean

    Access

    public

  • Min/Max

    Sets or gets the minimum and/or maximum number of items for the Array. For getting, returns {"minimum":uint,"maximum":uint}

    Parameters

    • Optional minimum: null | string | number

      The minimum value

    • Optional maximum: null | string | number

      The maximum value

    Returns void | MinMax

    The currently set 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

  • 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 Array 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 array, unique or duplicate

    Returns string

    string

    Name

    type

    Access

    public

  • Valid

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

    Parameters

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