summaryrefslogtreecommitdiff
path: root/std/node/os.ts
diff options
context:
space:
mode:
authorMVEMCJSUNPE <2frac.d.x@gmail.com>2020-12-15 04:13:22 -0600
committerGitHub <noreply@github.com>2020-12-15 05:13:22 -0500
commit7a9766dd18cc85053c984cb991dc3debac92530c (patch)
tree34f0033ae38bb546ce973541af5a49f78d564524 /std/node/os.ts
parenta5a151389e58f2715d8afe3fd4a8009979943ddc (diff)
feat(std/node): Added os.type (#8591)
Diffstat (limited to 'std/node/os.ts')
-rw-r--r--std/node/os.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/std/node/os.ts b/std/node/os.ts
index bec3de5ee..776eff92d 100644
--- a/std/node/os.ts
+++ b/std/node/os.ts
@@ -190,9 +190,18 @@ export function totalmem(): number {
return Deno.systemMemoryInfo().total;
}
-/** Not yet implemented */
+/** Returns operating system type (i.e. 'Windows_NT', 'Linux', 'Darwin') */
export function type(): string {
- notImplemented(SEE_GITHUB_ISSUE);
+ switch (Deno.build.os) {
+ case "windows":
+ return "Windows_NT";
+ case "linux":
+ return "Linux";
+ case "darwin":
+ return "Darwin";
+ default:
+ throw Error("unreachable");
+ }
}
/** Not yet implemented */