0.0.11 • Published 11 years ago

lilmodel v0.0.11

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

lilmodel

A li'l backbone-ish model object.

Browser usage

load dist/lilobj.js or dist/lilobj.min.js in you browser and call it like this:

(function () {

  var model = require('lilmodel').model;

  var beer = model.extend({

    defaults: {
      sizeInLiters: 0.5,
    },

    rules: {
      type: ['required', 'string']
      sizeInLiters: ['required', 'number', ['gte', 0.2]]
    }

  });

  var dunkel = beer.create({
    type: 'lager',
  });

  dunkel.save(function (err) {
    //callback from sync 
  });

}());

Node usage

install the module with: npm install lilmodel

var beer = model.extend({

  defaults: {
    sizeInLiters: 0.5,
  },

  rules: {
    type: ['required', 'string']
    sizeInLiters: ['required', 'number', ['gte', 0.2]]
  }

});

var dunkel = beer.create({
  type: 'lager',
});

dunkel.save(function (err) {
  //callback from sync 
});

Documentation

syncr(syncMethod)

model.extend(config)

model.create(properties)

model.validate()

model.save(callback)

model.fetch(callback)

model.destroy(callback)

collection.extend(config)

collection.create(propertiesList)

collection.validate()

collection.find(callback)

License

Copyright (c) 2012 August Hovland Licensed under the MIT license.

0.0.11

11 years ago

0.0.10

11 years ago

0.0.9

11 years ago

0.0.8

11 years ago

0.0.7

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.1

11 years ago