Skip to content

Latest commit

 

History

History
164 lines (121 loc) · 4.64 KB

API.md

File metadata and controls

164 lines (121 loc) · 4.64 KB

Classes

Registry

Representing a key-value registry

Constants

registry : Registry

Default exported registry instance

Registry

Representing a key-value registry

Kind: global class

new Registry()

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();

registry.clear() ⇒ undefined

Wipe out all entries in the registry

Kind: instance method of Registry
Returns: undefined - nothing
Access: public

registry.delete(key) ⇒ boolean

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

registry.get(key) ⇒ any

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

registry.load(obj) ⇒

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

registry.has(key) ⇒ boolean

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

registry.keys() ⇒ array

Retrieve all existing entry keys

Kind: instance method of Registry
Returns: array - Return an array of all existing keys in insertion order
Access: public

registry.values() ⇒ array

Retrieve all existing entry values

Kind: instance method of Registry
Returns: array - Return an array of all existing values in insertion order
Access: public

registry.entries() ⇒ array

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';