diff options
Diffstat (limited to 'std/_util/os.ts')
-rw-r--r-- | std/_util/os.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/std/_util/os.ts b/std/_util/os.ts new file mode 100644 index 000000000..50c70b134 --- /dev/null +++ b/std/_util/os.ts @@ -0,0 +1,18 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +// This module is browser compatible. + +export const osType = (() => { + if (globalThis.Deno != null) { + return Deno.build.os; + } + + // deno-lint-ignore no-explicit-any + const navigator = (globalThis as any).navigator; + if (navigator?.appVersion?.includes?.("Win") ?? false) { + return "windows"; + } + + return "linux"; +})(); + +export const isWindows = osType === "windows"; |