2021-06-29 09:06:20 +01:00
|
|
|
/*
|
|
|
|
* Common functions - can be used in frontend or backend
|
|
|
|
*/
|
|
|
|
|
2021-07-01 14:47:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-15 18:44:51 +01:00
|
|
|
exports.sleep = function (ms) {
|
2021-06-25 14:55:49 +01:00
|
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
|
|
}
|
2021-06-29 09:06:20 +01:00
|
|
|
|
2021-07-15 18:44:51 +01:00
|
|
|
exports.ucfirst = function (str) {
|
2021-07-09 07:14:03 +01:00
|
|
|
if (! str) {
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2021-06-29 09:06:20 +01:00
|
|
|
const firstLetter = str.substr(0, 1);
|
|
|
|
return firstLetter.toUpperCase() + str.substr(1);
|
|
|
|
}
|
2021-06-30 19:02:54 +01:00
|
|
|
|