Skip to content

segment-boneyard/model-defaults

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

model-defaults

Lets a model specify default attribute values.

Installation

$ component install segmentio/model-defaults
$ npm install model-defaults

API

var defaults = require('model-defaults')
  , model = require('model');

// all specified up front
var person = model('person')
  .use(defaults({
    name: '',
    age: 0
  }))
  .attr('name')
  .attr('age');

// or specified individually
var person = model
  .use(defaults)
  .attr('name', { default: '' })
  .attr('age', { default: 0 });

License

MIT

About

Lets a model specify default attribute values.

Resources

Stars

Watchers

Forks

Packages

No packages published