All files / internal / _os.ts

90.91% Branches 10/11
100.00% Functions 1/1
100.00% Lines 8/8
1
2
3
4
5
6
7
8
9
10
11
12
13
 
 
x219
 
x214
 
 
x214
x214
x214
x214
x214
x214










I
// Copyright 2018-2026 the Deno authors. MIT license.

export function checkWindows(): boolean {
  // deno-lint-ignore no-explicit-any
  const global = globalThis as any;

  // Check Node/Bun/Deno via `process.platform`, then the Deno global, then the browser
  const platform = global.process?.platform;
  if (typeof platform === "string") return platform.startsWith("win");
  const os = global.Deno?.build?.os;
  if (typeof os === "string") return os === "windows";
  return global.navigator?.platform?.startsWith("Win") ?? false;
}