component / model

Minimalistic extensible data models
122 stars 40 forks source link

consider adding 'default' value to attr #24

Closed weepy closed 10 years ago

weepy commented 11 years ago

ie.

model('Bucket') .attr('count', { default: 0 })

avetisk commented 11 years ago

I guess that goes in the plugins section, considering that required is in that case.

Though, personally I would add both natively.

tj commented 11 years ago

the nice thing about separating them is that you can easily craft your own "version" of model by forking, and adding those plugins as dependencies, removing any boilerplate you didn't want

weepy commented 11 years ago

yes that makes alot of sense. I did investigate that method, but wasn't sure how to go about doing it. The model:initialize event would make this easier.

tj commented 11 years ago

yup need the event first

ianstormtaylor commented 11 years ago

Made a plugin that does this for you: https://github.com/segmentio/model-defaults