1
0
silverbullet/plugos/util.ts
2023-01-01 11:28:25 -08:00

12 lines
276 B
TypeScript

export function safeRun(fn: () => Promise<void>) {
fn().catch((e: any) => {
console.error("Caught error", e.message);
// throw e;
});
}
export function urlToPathname(url: URL) {
// For Windows, remove prefix /
return url.pathname.replace(/^\/(\w:)/, "$1");
}