named-function v1.0.3
npm install --save named-function
with named-function
CoffeeScript:
NamedFunction = require "named-function"Rectangle = NamedFunction "Rectangle", (@width, @height) ->
JavaScript:
var NamedFunction = require("named-function")var Rectangle = NamedFunction("Rectangle", function (width, height) { this.width = width this.height = height})
without named-function
CoffeeScript:
# Impossible in CoffeeScript.
JavaScript:
var Rectangle = (function () { return function Rectangle (width, height) { this.width = width this.height = height }})()