uptime-kuma/server/util.js

21 lines
333 B
JavaScript
Raw Normal View History

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