Options
All
  • Public
  • Public/Protected
  • All
Menu
note

Derived class definitions MUST pass themselves to Tself. Tself should NOT be passed during KeyNode instantiation.

Type parameters

  • Tkey: string | number

  • Tself: KeyNode

Hierarchy

Index

Constructors

constructor

  • Parameters

    • key: Tkey | KeyNode<Tkey>
    • Default value _privateIniArgs_: Partial<IprivateIniArgs<Tself>> = {_parent_:null, _rootKeyNodes_:new Map()}

      This argument is used internally and should NOT be passed during instantiations.

    Returns KeyNode

Accessors

__@toStringTag

__@toStringTag:

depth

depth:

isRootKey

isRootKey:

isTerminalKey

isTerminalKey:

key

key:

keyType

keyType:

Returns "index" for keys of type "number" and "key" for keys of type "string".

note

Type "index" is overridden to "key" when a sibling KeyNode is type "key".

numChildren

numChildren:

numSiblings

numSiblings:

parent

parent:

path

path:

PathNotation from the root to the KeyNode.

rootKey

rootKey:

Returns the root KeyNode of the path that leads to this KeyNode.

Methods

Protected _privateIniArgs

addChild

  • addChild<TchildKey>(childKey: TchildKey | KeyNode<TchildKey>): KeyNode<TchildKey>
  • note

    When extending, must be overridden and return derived class. Utility KeyNode._privateIniArgs required with override implementations.

    Type parameters

    • TchildKey: number | string

    Parameters

    • childKey: TchildKey | KeyNode<TchildKey>

    Returns KeyNode<TchildKey>

addSibling

  • addSibling<TsiblingKey>(siblingKey: TsiblingKey | KeyNode<TsiblingKey>): KeyNode<TsiblingKey>
  • note

    When extending, must be overridden and return derived class. Utility KeyNode._privateIniArgs required with override implementations.

    Type parameters

    • TsiblingKey: number | string

    Parameters

    • siblingKey: TsiblingKey | KeyNode<TsiblingKey>

    Returns KeyNode<TsiblingKey>

ancestors

  • ancestors(): IterableIterator<Tself>

children

  • children(): IterableIterator<Tself>

getChild

  • getChild(childKey: string | number): Tself | null
  • Parameters

    • childKey: string | number

    Returns Tself | null

getSibling

  • getSibling(siblingKey: string | number): Tself | null
  • Parameters

    • siblingKey: string | number

    Returns Tself | null

hasChild

  • hasChild(childKey: string | number): boolean
  • Parameters

    • childKey: string | number

    Returns boolean

hasSibling

  • hasSibling(siblingKey: string | number): boolean
  • Parameters

    • siblingKey: string | number

    Returns boolean

pathToKey

  • pathToKey(includeSelf?: boolean): IterableIterator<Tself>
  • Iterates all KeyNodes along path to the KeyNode.

    Parameters

    • Default value includeSelf: boolean = true

      when false does NOT include this KeyNode.

    Returns IterableIterator<Tself>

removeChild

  • removeChild(childKey: string | number): boolean
  • note

    When removal is successful, the removed child KeyNode is transformed into a root KeyNode.

    Parameters

    • childKey: string | number

    Returns boolean

removeSibling

  • removeSibling(siblingKey: string | number): boolean
  • note

    When removal is successful, the removed sibling KeyNode is transformed into a root KeyNode.

    Parameters

    • siblingKey: string | number

    Returns boolean

rootKeys

  • rootKeys(): IterableIterator<Tself>

siblings

  • siblings(): IterableIterator<Tself>

terminalKeys

  • terminalKeys(global?: boolean): IterableIterator<Tself>
  • Iterates decedent terminal KeyNodes (default). If this KeyNode is terminal, iterates self.

    Parameters

    • Default value global: boolean = false

      pass true to iterate all terminal keys in the hierarchy from the terminal KeyNodes.

    Returns IterableIterator<Tself>

toString

  • toString(): string

valueOf

  • valueOf(): string | number