coffee-script-model
A simple wrapper over the coffee-script class with getters, setters, fields, and event bindings
Last updated 6 years ago by granttimmerman .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install coffee-script-model 
SYNC missed versions from official npm registry.

coffee-script-model

A simple wrapper over the coffee-script class with getters, setters, fields, and event bindings

npm install coffee-script-model --save

Example

Model = require 'coffee-script-model'

class Person extends Model
  @property 'firstName'
  @property 'lastName'
  @property 'fullName',
    get: -> "#{@firstName} #{@lastName}"
    set: (name) -> [@firstName, @lastName] = name.split ' '
  @property 'username'
  @property 'sick', default: false

person = new Person firstName: 'bob', lastName: 'smith'
console.log person.fullName
# 'bob smith'

person.fullName = 'thomas vi'
console.log person.firstName
# 'thomas'

See example.coffee for more examples.

Supports

  • Node
  • Modern browsers
  • IE 9+

Current Tags

  • 1.0.2                                ...           latest (6 years ago)

4 Versions

  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |