Package Exports
- path2
- path2/common
- path2/posix
- path2/posix/dirname
- path2/posix/normalize
- path2/posix/relative
- path2/posix/resolve
- path2/windows
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (path2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
path2
Modular and extended version of Node's path package
Works exactly same as Node's path
, with following improvements:
- Both windows and posix versions can be accessed in any environment program is run. For windows version require
path2/windows
for posixpath2/posix
. - Doesn't depend on existence of
process
object and can safely be used in any enviroment (e.g. browser) which does not provide it. Ifprocess.cwd
is not accessible, / or _C:_ (for windows) are used as current working directory - Each function is provided as an individual module, so only modules that are needed, can be required e.g.
path2/resolve
or specifically posix version:path2/posix/resolve
One additional function, not present in native path
, is provided:
path.common(path1[, ...pathn])
Resolves common path for given path arguments:
path.common('/lorem/ipsum/foo/bar', '/lorem/ipsum/raz/dwa',
'/lorem/elo/foo/bar'); // => '/lorem'
path.common
is proposed to be included in native path
Installation
NPM
In your project path:
$ npm install path2
Browser
You can easily bundle path2 for browser with modules-webmake
Tests 
$ npm test