Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Manager<K, V>

Acts as an enhanced version of the Map class with new features and changed behavior for convenience

Type parameters

  • K

    the type of keys to store use to store values

  • V

    the type of values to store

Hierarchy

  • Manager

Index

Constructors

constructor

  • new Manager<K, V>(value?: [K, V][]): Manager<K, V>
  • Type parameters

    • K

    • V

    Parameters

    • Optional value: [K, V][]

    Returns Manager<K, V>

Properties

map

map: Map<K, V>

For backward compatability and performance reasons Manager use Map to store data

Accessors

length

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

    Returns number

size

  • get size(): number
  • Returns the total number of items stored in the Manager

    Returns number

Methods

[iterator]

  • [iterator](): IterableIterator<[K, V]>

add

  • Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers

    Parameters

    • value: V

    Returns Manager<K, V>

clear

  • Clear the Manager of all its contents

    Returns Manager<K, V>

delete

  • delete(key: K): boolean
  • Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist

    Parameters

    • key: K

    Returns boolean

entries

  • entries(): IterableIterator<[K, V]>
  • Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order.

    Returns IterableIterator<[K, V]>

forEach

  • forEach(callback: (value?: V, key?: K, map?: Map<K, V>) => void, context?: object): Manager<K, V>
  • Iterates through the Managers contents, calling a callback function every iteration

    Parameters

    • callback: (value?: V, key?: K, map?: Map<K, V>) => void
        • (value?: V, key?: K, map?: Map<K, V>): void
        • Parameters

          • Optional value: V
          • Optional key: K
          • Optional map: Map<K, V>

          Returns void

    • Optional context: object

    Returns Manager<K, V>

get

  • get(key: K): V
  • Get a value stored in the Manager

    Parameters

    • key: K

    Returns V

getMap

  • getMap(): Map<K, V>
  • Returns the Manager classes base Map

    Returns Map<K, V>

has

  • has(key: K): boolean
  • Checks if the Manager contains a certain key

    Parameters

    • key: K

    Returns boolean

keys

  • keys(): K[]
  • Returns the keys of all items stored in the Manager as an Array

    Returns K[]

last

  • last(distance?: number): V
  • Returns the last item in the Manager who's index is a certain distance from the last item in the Manager

    Parameters

    • distance: number = 1

    Returns V

remove

  • Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains

    Parameters

    • key: K

    Returns Manager<K, V>

set

  • set(key: K, value: V): Manager<K, V>
  • Set a value to the Manager using a key

    Parameters

    • key: K
    • value: V

    Returns Manager<K, V>

values

  • values(): V[]
  • Returns the values of all items stored in the Manager as an Array

    Returns V[]

Generated using TypeDoc