Promisify the given names on the given object, and create a copy of the object.

@param {*} obj A value that can have properties.
@param {String[]} methodNames The methods to promisify.
@param {Boolean|String[]} options.variadic See the documentation for promisify.
@return {Object} The promisified object.
function promisifyMethods(obj, methodNames, options) {
  if (!obj) {
    // This object could be anything, including a function, a real object, or an array.
    throw new TypeError('promisify.methods requires a truthy value');
  }

  const out = {};

  for (let methodName of methodNames) {
    out[methodName] = promisify(obj[methodName].bind(obj), options);
  }

  return out;
}