Socket
Socket
Sign inDemoInstall

coffee-script-model

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    coffee-script-model

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


Version published
Weekly downloads
8
Maintainers
1
Install size
552 kB
Created
Weekly downloads
 

Readme

Source

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+

Keywords

FAQs

Last updated on 01 Jun 2014

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc