- Registry
Representing a key-value registry
Representing a key-value registry
Kind: global class
- Registry
- new Registry()
- .clear() ⇒
undefined
- .delete(key) ⇒
boolean
- .get(key) ⇒
any
- .set(key, value) ⇒
Registry
- .load(obj) ⇒
- .has(key) ⇒
boolean
- .keys() ⇒
array
- .values() ⇒
array
- .entries() ⇒
array
Creates a new instance of Registry
Returns: Registry
- The created Registry instance
Example
// CommonJS modules
const { Registry } = require('reagis');
// ES2015 modules
import { Registry } from 'reagis';
// Instantiate
const registry = new Registry();
Wipe out all entries in the registry
Kind: instance method of Registry
Returns: undefined
- nothing
Access: public
Delete an entry.
Kind: instance method of Registry
Returns: boolean
- true if the entry exists and got deleted, false otherwise
Access: public
Param | Type | Description |
---|---|---|
key | any |
The key used to identify the entry |
Retrieve an entry value
Kind: instance method of Registry
Returns: any
- The entry value if it exists, undefined otherwise
Access: public
Param | Type | Description |
---|---|---|
key | any |
The key used to identify the entry |
registry.set(key, value) ⇒ Registry
Set an entry value
Kind: instance method of Registry
Returns: Registry
- The calling Registry instance
Access: public
Param | Type | Description |
---|---|---|
key | any |
The key used to identify the entry |
value | any |
The value that will be set to the entry |
Load an entire key-value object as entries
Kind: instance method of Registry
Returns: The calling Registry instance
Access: public
Param | Type | Description |
---|---|---|
obj | any |
A key-value object |
Check whether or not an entry exists
Kind: instance method of Registry
Returns: boolean
- true if such entry exists, false otherwise
Access: public
Param | Type | Description |
---|---|---|
key | any |
The key used to identify the entry |
Retrieve all existing entry keys
Kind: instance method of Registry
Returns: array
- Return an array of all existing keys in insertion order
Access: public
Retrieve all existing entry values
Kind: instance method of Registry
Returns: array
- Return an array of all existing values in insertion order
Access: public
Retrieve all existing entries
Kind: instance method of Registry
Returns: array
- Return an array of all existing entries in insertion order with the structure { key, value }
Access: public
registry : Registry
Default exported registry instance
Kind: global constant
Example
// CommonJS modules
const registry = require('reagis');
// ES2015 modules
import registry from 'reagis';