New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

levelsync

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

levelsync

Backbone.Sync replacement for leveldb

latest
Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

build status

#LevelSync LevelSync is a Backbone.Model replacement which uses LevelDB via the levelup interface.

Installation

npm install --save levelsync

Usage

var levelup = require('level');
var db = levelup('./path/to/db');
var Backbone = require('backbone');
Backbone.sync = require('levelsync')(db);

var StatBlock = Backbone.Model.extend({
  defaults: {
    'str': 8,
    'con': 8,
    'wis': 8,
    'dex': 8,
    'int': 8,
    'chr': 8
  }
});

var myCharacter = new StatBlock();
myCharacter.set('str', 18);
myCharacter.set('name', 'LEROY JENKINS');
myCharacter.save(myCharacter.toJSON(), {cb: function(err){
  if(!err) console.log(myCharacter.get('name'), 'was saved');
}});

// or
var promise = myCharacter.save();
promise.when(function(){
  console.log(myCharacter.get('name'), 'was saved');
});

Changes from Backbone

The options hash accepts a new parameter, cb. This callback will be use for all the level operations if set. It's signature should be (err, data). If this is not set, a q promise will be returned instead.

License

LevelSync is copyright (c) 2013 Todd Kennedy. Usage is provided under the terms of the MIT Licence

Keywords

levelup

FAQs

Package last updated on 06 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts