modella-collector

0.0.5 • Public • Published

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"

/modella-collector/

    Package Sidebar

    Install

    npm i modella-collector

    Weekly Downloads

    0

    Version

    0.0.5

    License

    ISC

    Last publish

    Collaborators

    • dawicorti