Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const parser = entrypointWithSlash => {
const options = {};
if (program.username && program.password) {
const encoded = Buffer.from(
`${program.username}:${program.password}`
).toString("base64");
options.headers = new Headers();
options.headers.set("Authorization", `Basic ${encoded}`);
}
switch (program.format) {
case "swagger":
return parseSwaggerDocumentation(entrypointWithSlash);
case "openapi3":
return parseOpenApi3Documentation(entrypointWithSlash);
default:
return parseHydraDocumentation(entrypointWithSlash, options);
}
};