uptime-kuma/server/util.js

17 lines
379 B
JavaScript
Raw Normal View History

// Common JS cannot be used in frontend sadly
// sleep, ucfirst is duplicated in ../src/util-frontend.js
2021-07-01 06:47:14 -07:00
2021-07-15 10:44:51 -07:00
exports.sleep = function (ms) {
2021-06-25 06:55:49 -07:00
return new Promise(resolve => setTimeout(resolve, ms));
}
2021-06-29 01:06:20 -07:00
2021-07-15 10:44:51 -07:00
exports.ucfirst = function (str) {
2021-07-08 23:14:03 -07:00
if (! str) {
return str;
}
2021-06-29 01:06:20 -07:00
const firstLetter = str.substr(0, 1);
return firstLetter.toUpperCase() + str.substr(1);
}