1
0
silverbullet/plugos/util.ts

13 lines
277 B
TypeScript
Raw Normal View History

export function safeRun(fn: () => Promise<void>) {
fn().catch((e: any) => {
console.error("Caught error", e.message);
// throw e;
});
}
2023-01-01 19:28:25 +00:00
export function urlToPathname(url: URL) {
// For Windows, remove prefix /
return url.pathname.replace(/^\/(\w:)/, "$1");
2023-01-22 17:53:14 +00:00
}