Class AbstractNodeAbstract

Base class for Node and Variation.

Hierarchy

Methods

  • Add the given NAG to the current node or variation.

    Parameters

    • nag: number

    Returns void

  • Remove all the NAGs from the current node or variation.

    Returns void

  • Remove all the key-value tag pairs from the the current node or variation.

    See

    tags for more details on tags.

    Returns void

  • Get the text comment (if any) associated to the current node or variation.

    Returns undefined | string

  • Set the text comment associated to the current node or variation.

    Parameters

    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    • Optional isLongComment: boolean

      false by default.

    Returns void

  • Remove from the the current node or variation the NAGs for which the given filter evaluates to false (and keep those for which it evaluates to true).

    Parameters

    • filter: ((nag: number) => boolean)
        • (nag: number): boolean
        • Parameters

          • nag: number

          Returns boolean

    Returns void

  • Remove from the the current node or variation the key-value tag pairs for which the given filter evaluates to false (and keep those for which it evaluates to true).

    See

    tags for more details on tags.

    Parameters

    • filter: ((tagKey: string, tagValue: string) => boolean)
        • (tagKey: string, tagValue: string): boolean
        • Parameters

          • tagKey: string
          • tagValue: string

          Returns boolean

    Returns void

  • Check whether the current node or variation has the given NAG or not.

    Parameters

    • nag: number

    Returns boolean

  • Identifier of the current Node or Variation within its parent Game.

    WARNING: the ID may change when variations are modified (added, removed, swapped, promoted...) among the parents the current node.

    Returns string

  • Whether the text comment associated to the current node or variation is long or short.

    Returns

    false if no comment is defined.

    Returns boolean

  • Deprecated

    Use obj instanceof Variation instead.

    Returns boolean

  • NAGs associated to the current node or variation.

    Returns

    array sorted in increasing order.

    Returns number[]

  • Create a new node representing the given move, and append it to the current node or variation.

    If there are some pre-existing subsequent nodes, they are all erased.

    Returns

    The newly created Node.

    Throws

    InvalidNotation if the move notation cannot be parsed, or if the parsed move would correspond to an illegal move.

    Parameters

    • move: string

      SAN representation of the move, or '--' for a null-move.

    Returns Node

  • Remove the given NAG from the current node or variation.

    Parameters

    • nag: number

    Returns void

  • Get the value associated to the given tag key on the current node or variation.

    See

    tags for more details on tags.

    Parameters

    • tagKey: string

    Returns undefined | string

  • Set the value associated to the given tag key on the current node or variation.

    See

    tags for more details on tags.

    Parameters

    • tagKey: string
    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    Returns void

  • Return the keys of the tags associated to the current node or variation.

    The tag mechanism is a key-value associative container allowing to store some arbitrary data on each node or variation. In PGN, the tags are represented as [%tagKey tagValue] strings appended to text comments.

    The tag keys must be non-empty, and can contain only alphanumeric or underscore characters.

    Returns

    array sorted in increasing order.

    Returns string[]

Generated using TypeDoc