2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/frappe/utils.js

17 lines
303 B
JavaScript
Raw Normal View History

2018-01-01 09:27:59 +00:00
module.exports = {
slug(text) {
return text.toLowerCase().replace(/ /g, '_');
},
async_handler(fn) {
return (req, res, next) => Promise.resolve(fn(req, res, next))
.catch(next);
2018-01-03 06:49:59 +00:00
},
2018-01-03 06:49:59 +00:00
async sleep(seconds) {
return new Promise(resolve => {
setTimeout(resolve, seconds * 1000);
});
2018-01-01 09:27:59 +00:00
}
}