From 5bb749c8775dd23065ff59985490092aa05d4d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich-Matthias=20Sch=C3=A4fer?= Date: Tue, 17 Dec 2024 16:20:00 +0100 Subject: [PATCH] fix: allow undefined in options --- src/index.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/index.ts b/src/index.ts index 45666552..26d9d761 100644 --- a/src/index.ts +++ b/src/index.ts @@ -361,16 +361,15 @@ export class FSWatcher extends EventEmitter { const DEF_AWF = { stabilityThreshold: 2000, pollInterval: 100 }; const opts: FSWInstanceOptions = { // Defaults - persistent: true, - ignoreInitial: false, - ignorePermissionErrors: false, - interval: 100, - binaryInterval: 300, - followSymlinks: true, - usePolling: false, - // useAsync: false, - atomic: true, // NOTE: overwritten later (depends on usePolling) - ..._opts, + persistent: _opts.persistent ?? true, + ignoreInitial: _opts.ignoreInitial ?? false, + ignorePermissionErrors: _opts.ignorePermissionErrors ?? false, + interval: _opts.interval ?? 100, + binaryInterval: _opts.binaryInterval ?? 300, + followSymlinks: _opts.followSymlinks ?? true, + usePolling: _opts.usePolling ?? false, + // useAsync: _opts.useAsync ?? false, + atomic: _opts.atomic ?? true, // NOTE: overwritten later (depends on usePolling) // Change format ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]), awaitWriteFinish: