1.0.3 • Published 9 years ago

named-function v1.0.3

Weekly downloads
19
License
-
Repository
github
Last release
9 years ago

named-function v1.0.3 locked

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
  }
})()