INNER CODE UNIT · JavaScript
toUrl
albertincx/formatbot1 · src/api/utils/index.js:60
const toUrl = url => {
if (url.match('www.')) {
url = url.replace(/www\./, '');
}
if (!url.match(/^(https?|ftp|file)/)) return `http://${url}`;
return url;
};
const isDateMoreADay = (date) => {
if (!date) {
return true;
}
const now = Date.now();
const oneDay = 24 * 60 * 60 * 1000;
return (now - date) > oneDay;
}
module.exports.commandCheck = commandCheck;