New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

modella-computed

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modella-computed

Define computed properties on modella models

latest
Source
npmnpm
Version
1.2.1
Version published
Maintainers
1
Created
Source

modella-computed

Define computed properties on modella models.

build status

Usage

var computed = require('modella-computed')
var Mustard = model('Mustard')
  .use(computed)
  .attr('color', {
    defaultValue: 'Golden'
  })
  .attr('flavor', {
    // defines a constant
    value: 'Spicy'
  })
  .attr('name', {
    // defines a getter, invoked with model bound as `this` context
    get: function () {
      return this.flavor() + ' ' + this.color()
    }
  })

var mustard = new Mustard({ color : 'Brown' });
mustard.name(); // 'Spicy Brown'

mustard.set({ color: 'Yellow' })
mustard.name(); // 'Spicy Yellow'

Keywords

modella

FAQs

Package last updated on 19 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts