1
0
silverbullet/plugos/util.ts
2023-01-22 18:53:14 +01:00

13 lines
277 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");
}