You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One way we can add support of absolute paths is to automatically strip out root (as defined by path.parse()) before transforming the path, then add it back to the front of the result path.
Issues:
No way to remove the root
on Windows it won't be possible to change the root from C:\ to D:\ etc.
Solution 2
Add a {root} keyword, that inserts the root. This way you can either do {root}{0..-1}, or D:/{0..-1} to change the root.
Issues:
users will have to think about it "do I always add {root}? do I do it only when I expect an absolute path? do I expect an absolute in a particular case?"
visual noise / mental load when looking at a pattern
Solution 3
The first solution + an option removeRoot.
Issues:
will make API more complex
will work only when you use API directly. If a path-rebuild pattern is a part of some kind of a config there will be no way to pass the option (except by making the config schema more complex as well)
The text was updated successfully, but these errors were encountered:
Solution 1
One way we can add support of absolute paths is to automatically strip out
root
(as defined bypath.parse()
) before transforming the path, then add it back to the front of the result path.Issues:
C:\
toD:\
etc.Solution 2
Add a
{root}
keyword, that inserts the root. This way you can either do{root}{0..-1}
, orD:/{0..-1}
to change the root.Issues:
Solution 3
The first solution + an option
removeRoot
.Issues:
path-rebuild
pattern is a part of some kind of a config there will be no way to pass the option (except by making the config schema more complex as well)The text was updated successfully, but these errors were encountered: