wallet-core/node_modules/auto-bind/index.js

13 lines
260 B
JavaScript
Raw Normal View History

2017-05-28 00:38:50 +02:00
'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;
};