named-function

1.0.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i named-function

Weekly Downloads

13

Version

1.0.3

License

none

Last publish

Collaborators

  • aleclarson