summaryrefslogtreecommitdiff
path: root/src/utils/index.ts
blob: 5a083d54706c361fa147547c895e8f6e71a02bca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { trailingSlash } from "astro:config/client";

export function addForwardSlash(path: string): string {
  if (trailingSlash === "always") {
    return path.endsWith("/") ? path : path + "/";
  } else {
    return path;
  }
}

export const enum Level {
  OK,
  INFO,
  WARN,
  DEBUG,
  ERROR,
}

export type MaybePromise<T> = Promise<T> | T;