Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone-dirty

Package Overview
Dependencies
Maintainers
7
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-dirty

  • 1.1.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

Backbone Dirty

Server-side overrides for Backbone to use node-dirty for Model persistence.

Compatibility

Backbone 0.3.3.

Usage

Pass a filepath to the db (will be created if it doesn't exist yet) when calling require().

var Backbone = require('backbone');
Backbone.sync = require('backbone-dirty')('app.db').sync;

// Backbone.sync will now load and save models from app.db.

Conventions

backbone-dirty stores models in the node-dirty db using the model.url as its key. Collections retrieve models by matching the Collection url against the initial portion of the Model url.

var orange = new FruitModel({id: 'orange'});
var apple = new FruitModel({id: 'apple'});
var banana = new FruitModel({id: 'banana'});

console.log(orange.url()); // fruits/orange
console.log(apple.url());  // fruits/apple
console.log(banana.url()); // fruits/banana

var fruits = new FruitCollection();

console.log(fruits.url);   // fruits

fruits.fetch();            // retrieves orange, apple, banana

Authors

  • Will White
  • Young Hahn

FAQs

Package last updated on 16 Apr 2012

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc