Have ideas to improve npm?Join in the discussion! »

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

Keywords

none

Install

npm i named-function

DownloadsWeekly Downloads

13

Version

1.0.3

License

none

Last publish

Collaborators

  • avatar