20 lines
539 B
JavaScript
20 lines
539 B
JavaScript
|
const crypto = require("crypto");
|
||
|
|
||
|
const addPrefixOnHttpSchema = (url, prefixDomain) => {
|
||
|
let prefixSubDomain = prefixDomain;
|
||
|
const prefixSchema = url.substring(0, url.indexOf("://") + 3);
|
||
|
const splitDomain = url.substring(url.indexOf("://") + 3);
|
||
|
|
||
|
// if (!prefixSubDomain.endsWith(".")) {
|
||
|
// prefixSubDomain = `${prefixSubDomain}.`;
|
||
|
// }
|
||
|
|
||
|
return `${prefixSchema}${prefixSubDomain}${splitDomain}`;
|
||
|
};
|
||
|
|
||
|
const generateUUID = () => {
|
||
|
return crypto.randomUUID();
|
||
|
};
|
||
|
|
||
|
module.exports = { addPrefixOnHttpSchema, generateUUID };
|