2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/frappe/utils.js
2018-01-10 16:21:35 +05:30

17 lines
303 B
JavaScript

module.exports = {
slug(text) {
return text.toLowerCase().replace(/ /g, '_');
},
async_handler(fn) {
return (req, res, next) => Promise.resolve(fn(req, res, next))
.catch(next);
},
async sleep(seconds) {
return new Promise(resolve => {
setTimeout(resolve, seconds * 1000);
});
}
}