function patchPromise() {
  const props = {};
  for (let method of methods) {
    if (Promise.prototype[method.name] && Promise.prototype[method.name] !== method) {
      throw new Error('`Promise` already defines method `' + method.name + '`');
    }
    props[method.name] = {
      configurable: true,
      enumerable: false,
      writable: true,
      value: method
    };
  }
  Object.defineProperties(Promise.prototype, props);
}
function patchPromise() {
  const props = {};
  for (let method of methods) {
    if (Promise.prototype[method.name] && Promise.prototype[method.name] !== method) {
      throw new Error('`Promise` already defines method `' + method.name + '`');
    }
    props[method.name] = {
      configurable: true,
      enumerable: false,
      writable: true,
      value: method
    };
  }
  Object.defineProperties(Promise.prototype, props);
}
function patchPromise ( ) { const props = { } ; for ( let method of methods ) { if ( Promise . prototype [ method . name ] && Promise . prototype [ method . name ] !== method ) { throw new Error ( '`Promise` already defines method `' + method . name + '`' ) ; } props [ method . name ] = { configurable : true , enumerable : false , writable : true , value : method } ; } Object . defineProperties ( Promise . prototype , props ) ; }
Patches the global `Promise` built-in to define `asCallback` and others as instance methods,
so you can do e.g. `Promise.resolve(true).asCallback(cb)`.

Idempotent.

@throws {Error} If `Promise` already defines one or more of the instance methods.
Patches the global Promise built - in to define asCallback and others as instance methods so you can do e . g . Promise . resolve ( true ) . asCallback ( cb ) .