Options
All
  • Public
  • Public/Protected
  • All
Menu
     

Class DCT

A dictionary class that allows for duplicate keys to be inserted (LOL - trust me, it works).

Hierarchy

Index

Constructors

constructor

  • new DCT(KVs: object): DCT
  • Instantiates a new DCT instance.

    Parameters

    • KVs: object

      The object of key/value pairs

      • [key: string]: any

    Returns DCT

Accessors

size

  • get size(): number
  • The amount of ITMs in this DCT.

    Returns number

length

  • get length(): number
  • An alias for size.

    Returns number

first

  • get first(): ITM
  • set first(value: any): void
  • Gets/Sets the first ITM in this DCT.

    Returns ITM

  • Gets/Sets the first ITM in this DCT.

    Parameters

    • value: any

      A value that will be converted into the first ITM.

    Returns void

last

  • get last(): ITM
  • set last(value: any): void
  • Gets/Sets the last ITM in this DCT.

    Returns ITM

  • Gets/Sets the last ITM in this DCT.

    Parameters

    • value: any

      A value that will be converted into the last ITM.

    Returns void

Methods

keys

  • Retrieves the keys within this DCT.

    Returns DCTKey[]

vals

  • vals(): any
  • Retrieves the value within this DCT.

    Returns any

parse

  • parse(name: string): object
  • Parses a <key>$<position> string into a digestible search object.

    Parameters

    • name: string

      A valid <key>$<position> string (/^\w+([$]\d*)?$/).

    Returns object

    • key: string
    • idx: number
    • pos: number

find

  • find(name: string): ITM
  • Retrieves an ITM at the specified <key>$<position> string.

    Parameters

    • name: string

      A valid <key>$<position> string (/^\w+([$]\d*)?$/).

    Returns ITM

has

  • has(key: string, pos: number): boolean
  • Determines if an ITM exists at the specified key & postion.

    Parameters

    • key: string

      The ITM key.

    • pos: number

      The position of the key.

    Returns boolean

contains

  • contains(value: any): boolean
  • Determines if an ITM with the specified value exists.

    Parameters

    • value: any

      Any value to look for.

    Returns boolean

push

  • Pushes a new ITM into the DCT

    Parameters

    • key: DCTKey

      The ITM key.

    • value: any

      The ITM value.

    Returns DCT

pull

  • pull(key: string, pos: number): DCT
  • Removes an ITM at

    Parameters

    • key: string

      The ITM key.

    • pos: number

      The postion of the ITM to retrieve.

    Returns DCT

forEach

  • forEach(callback: any): any[]
  • Performs a callback function over each ITM within this DCT as if it was an Array.

    Parameters

    • callback: any

      A handler callback.

    Returns any[]

loop

  • loop(callback: any): DCT
  • Performs a callback function over each ITM within this DCT, creating a new List-style DCT in the process.

    Parameters

    • callback: any

      A handler callback.

    Returns DCT

map

  • map(callback: any): DCT
  • Performs a callback function over each ITM within this DCT, creating a new Map-style DCT in the process.

    Parameters

    • callback: any

      A handler callback.

    Returns DCT

filter

  • filter(callback: any): DCT
  • Filters out ITMs within this DCT using the specified callback function.

    Parameters

    • callback: any

      A handler callback.

    Returns DCT

toString

  • toString(): string
  • A String representation of this DCT.

    Returns string

toArray

  • toArray(): any[]
  • An Array representation of this DCT.

    Returns any[]

toObject

  • toObject(): any
  • A plain-object representation of this DCT.

    Returns any

toJSON

  • toJSON(): string
  • A JSON-String representation of this DCT.

    Returns string

Static CALLABLE

  • CALLABLE<T>(obj: any, handles: EHANDLERS<T>): Proxy
  • Makes an Object "callable"

    Type parameters

    • T

    Parameters

    • obj: any

      The Object to make "callable"

    • handles: EHANDLERS<T>

      The Proxy handlers

    Returns Proxy

    A new, Proxied Object

Static set

  • set(target: DCT, name: DCTKey, value: any, _item: ProxyConstructor): boolean
  • Converts a value into an ITM and inserts it into the specifed DCT under the specified key.

    Parameters

    • target: DCT

      The DCT instance to add the new ITM to.

    • name: DCTKey

      The key to add the new ITM under.

    • value: any

      The value of this new ITM.

    • _item: ProxyConstructor

      NOT USED

    Returns boolean