UNPKG

file-prompt

Version:

An interactive prompt for selecting files from a directory.

14 lines (13 loc) 420 B
/** * Bind Methods * Binds all given methods to the provided context * * @param {object} context - Class instance or target context object * @param {...string} methods - List of mthods to bind to the context */ export default function bindMethods (context, ...methods) { methods.forEach((methodName) => { if (!context[methodName]) return; context[methodName] = context[methodName].bind(context); }); }