diff options
Diffstat (limited to 'lib/fs.js')
-rw-r--r-- | lib/fs.js | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -877,7 +877,7 @@ function rmdir(path, options, callback) { callback = makeCallback(callback); path = pathModule.toNamespacedPath(getValidatedPath(path)); - if (options && options.recursive) { + if (options?.recursive) { validateRmOptions( path, { ...options, force: true }, @@ -901,7 +901,7 @@ function rmdir(path, options, callback) { function rmdirSync(path, options) { path = getValidatedPath(path); - if (options && options.recursive) { + if (options?.recursive) { options = validateRmOptionsSync(path, { ...options, force: true }, true); lazyLoadRimraf(); return rimrafSync(pathModule.toNamespacedPath(path), options); @@ -1087,7 +1087,7 @@ function stat(path, options = { bigint: false }, callback) { function hasNoEntryError(ctx) { if (ctx.errno) { const uvErr = uvErrmapGet(ctx.errno); - return uvErr && uvErr[0] === 'ENOENT'; + return uvErr?.[0] === 'ENOENT'; } if (ctx.error) { @@ -1711,7 +1711,7 @@ function realpathSync(p, options) { p = pathModule.resolve(p); const cache = options[realpathCacheKey]; - const maybeCachedResult = cache && cache.get(p); + const maybeCachedResult = cache?.get(p); if (maybeCachedResult) { return maybeCachedResult; } @@ -1760,7 +1760,7 @@ function realpathSync(p, options) { } // Continue if not a symlink, break if a pipe/socket - if (knownHard[base] || (cache && cache.get(base) === base)) { + if (knownHard[base] || cache?.get(base) === base) { if (isFileType(statValues, S_IFIFO) || isFileType(statValues, S_IFSOCK)) { break; @@ -1769,7 +1769,7 @@ function realpathSync(p, options) { } let resolvedLink; - const maybeCachedResolved = cache && cache.get(base); + const maybeCachedResolved = cache?.get(base); if (maybeCachedResolved) { resolvedLink = maybeCachedResolved; } else { @@ -1783,7 +1783,7 @@ function realpathSync(p, options) { if (!isFileType(stats, S_IFLNK)) { knownHard[base] = true; - if (cache) cache.set(base, base); + cache?.set(base, base); continue; } @@ -1828,7 +1828,7 @@ function realpathSync(p, options) { } } - if (cache) cache.set(original, p); + cache?.set(original, p); return encodeRealpathResult(p, options); } |