coffee-script-properties
Adds support for native javascript properties on coffeescript classes and objects.
Installation
npm install schemify
Usage
This module adds functionality to the global Function namespace, so you only need to require it once. A good place would be at the beginning of your application or module:
require "coffee-script-properties"
After this, you can start writing properties in your classes and objects.
Properties in classes
Getters
: @getter "area" @width * @height rectangle = consolelog rectanglearea # 100
Setters
: @setter "name" valuesplit " " person = person.name = "John Doe"consolelog personfirst # John consolelog personlast # Doe
Getters and setters together
: @property "price" : -> @netPrice + @taxes : @netPrice = value - @taxes product = 100consolelog productnetPrice # 100 consolelog productprice # 150 product.price = 500consolelog productnetPrice # 450 consolelog productprice # 500
Properties in objects
TO-DO ... working on it!