MCPcopy Create free account
hub / github.com/chhoumann/quickadd / hasWindowFunction

Function hasWindowFunction

src/utils/base64.ts:4–8  ·  view source on GitHub ↗
(name: "btoa" | "atob")

Source from the content-addressed store, hash-verified

2const textDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder() : undefined;
3
4function hasWindowFunction(name: "btoa" | "atob"): boolean {
5 if (typeof window === "undefined") return false;
6 const fn = (window as unknown as Record<string, unknown>)[name];
7 return typeof fn === "function";
8}
9
10function getGlobalBuffer(): undefined | { from(input: string, encoding: string): { toString(encoding: string): string } } {
11 // `Buffer` is a Node global (present in Obsidian's Electron renderer and in

Callers 2

encodeToBase64Function · 0.85
decodeFromBase64Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected