diff options
Diffstat (limited to 'node_modules/auto-bind/index.js')
-rw-r--r-- | node_modules/auto-bind/index.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/node_modules/auto-bind/index.js b/node_modules/auto-bind/index.js new file mode 100644 index 000000000..2cca81f6c --- /dev/null +++ b/node_modules/auto-bind/index.js @@ -0,0 +1,12 @@ +'use strict'; +module.exports = self => { + for (const key of Object.getOwnPropertyNames(self.constructor.prototype)) { + const val = self[key]; + + if (key !== 'constructor' && typeof val === 'function') { + self[key] = val.bind(self); + } + } + + return self; +}; |