hyperdrive
hyperdrive copied to clipboard
add path normalization
As mentioned in https://github.com/juliangruber/hyperdrive-import-files/pull/23#issuecomment-253499239, it would make sense to me to fully treat entry.name as a path and thus also apply normalisation if necessary. Currently it's only treated as a String, and eg there could be two entries /entry and ./entry. This should help the modules depending on this to simplify their path logic.
great idea. do you know a module that helps with this?
this seems to work well:
const normalize = p => path.resolve('/', p)
Normalizes like this:
/->/.->/./foo->/foofoo/bar->/foo/barfoo/bar/->/foo/bar
Cool. In addition to that it should normalize windows paths to unix ones. \ --> /