swc/bundler/tests/.cache/deno/8dcdbd88740911debdaecb6b14e9bea1d344b3c5.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

24 lines
626 B
TypeScript

// Loaded from https://deno.land/x/abc@v1.2.4/util.ts
import { extname } from "./vendor/https/deno.land/std/path/mod.ts";
import { MIME } from "./constants.ts";
import { NotFoundException } from "./http_exception.ts";
/** Returns the content-type based on the extension of a path. */
export function contentType(filepath: string): string | undefined {
return MIME.DB[extname(filepath)];
}
export function hasTrailingSlash(str: string): boolean {
if (str.length > 1 && str[str.length - 1] === "/") {
return true;
}
return false;
}
export function NotFoundHandler(): never {
throw new NotFoundException();
}