mkv
v0.1.0
Published
Simply key-value memory library
Downloads
4
Readme
Simply key-value memory library
Installation
install package with yarn or npm
~ npm install --save[-dev] mkv
# or
~ yarn add [--dev] mkv
API
mkv.set(key:string, value:any, readonly:boolean = false)
import mkv from "mkv"
mkv.set("hello", "hello world") // string
// -> hello world
mkv.set("options", { a: 1, b: 2, c: 3}) // object
// -> { a: 1, b: 2, c: 3})
// set readonly data.
mkv.set("readonly", 1, true);
// -> 1
mkv.set("readonly", 2)
// throw TypeError
mkv.get(key:string)
// in other files.
import mkv from "mkv"
mkv.get("hello")
// -> hello world
mkv.get("options")
// -> {a: 1, b: 2, c: 3}
mkv.has(key:string)
// in other files.
import mkv from "mkv"
mkv.has("hello")
// -> true
mkv.get("hello2")
// -> false
mkv.delete(key:string)
// in other files.
import mkv from "mkv"
mkv.delete("hello")
// -> true
mkv.get("hello")
// -> undefined
License
[MIT](LICENSE)