Maybe I'm doing it hard (and I should just look for the prefix ./ and ../ ), but I don't want to reinvent the wheel and write a function to correctly determine relative paths (for all platforms, etc.)
existing library?
Are there npm packages that do this? Of course, this problem has been resolved ...
Approaches?
The ban on the existing library was to use the functions of the path module to join possible relative path to a known prefix, and then see what the result was, provided that path.join('some_base', possiblyRelative) allows a kind of distinguishing characteristic in safe the platform.
Any other suggestions? Approaches?
source share