Skip to content

Commit

Permalink
change nullish coalescing
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspoehls committed Mar 16, 2024
1 parent e85276e commit 329cd7a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ export default Object.assign({}, Fs, {
* @returns {Array}
*/
async allFiles (path: string, options?: ReadFileOptions): Promise<string[]> {
const { ignore } = options ?? {}
const { ignore } = options == null ? { ignore: [] } : options

return await ReadRecursive(path, ([] as any[]).concat(ignore ?? []))
return await ReadRecursive(path, ([] as any[]).concat(ignore || []))
},

/**
Expand Down Expand Up @@ -320,7 +320,8 @@ export default Object.assign({}, Fs, {
* @returns {String}
*/
async tempFile (name?: string): Promise<string> {
const file = Path.resolve(await this.tempDir(), name ?? randomString())
const filename = name == null ? randomString() : name
const file = Path.resolve(await this.tempDir(), filename)

return await tap(file, async () => {
await Fs.ensureFile(file)
Expand Down

0 comments on commit 329cd7a

Please sign in to comment.