diff options
author | Yusuke Sakurai <kerokerokerop@gmail.com> | 2020-02-07 16:23:38 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 02:23:38 -0500 |
commit | c2986891f6aac87cec98232735945af756e6643f (patch) | |
tree | 716dc739f438bf740fa960b87fc022d569090802 /std/fs/expand_glob.ts | |
parent | ea6179f7dce89416f1586ee18c2f437e68eabd38 (diff) |
remove non-null assertion operator from std (part1) (#3900)
Diffstat (limited to 'std/fs/expand_glob.ts')
-rw-r--r-- | std/fs/expand_glob.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/std/fs/expand_glob.ts b/std/fs/expand_glob.ts index 7e575a123..656852ebb 100644 --- a/std/fs/expand_glob.ts +++ b/std/fs/expand_glob.ts @@ -9,6 +9,7 @@ import { normalize } from "../path/mod.ts"; import { WalkInfo, walk, walkSync } from "./walk.ts"; +import { assert } from "../testing/mod.ts"; const { ErrorKind, cwd, stat, statSync } = Deno; type ErrorKind = Deno.ErrorKind; type DenoError = Deno.DenoError<ErrorKind>; @@ -80,7 +81,9 @@ export async function* expandGlob( let fixedRoot = winRoot != undefined ? winRoot : "/"; while (segments.length > 0 && !isGlob(segments[0])) { - fixedRoot = joinGlobs([fixedRoot, segments.shift()!], globOptions); + const seg = segments.shift(); + assert(seg != null); + fixedRoot = joinGlobs([fixedRoot, seg], globOptions); } let fixedRootInfo: WalkInfo; @@ -182,7 +185,9 @@ export function* expandGlobSync( let fixedRoot = winRoot != undefined ? winRoot : "/"; while (segments.length > 0 && !isGlob(segments[0])) { - fixedRoot = joinGlobs([fixedRoot, segments.shift()!], globOptions); + const seg = segments.shift(); + assert(seg != null); + fixedRoot = joinGlobs([fixedRoot, seg], globOptions); } let fixedRootInfo: WalkInfo; |