summaryrefslogtreecommitdiff
path: root/std/path
diff options
context:
space:
mode:
Diffstat (limited to 'std/path')
-rw-r--r--std/path/glob.ts5
-rw-r--r--std/path/utils.ts2
-rw-r--r--std/path/win32.ts3
3 files changed, 7 insertions, 3 deletions
diff --git a/std/path/glob.ts b/std/path/glob.ts
index daee22f98..a079f448f 100644
--- a/std/path/glob.ts
+++ b/std/path/glob.ts
@@ -1,6 +1,8 @@
import { SEP, SEP_PATTERN } from "./constants.ts";
import { globrex } from "./globrex.ts";
import { join, normalize } from "./mod.ts";
+import { assert } from "../testing/asserts.ts";
+
const { DenoError, ErrorKind } = Deno;
export interface GlobOptions {
@@ -46,7 +48,8 @@ export function globToRegExp(
strict: false,
filepath: true
});
- return result.path!.regex;
+ assert(result.path != null);
+ return result.path.regex;
}
/** Test whether the given string is a glob */
diff --git a/std/path/utils.ts b/std/path/utils.ts
index 7a4cd7299..9911f5347 100644
--- a/std/path/utils.ts
+++ b/std/path/utils.ts
@@ -49,7 +49,7 @@ export function normalizeString(
let code: number;
for (let i = 0, len = path.length; i <= len; ++i) {
if (i < len) code = path.charCodeAt(i);
- else if (isPathSeparator(code!)) break;
+ else if (isPathSeparator(code)) break;
else code = CHAR_FORWARD_SLASH;
if (isPathSeparator(code)) {
diff --git a/std/path/win32.ts b/std/path/win32.ts
index 79e04ea6e..11518ee7c 100644
--- a/std/path/win32.ts
+++ b/std/path/win32.ts
@@ -17,6 +17,7 @@ import {
normalizeString,
_format
} from "./utils.ts";
+import { assert } from "../testing/asserts.ts";
export const sep = "\\";
export const delimiter = ";";
@@ -329,7 +330,7 @@ export function join(...paths: string[]): string {
// path.join('//server', 'share') -> '\\\\server\\share\\')
let needsReplace = true;
let slashCount = 0;
- firstPart = firstPart!;
+ assert(firstPart != null);
if (isPathSeparator(firstPart.charCodeAt(0))) {
++slashCount;
const firstLen = firstPart.length;