npm

Share private packages across your team with npm Orgs, now with simplified billing via the aws marketplace!Learn more »

keyvaluedb

1.4.2 • Public • Published

keyvaluedb

source issues documentation

node package manager travis-ci lgtm david-dm david-dm

Key Value database middleware for node and the browser.

Install

Node
npm i keyvaluedb

Usage

Either a specific database class can be initialized, or the defaultDB function can be used to attempt to find a DB that works in your runtime environment.

const { defaultDB, memoryDB, chromeStorageDB } = require('keyvaluedb')
const db = defaultDB()
await db.set('key', 'value')
await db.get('key') // value
await db.setMany({1: 1, 2: 2})
await db.getMany([1, 2]) // {1: 1, 2: 2}

Then you are free to make use of the promised based get, set, setMany and getMany functions. See tests for examples.

Mixin

To use as an es6 class mixin, first use object-to-class.

const o2c = require('object-to-class')
const MemoryDB = o2c(memoryDB, 'MemoryDB')
class MyDB extends MemoryDB {}
let mydb = new MyDB()
mydb instanceof MemoryDB // true

License

MIT Copyright isysd public@iramiller.com

Keywords

install

npm i keyvaluedb

Downloadsweekly downloads

6

version

1.4.2

license

MIT

homepage

guld.tech

repository

Gitbitbucket

last publish

collaborators

  • avatar
Report a vulnerability