-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
47 lines (42 loc) · 1.46 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { validateHeaderName, validateHeaderValue } from "http";
export const validateHeaders = (headers) => {
const headerEntries = Object.entries(headers);
for (const i of headerEntries) {
try {
validateHeaderName(i[0]);
validateHeaderValue(i[0], i[1]);
} catch (error) {
console.log(error);
}
}
};
export const getGroupEndpoints = (jsonData) => {
const endpoints = [];
jsonData.map((e) => {
let name = e["name"].startsWith("/") ? e["name"] : `/${e["name"]}`;
if (name.endsWith("/")) {
name = name.substring(0, name.length - 1);
}
e["endpoints"].forEach((obj) => {
let endpoint = obj["endpoint"];
if (!endpoint.startsWith("/")) {
endpoint = `/${endpoint}`;
}
obj["endpoint"] = name + endpoint;
endpoints.push(obj);
});
});
return endpoints;
};
export const printBanner = () => {
console.log(
"\x1b[34m## ## ####### ###### ## ## ######## ######## "
);
console.log("### ### ## ## ## ## ## ## ## ## ## ");
console.log("#### #### ## ## ## ## ## ## ## ## ");
console.log("## ### ## ## ## ## ##### ###### ######## ");
console.log("## ## ## ## ## ## ## ## ## ## ");
console.log("## ## ## ## ## ## ## ## ## ## ## ");
console.log("## ## ####### ###### ## ## ######## ## ## ");
console.log("\n\x1b[31m By Tejasvp25\x1b[0m\n");
};