Skip to content

Commit

Permalink
fix(core): directory extname and isDirectory calc error
Browse files Browse the repository at this point in the history
  • Loading branch information
NWYLZW committed Oct 7, 2023
1 parent 2b25bce commit d0588e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/virtual-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export const createVFile = <
return this.basename + this.extname
},
get extname() {
return path.slice(lastDotIndex === -1 ? undefined : lastDotIndex)
return lastDotIndex === -1 ? '' : path.slice(lastDotIndex)
},
get dirname() { return path.slice(0, path.lastIndexOf('/')) },
get isLink() {
return data?.[VFileLinkPath] != null
},
get isDirectory() {
return this.path.endsWith('/')
return contents === undefined
},
get isBuffer() {
return Buffer.isBuffer(this.contents) as IsBuffer
Expand Down

0 comments on commit d0588e4

Please sign in to comment.