Skip to content
/ KvDb Public

Micro key-value database based on localStorage

Notifications You must be signed in to change notification settings

diewland/KvDb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

KvDb

npm

Micro key-value database based on HTML5 localStorage 🙀

install

npm install kv-db

example

<script src='kvdb.js'></script>
<script>
    var TestDb = new KvDb('TEST_DB');
    // C - create
    TestDb.set('key1', 'value1');
    TestDb.set('key2', 'value2');
    TestDb.set('key3', 'value333');
    TestDb.set('junk_key', 'some_junk');
    // R - remove
    TestDb.remove('junk_key');
    // U - update
    TestDb.set('key3', 'value3');
    // D - display
    console.log('#', 'key1', TestDb.get('key1'));
    console.log('#', 'key2', TestDb.get('key2'));
    console.log('#', 'key3', TestDb.get('key3'));
    // or
    var all = TestDb.all();
    for(var i in all){
        var o = all[i];
        console.log('>', o.k, o.v);
    }
    // and drop
    TestDb.drop('TEST_DB');
</script>

About

Micro key-value database based on localStorage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published