@dashkite/helium
v0.12.16
Published
Browser compatible In-process name service
Readme
Helium
In-memory key-value store
import Registry from "@dashkite/helium"
do ->
Registry.set "foo", "bar"
assert.equal "bar", await Registry.get "foo"
# conditional set
assert.equal "bar", Registry.setc "foo", "baz"API
get
get key ⇢ value
Get a value from the registry.
Given a key, returns a promise that will resolve to the corresponding value, if and when it is set.
set
set key, value → value
Set a value in the registry.
Given a key and a value, sets the value corresponding to the key, returning the value and resolving any promises awaiting on it.
getc
getc key → value
Conditionally get a value from the registry.
Given a key, returns the corresponding value if one exists or undefined.
setc
setc key, value → value
Conditionally set a value in the registry.
Given a key and a value:
- Behaves like
setwhen no value corresponding to the key exists - Returns the value corresponding to the key when it exists
