-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Improve Path.parse / Path.format combo #1999
Copy link
Copy link
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.pathIssues and PRs related to the path subsystem.Issues and PRs related to the path subsystem.staletest-action
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.pathIssues and PRs related to the path subsystem.Issues and PRs related to the path subsystem.staletest-action
We have
Path.format/Path.parsefunctions.They can be chained which is very convenient.
Currently
parseconverts string to an object with such structureThis object contains denormalized data between
base,nameandextkey values.Now let's try to replace file extension.
The simplest task is going to be not so simple?!
Now if
formattook into considerationextandnamerather thanbasethis could lead to an equal problem with changes tobasekey being ignored.Can we get rid of this
basekey? It's alwaysparsed.name + parsed.extformula, not a big deal to make it manually. Example of hidden file parse:{ base: '.gitignore', ext: '', name: '.gitignore' }- same rule apply.We can probably also implement it in a backward-compatibile way,
keeping
basebut using JS getter / setter for it's evaluation.