level-defaults

Default keys for levelup

npm install level-defaults
1 downloads in the last week
4 downloads in the last month

level-defaults Build Status

Adds a defaults() method to your LevelUp.

Install the module with: npm install level-defaults --save

var levelup = require('levelup');
var levelDefaults = require('level-defaults');

var db = levelup('/tmp/foo.db');
db = levelDefaults(db);

db.defaults({
  user: 'shama',
  pass: '1234',
}, {
  homepage: 'http://dontkry.com'
}, function(err, data) {
  // data = {user: 'shama', pass: '1234', homepage: 'http://dontkry.com'}
});

// ... later ...

db.defaults({
  user: null,
  pass: null
}, function(err, data) {
  // data = {user: 'shama', pass: '1234'}
});

Release History

  • 0.1.0 - initial release

License

Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.

npm loves you