shim.js 357 B

1234567891011121314151617
  1. 'use strict';
  2. var util = require('util');
  3. var getPolyfill = require('./polyfill');
  4. module.exports = function shimUtilPromisify() {
  5. var polyfill = getPolyfill();
  6. if (polyfill !== util.promisify) {
  7. Object.defineProperty(util, 'promisify', {
  8. configurable: true,
  9. enumerable: true,
  10. value: polyfill,
  11. writable: true
  12. });
  13. }
  14. return polyfill;
  15. };