back

by antipurist·2y ago·view on hn ↗
Something like

    if ('Bun' in globalThis) ...
    if ('Deno' in globalThis) ...
    if ('window' in globalThis) ...
could be used to determine the runtime.
1 comments
That certainly works for Bun and Deno, not sure about what is effective in Node, though.
Checking for process.versions.{node,bun} works, not sure if Deno has an equivalent.