@actualwave/closure-value
v0.0.3
Published
Factory functions to create a value storage hidden in a closure
Downloads
203
Maintainers
Readme
Closure Value
Factory functions to create a value storage hidden in a closure
- valueFactory() - creates storage for a single value
- valuesMapFactory() - creates storage with Map hidden, allows adding key/value pairs
- valuesSetFactory() - creates storage with Set hidden, allows adding unique values
valueFactory()
Returns object with methods
- get() - retrieve current value
- set(value) - store value
valuesMapFactory()
Returns object with methods
- getDefault() - retrieve Map with default values
- copy() - retrieve a copy of the Map with all currently stored values
- delete(key) - delete value by key
- has(key) - check if value exists by key
- set(key, value) - store value by key
- get(key) - retrieve value by key
Additionaly to methods returned object contains
values
field with Map object used for storing values.
valuesSetFactory()
Returns object with methods
- getDefault() - retrieve Set with default values
- get() - retrieve a copy of Set with currently stored values
- delete(value) - remove value from Set
- has(value) - check if Set contains value
- add(value) - add value to Set
Additionaly to methods returned object contains
values
field with Set object used for storing values.