diff options
Diffstat (limited to 'node_modules/component-bind')
-rw-r--r-- | node_modules/component-bind/.npmignore | 4 | ||||
-rw-r--r-- | node_modules/component-bind/History.md | 13 | ||||
-rw-r--r-- | node_modules/component-bind/Makefile | 7 | ||||
-rw-r--r-- | node_modules/component-bind/Readme.md | 64 | ||||
-rw-r--r-- | node_modules/component-bind/component.json | 13 | ||||
-rw-r--r-- | node_modules/component-bind/index.js | 23 | ||||
-rw-r--r-- | node_modules/component-bind/package.json | 81 |
7 files changed, 205 insertions, 0 deletions
diff --git a/node_modules/component-bind/.npmignore b/node_modules/component-bind/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/component-bind/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/component-bind/History.md b/node_modules/component-bind/History.md new file mode 100644 index 0000000..2795fdb --- /dev/null +++ b/node_modules/component-bind/History.md @@ -0,0 +1,13 @@ + +1.0.0 / 2014-05-27 +================== + + * index: use slice ref (#7, @viatropos) + * package: rename package to "component-bind" + * package: add "repository" field (#6, @repoify) + * package: add "component" section + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/component-bind/Makefile b/node_modules/component-bind/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/component-bind/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test
\ No newline at end of file diff --git a/node_modules/component-bind/Readme.md b/node_modules/component-bind/Readme.md new file mode 100644 index 0000000..6a8febc --- /dev/null +++ b/node_modules/component-bind/Readme.md @@ -0,0 +1,64 @@ +# bind + + Function binding utility. + +## Installation + +``` +$ component install component/bind +``` + +## API + + - [bind(obj, fn)](#bindobj-fn) + - [bind(obj, fn, ...)](#bindobj-fn-) + - [bind(obj, name)](#bindobj-name) +<a name=""></a> + +<a name="bindobj-fn"></a> +### bind(obj, fn) +should bind the function to the given object. + +```js +var tobi = { name: 'tobi' }; + +function name() { + return this.name; +} + +var fn = bind(tobi, name); +fn().should.equal('tobi'); +``` + +<a name="bindobj-fn-"></a> +### bind(obj, fn, ...) +should curry the remaining arguments. + +```js +function add(a, b) { + return a + b; +} + +bind(null, add)(1, 2).should.equal(3); +bind(null, add, 1)(2).should.equal(3); +bind(null, add, 1, 2)().should.equal(3); +``` + +<a name="bindobj-name"></a> +### bind(obj, name) +should bind the method of the given name. + +```js +var tobi = { name: 'tobi' }; + +tobi.getName = function() { + return this.name; +}; + +var fn = bind(tobi, 'getName'); +fn().should.equal('tobi'); +``` + +## License + + MIT
\ No newline at end of file diff --git a/node_modules/component-bind/component.json b/node_modules/component-bind/component.json new file mode 100644 index 0000000..4e1e93f --- /dev/null +++ b/node_modules/component-bind/component.json @@ -0,0 +1,13 @@ +{ + "name": "bind", + "version": "1.0.0", + "description": "function binding utility", + "keywords": [ + "bind", + "utility" + ], + "dependencies": {}, + "scripts": [ + "index.js" + ] +} diff --git a/node_modules/component-bind/index.js b/node_modules/component-bind/index.js new file mode 100644 index 0000000..4eeb2c0 --- /dev/null +++ b/node_modules/component-bind/index.js @@ -0,0 +1,23 @@ +/** + * Slice reference. + */ + +var slice = [].slice; + +/** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + +module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } +}; diff --git a/node_modules/component-bind/package.json b/node_modules/component-bind/package.json new file mode 100644 index 0000000..a79bdb6 --- /dev/null +++ b/node_modules/component-bind/package.json @@ -0,0 +1,81 @@ +{ + "_args": [ + [ + { + "raw": "component-bind@1.0.0", + "scope": null, + "escapedName": "component-bind", + "name": "component-bind", + "rawSpec": "1.0.0", + "spec": "1.0.0", + "type": "version" + }, + "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/socket.io-client" + ] + ], + "_from": "component-bind@1.0.0", + "_id": "component-bind@1.0.0", + "_inCache": true, + "_location": "/component-bind", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "_npmVersion": "1.4.9", + "_phantomChildren": {}, + "_requested": { + "raw": "component-bind@1.0.0", + "scope": null, + "escapedName": "component-bind", + "name": "component-bind", + "rawSpec": "1.0.0", + "spec": "1.0.0", + "type": "version" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "_shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", + "_shrinkwrap": null, + "_spec": "component-bind@1.0.0", + "_where": "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/socket.io-client", + "bugs": { + "url": "https://github.com/component/bind/issues" + }, + "component": { + "scripts": { + "bind/index.js": "index.js" + } + }, + "dependencies": {}, + "description": "function binding utility", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "directories": {}, + "dist": { + "shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", + "tarball": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz" + }, + "homepage": "https://github.com/component/bind", + "keywords": [ + "bind", + "utility" + ], + "maintainers": [ + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "name": "component-bind", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/component/bind.git" + }, + "version": "1.0.0" +} |