UNPKG

@qbatch/sqs-consumer

Version:

Build SQS-based Node applications without the boilerplate

16 lines (15 loc) 530 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function isMethod(propertyName, value) { return propertyName !== 'constructor' && typeof value === 'function'; } function autoBind(obj) { const propertyNames = Object.getOwnPropertyNames(obj.constructor.prototype); propertyNames.forEach((propertyName) => { const value = obj[propertyName]; if (isMethod(propertyName, value)) { obj[propertyName] = value.bind(obj); } }); } exports.autoBind = autoBind;