-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
49 lines (49 loc) · 2.53 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
"name": "funstance",
"version": "0.0.2",
"description": "make an instance callable like a function",
"main": "index.js",
"bin": {},
"directories": {
"example": "example",
"test": "test"
},
"devDependencies": {
"tap": "~0.3.0",
"inherits": "~1.0.0"
},
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "git://github.com/substack/funstance.git"
},
"homepage": "https://github.com/substack/funstance",
"keywords": [
"instance",
"function",
"object",
"instantiate",
"funstantiate",
"module",
"exports"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT",
"readme": "# funstance\n\nmake an instance callable like a function\n\n[![build status](https://secure.travis-ci.org/substack/funstance.png)](http://travis-ci.org/substack/funstance)\n\n# example\n\n## funstantiate a prototypical object\n\nfoo.js:\n\n``` js\nvar inherits = require('inherits');\nvar Stream = require('stream');\n\nmodule.exports = Foo;\ninherits(Foo, Stream);\n\nfunction Foo (x) {\n this.x = x;\n}\n\nFoo.prototype.beep = function () {\n this.emit('beep', 'boop');\n};\n```\n\nmain.js:\n\n``` js\nvar funstance = require('funstance');\nvar Foo = require('./foo');\n\nvar obj = new Foo(4);\nvar fobj = funstance(obj, function (n) {\n return n * obj.x\n})\n\nconsole.log(fobj(111));\nfobj.on('beep', console.log);\nfobj.beep();\n```\n\nNote that `.on()` is defined all the way in EventEmitter, which is 3 times\nremoved up the prototype chain from `fobj`, yet `fobj.on()` still works despite\nbeing a function.\n\n```\n$ node main.js\n444\nboop\n```\n\n# methods\n\n``` js\nvar funstance = require('funstance')\n```\n\n## var fobj = funstance(obj, fn)\n\nReturn a function with all the properties and prototypical methods as `obj`.\nWhen `fobj()` is called, `fn()` will fire with the arguments and `this` set to\nthe `obj`.\n\nNote that `obj` shouldn't be an Array or possibly other built-in types aside\nfrom Object since some of them behave strangely for performance reasons.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install funstance\n```\n\n# license\n\nMIT\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/funstance/issues"
},
"_id": "funstance@0.0.2",
"dist": {
"shasum": "d1cd984437766872d4bcc00e951707c285238f8d"
},
"_from": "funstance@~0.0.2",
"_resolved": "https://registry.npmjs.org/funstance/-/funstance-0.0.2.tgz"
}