From a59f5eadd86e85bf662b37ec40ceb6f80cb207c4 Mon Sep 17 00:00:00 2001 From: Behnam Mohammadi Date: Sat, 14 Nov 2020 02:51:11 +0330 Subject: refactor(std): add std/_util/os.ts module (#8370) This commit adds "std/_util/os.ts" module which contains common os detection logic and is browser compatible. Co-authored-by: Nayeem Rahman --- std/node/_url.ts | 3 +-- std/node/module.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'std/node') diff --git a/std/node/_url.ts b/std/node/_url.ts index 82daa25e9..f85286df2 100644 --- a/std/node/_url.ts +++ b/std/node/_url.ts @@ -26,8 +26,7 @@ import { CHAR_LOWERCASE_Z, } from "../path/_constants.ts"; import * as path from "./path.ts"; - -const isWindows = Deno.build.os === "windows"; +import { isWindows } from "../_util/os.ts"; const forwardSlashRegEx = /\//g; const percentRegEx = /%/g; diff --git a/std/node/module.ts b/std/node/module.ts index c8c02bad3..597da09db 100644 --- a/std/node/module.ts +++ b/std/node/module.ts @@ -34,13 +34,12 @@ import * as nodeUtil from "./util.ts"; import * as path from "../path/mod.ts"; import { assert } from "../_util/assert.ts"; import { fileURLToPath, pathToFileURL } from "./url.ts"; +import { isWindows } from "../_util/os.ts"; const CHAR_FORWARD_SLASH = "/".charCodeAt(0); const CHAR_BACKWARD_SLASH = "\\".charCodeAt(0); const CHAR_COLON = ":".charCodeAt(0); -const isWindows = Deno.build.os == "windows"; - const relativeResolveCache = Object.create(null); let requireDepth = 0; -- cgit v1.2.3