{"_id":"auto-bind","_rev":"1277656","name":"auto-bind","description":"Automatically bind methods to their class instance","dist-tags":{"latest":"5.0.1"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-10-18T05:55:59.000Z","created":"2016-08-09T19:47:29.798Z","5.0.1":"2021-10-18T05:54:17.480Z","5.0.0":"2021-10-13T13:26:56.557Z","4.0.0":"2019-12-16T11:25:35.198Z","3.0.0":"2019-10-19T07:49:01.722Z","2.1.1":"2019-10-03T10:07:55.429Z","2.1.0":"2019-04-07T10:14:10.955Z","2.0.0":"2018-12-23T00:49:25.233Z","1.2.1":"2018-06-20T09:35:15.930Z","1.2.0":"2018-01-19T21:44:22.085Z","1.1.0":"2017-01-30T15:01:06.462Z","1.0.0":"2017-01-13T09:52:33.826Z","0.1.0":"2016-08-09T19:47:29.798Z"},"users":{"cwagner":true,"cschmitz81":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"versions":{"5.0.1":{"name":"auto-bind","version":"5.0.1","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{".":"./index.js","./react":"./react.js"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"devDependencies":{"@types/react":"^17.0.29","ava":"^3.15.0","tsd":"^0.18.0","xo":"^0.45.0"},"gitHead":"684000fdcc777c5fb537795c5b30ab6b4d688040","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@5.0.1","_nodeVersion":"14.17.5","_npmVersion":"7.20.3","dist":{"shasum":"50d8e63ea5a1dddcb5e5e36451c1a8266ffbb2ae","size":2778,"noattachment":false,"key":"/auto-bind/-/auto-bind-5.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-5.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_5.0.1_1634536457325_0.17357331067752924"},"_hasShrinkwrap":false,"publish_time":1634536457480,"_cnpm_publish_time":1634536457480},"5.0.0":{"name":"auto-bind","version":"5.0.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{".":"./index.js","./react":"./react.js"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"devDependencies":{"@types/react":"^17.0.29","ava":"^3.15.0","tsd":"^0.18.0","xo":"^0.45.0"},"gitHead":"60a2544cca8b4640e53dcb21c4b6907f87aa63b2","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@5.0.0","_nodeVersion":"14.17.5","_npmVersion":"7.20.3","dist":{"shasum":"bede489ade84146ad1a5e43504553d2b38b3f0a5","size":2747,"noattachment":false,"key":"/auto-bind/-/auto-bind-5.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-5.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_5.0.0_1634131616348_0.3129929051107718"},"_hasShrinkwrap":false,"publish_time":1634131616557,"_cnpm_publish_time":1634131616557},"4.0.0":{"name":"auto-bind","version":"4.0.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"devDependencies":{"@types/react":"^16.9.9","ava":"^2.4.0","tsd":"^0.11.0","xo":"^0.25.3"},"gitHead":"1f3e975d842cbceaa40ed6abdf680e54a9a3ef43","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@4.0.0","_nodeVersion":"10.17.0","_npmVersion":"6.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb","size":2762,"noattachment":false,"key":"/auto-bind/-/auto-bind-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-4.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_4.0.0_1576495535089_0.729291577961503"},"_hasShrinkwrap":false,"publish_time":1576495535198,"_cnpm_publish_time":1576495535198},"3.0.0":{"name":"auto-bind","version":"3.0.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"devDependencies":{"@types/react":"^16.9.9","ava":"^2.4.0","tsd":"^0.9.0","xo":"^0.25.3"},"peerDependencies":{"@types/react":">=16.8.0"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"gitHead":"f54e296bab085afb3d0fdb215a4112755f56f206","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@3.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"67773e64899b228f6d2a841709e7e086cfed31a3","size":2776,"noattachment":false,"key":"/auto-bind/-/auto-bind-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_3.0.0_1571471341575_0.8873048382184678"},"_hasShrinkwrap":false,"publish_time":1571471341722,"_cnpm_publish_time":1571471341722},"2.1.1":{"name":"auto-bind","version":"2.1.1","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd"},"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"dependencies":{"@types/react":"^16.8.12"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.3","xo":"^0.24.0"},"gitHead":"b21db0ee5550061cb6e4a64203f0220bc54b64d1","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@2.1.1","_nodeVersion":"10.16.3","_npmVersion":"6.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"8ae509671ecdfbd5009fc99b0f19ae9c3a2abf50","size":2783,"noattachment":false,"key":"/auto-bind/-/auto-bind-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-2.1.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_2.1.1_1570097275300_0.040678358125094016"},"_hasShrinkwrap":false,"publish_time":1570097275429,"_cnpm_publish_time":1570097275429},"2.1.0":{"name":"auto-bind","version":"2.1.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd"},"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"dependencies":{"@types/react":"^16.8.12"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"1da27088354fac37e8e212b89cc4c75bbf25b2b5","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@2.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"254e12d53063d7cab90446ce021accfb3faa1464","size":2769,"noattachment":false,"key":"/auto-bind/-/auto-bind-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_2.1.0_1554632050806_0.11002999174145134"},"_hasShrinkwrap":false,"publish_time":1554632050955,"_cnpm_publish_time":1554632050955},"2.0.0":{"name":"auto-bind","version":"2.0.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"devDependencies":{"ava":"^1.0.1","xo":"^0.23.0"},"gitHead":"fc65bd510e40a8cd71706aeb9b75289b62829e77","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"9a55a461b521f58daf955169203bed1a07a970a9","size":2408,"noattachment":false,"key":"/auto-bind/-/auto-bind-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_2.0.0_1545526165093_0.8713393224161645"},"_hasShrinkwrap":false,"publish_time":1545526165233,"_cnpm_publish_time":1545526165233},"1.2.1":{"name":"auto-bind","version":"1.2.1","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"26922ac7730115bb910f83cea6fb0aed6d42fe96","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@1.2.1","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"807f7910b0210db9eefe133f3492c28e89698b96","size":2247,"noattachment":false,"key":"/auto-bind/-/auto-bind-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-1.2.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind_1.2.1_1529487315840_0.44540433031597537"},"_hasShrinkwrap":false,"publish_time":1529487315930,"_cnpm_publish_time":1529487315930},"1.2.0":{"name":"auto-bind","version":"1.2.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self","react","component"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"07f0eef1fbdc21d6e6cb7e511c92036b52fd885c","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@1.2.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"8b7e318aad53d43ba8a8ecaf0066d85d5f798cd6","size":2209,"noattachment":false,"key":"/auto-bind/-/auto-bind-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-1.2.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-bind-1.2.0.tgz_1516398261921_0.7868953626602888"},"directories":{},"publish_time":1516398262085,"_hasShrinkwrap":false,"_cnpm_publish_time":1516398262085},"1.1.0":{"name":"auto-bind","version":"1.1.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"c1015630437c4aecd06843d5289368cb5327ccbe","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@1.1.0","_shasum":"93b864dc7ee01a326281775d5c75ca0a751e5961","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"93b864dc7ee01a326281775d5c75ca0a751e5961","size":1791,"noattachment":false,"key":"/auto-bind/-/auto-bind-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-1.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/auto-bind-1.1.0.tgz_1485788466244_0.8822770155966282"},"directories":{},"publish_time":1485788466462,"_cnpm_publish_time":1485788466462,"_hasShrinkwrap":false},"1.0.0":{"name":"auto-bind","version":"1.0.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"4cc10fec3d0a65c71eeea92029359f2153127205","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@1.0.0","_shasum":"d0cbe26df5871f3347b04b871daad0d3b399e501","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"d0cbe26df5871f3347b04b871daad0d3b399e501","size":1727,"noattachment":false,"key":"/auto-bind/-/auto-bind-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/auto-bind-1.0.0.tgz_1484301152094_0.12119735451415181"},"directories":{},"publish_time":1484301153826,"_cnpm_publish_time":1484301153826,"_hasShrinkwrap":false},"0.1.0":{"name":"auto-bind","version":"0.1.0","description":"Automatically bind methods to their class instance","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/auto-bind.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["auto","bind","class","methods","method","automatically","prototype","instance","function","this","self"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"7297961487a14521a23ab957784cb38a0bb71747","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"homepage":"https://github.com/sindresorhus/auto-bind#readme","_id":"auto-bind@0.1.0","_shasum":"7a29efc8c2388d3d578e02fc2df531c81ffc1ee1","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"7a29efc8c2388d3d578e02fc2df531c81ffc1ee1","size":1737,"noattachment":false,"key":"/auto-bind/-/auto-bind-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/auto-bind/download/auto-bind-0.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/auto-bind-0.1.0.tgz_1470772047073_0.19967067032121122"},"directories":{},"publish_time":1470772049798,"_cnpm_publish_time":1470772049798,"_hasShrinkwrap":false}},"readme":"# auto-bind\n\n> Automatically bind methods to their class instance\n\nIt also correctly binds inherited properties.\n\n## Install\n\n```sh\nnpm install auto-bind\n```\n\n## Usage\n\n```js\nimport autoBind from 'auto-bind';\n\nclass Unicorn {\n\tconstructor(name) {\n\t\tthis.name = name;\n\t\tautoBind(this);\n\t}\n\n\tmessage() {\n\t\treturn `${this.name} is awesome!`;\n\t}\n}\n\nconst unicorn = new Unicorn('Rainbow');\n\n// Grab the method off the class instance\nconst message = unicorn.message;\n\n// Still bound to the class instance\nmessage();\n//=> 'Rainbow is awesome!'\n\n// Without `autoBind(this)`, the above would have resulted in\nmessage();\n//=> Error: Cannot read property 'name' of undefined\n```\n\n## API\n\n### autoBind(self, options?)\n\nBind methods in `self` to their class instance.\n\nReturns the `self` object.\n\n#### self\n\nType: `object`\n\nAn object with methods to bind.\n\n#### options\n\nType: `object`\n\n##### include\n\nType: `Array<string | RegExp>`\n\nBind only the given methods.\n\n##### exclude\n\nType: `Array<string | RegExp>`\n\nBind methods except for the given methods.\n\n### React\n\nSame as `autoBind` but excludes the default [React component methods](https://reactjs.org/docs/react-component.html).\n\n```js\nimport autoBindReact from 'auto-bind/react';\n\nclass Foo extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tautoBindReact(this);\n\t}\n\n\t// …\n}\n```\n\n## Related\n\n- [bind-methods](https://github.com/sindresorhus/bind-methods) - Bind all methods in an object to itself or a specified context\n","_attachments":{},"homepage":"https://github.com/sindresorhus/auto-bind#readme","bugs":{"url":"https://github.com/sindresorhus/auto-bind/issues"},"license":"MIT"}