decktape/libs/util.js

10 lines
334 B
JavaScript
Raw Normal View History

2017-08-21 23:56:27 +03:00
'use strict';
2017-08-23 18:04:37 +03:00
module.exports.call = f => async val => { await f(val); return val };
2017-08-21 23:56:27 +03:00
2017-08-23 18:04:37 +03:00
module.exports.delay = delay => value => new Promise(resolve => setTimeout(resolve, delay, value));
2017-08-21 23:56:27 +03:00
2017-08-23 18:04:37 +03:00
module.exports.pause = delay => new Promise(resolve => setTimeout(resolve, delay));
2017-08-21 23:56:27 +03:00
2017-08-23 18:04:37 +03:00
module.exports.wait = ms => () => module.exports.delay(ms);