index.js 243 B

12345678910111213
  1. var ms = require('ms')
  2. var sleep = function (time) {
  3. time = isNaN(time) ? ms(time) : time;
  4. return new Promise(function (resolve, reject) {
  5. setTimeout(function () {
  6. resolve()
  7. }, time)
  8. })
  9. }
  10. module.exports = exports = sleep