1.0.12 • Published 7 months ago

@aeontek/dictionary v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Dictionary

Class for handling string-indexed objects. Similar to Dictionaries or Advanced Lists in other languages

Kind: global class

dictionary.getById(id) ⇒ any

Gets the object listed under the specific ID. If no such item exists, returns null

Kind: instance method of Dictionary
Returns: any - The object identified by the unique identifier

ParamTypeDescription
idstringThe unique identifier for the specified object

dictionary.add(id)

Adds an object with a unique ID. If the ID is already taken, throws an error.

Kind: instance method of Dictionary
Throws:

  • Invalid Identifier
ParamTypeDescription
idstringThe unique identifier for the specified object

dictionary.remove(id) ⇒ any

Removes the object listed under the specific ID and returns the deleted object. If no such item exists, returns null

Kind: instance method of Dictionary
Returns: any - The deleted object identified by the unique identifier

ParamTypeDescription
idstringThe unique identifier for the specified object

dictionary.forEach(callback)

Iterates through the Ditcionary and performs an action on each item

Kind: instance method of Dictionary

ParamTypeDescription
callbackfunctionThe Action to be performed on each iteration

dictionary.map(callback) ⇒ Array

Iterates through the Ditcionary and performs an action on each item, returning an array of the iterated results.

Kind: instance method of Dictionary
Returns: Array - An array of the iterated results.

ParamTypeDescription
callbackfunctionThe Action to be performed on each iteration

dictionary.getKeys()

Lists all the keys used in the Dictionary

Kind: instance method of Dictionary

Dictionary.fromObject(obj) ⇒ Dictionary.<T>

Created a Dictionary from a JavaScript object

Kind: static method of Dictionary

ParamType
objObject
1.0.12

7 months ago

1.0.8

8 months ago