diff --git a/README.md b/README.md index 892013ba..1bde1494 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ const filesStream = globStream(['**/*.dat', 'logs/**/*.log']) // construct a Glob object if you wanna do it that way, which // allows for much faster walks if you have to look in the same // folder multiple times. -const g = new Glob('**/foo') +const g = new Glob('**/foo', {}) // glob objects are async iterators, can also do globIterate() or // g.iterate(), same deal for await (const file of g) { @@ -358,6 +358,8 @@ An object that can perform glob pattern traversals. ### `const g = new Glob(pattern: string | string[], options: GlobOptions)` +Options object is required. + See full options descriptions below. Note that a previous `Glob` object can be passed as the diff --git a/src/glob.ts b/src/glob.ts index 0a2d1991..931c3a32 100644 --- a/src/glob.ts +++ b/src/glob.ts @@ -379,6 +379,9 @@ export class Glob implements GlobOptions { * again. */ constructor(pattern: string | string[], opts: Opts) { + /* c8 ignore start */ + if (!opts) throw new TypeError('glob options required') + /* c8 ignore stop */ this.withFileTypes = !!opts.withFileTypes as FileTypes this.signal = opts.signal this.follow = !!opts.follow