modella-collector
v0.0.5
Published
Modella plugin to enable collection attributes
Downloads
5
Maintainers
Readme
modella-collector
modella plugin to enable collection attributes.
Usage
var modella = require('modella');
var collector = require('modella-collector');
var Disc = modella('Disc')œ
.attr('artist', {type: 'string'})
.attr('name', {type: 'string'});
var Fan = modella('Fan')
.attr('name', {type: 'string'})
.attr('discs', {type: [Disc]})
.use(collector);
var jack = new Fan({
name: 'Jack',
discs: [
{artist: 'The Beatles', name: 'Sgt. Pepper\'s Lonely Hearts Club Band'},
{artist: 'The Who', name: 'My Generation'}
]
});
console.log(jack.discs().first().artist()); // "The Beatles"