sebastiendaniel-adt

2.0.2 • Public • Published

Getting started


Classes

Dictionary

Typedefs

key

Dictionary

Kind: global class
Summary: the Dictionary stores key:value pairs of data. The keys are strings, the data can be anything. A Dictionary is fast for create/read/update/remove actions, as well is searching for entries that can be uniquely identified by their key

Dictionary.getValues() ⇒ Array

Kind: static method of Dictionary
Summary: returns an array of the values contained in the Dictionary

Dictionary.getKeys() ⇒ Array

Kind: static method of Dictionary
Summary: return an array of all existing keys in the dictionary

Dictionary.get(key) ⇒ *

Kind: static method of Dictionary
Summary: returns the stored value, identified by its key, otherwise undefined

Param Type
key key

Dictionary.set(key, value) ⇒ Dictionary

Kind: static method of Dictionary

Param Type Description
key key
value * value to bind to the key

Dictionary.remove(key) ⇒ Dictionary

Kind: static method of Dictionary
Summary: deletes the key:value pair from the Dictionary's data, if present.

Param Type
key key

Dictionary.hasKey(key) ⇒ boolean

Kind: static method of Dictionary
Summary: tests if the given key exists in the Dictionary

Param Type
key key

Dictionary.hasValue(value) ⇒ boolean

Kind: static method of Dictionary
Summary: searches the entire dictionary until the value is found (strict equality)

Param Type Description
value * value to find

Dictionary.forEach(cb) ⇒ Dictionary

Kind: static method of Dictionary
Summary: passes each pair in the dictionary through the provided callback function. The callback is called with four arguments (key, value, index, array), where array is the array-representation of the Dictionary's data

Param Type Description
cb function callback

Dictionary.clear() ⇒ Dictionary

Kind: static method of Dictionary
Summary: removes all pairs in the dictionary. This is a fairly slow operation, use with caution.

Dictionary.isEmpty() ⇒ boolean

Kind: static method of Dictionary
Summary: tests if the dictionary contains any keys

key

Kind: global typedef
Summary: used to uniquely identify an entry. All keys are coerced into strings.

Package Sidebar

Install

npm i sebastiendaniel-adt

Weekly Downloads

3

Version

2.0.2

License

MIT

Last publish

Collaborators

  • sebastiendaniel