Debian Codegraph @

path2/README.md

raw
1 # path2
2 ## Modular and extended version of [Node's path](http://nodejs.org/api/path.html) package
3
4 Works exactly same as Node's `path`, with following improvements:
5
6 - Both _windows_ and _posix_ versions can be accessed in any environment program is run. For windows version require `path2/windows` for posix `path2/posix`.
7 - Doesn't depend on existence of `process` object and can safely be used in any enviroment (e.g. browser) which does not provide it. If `process.cwd` is not accessible, _/_ or _C:\_ (for windows) are used as current working directory
8 - 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`
9
10 One additional function, not present in native `path`, is provided:
11
12 ### path.common(path1[, ...pathn])
13
14 Resolves common path for given path arguments:
15 ```javascript
16 path.common('/lorem/ipsum/foo/bar', '/lorem/ipsum/raz/dwa',
17 '/lorem/elo/foo/bar'); // => '/lorem'
18 ```
19
20 `path.common` is proposed to be [included in native `path`](https://github.com/joyent/node/pull/6328)
21
22 ### Installation
23 #### NPM
24
25 In your project path:
26
27 $ npm install path2
28
29 ##### Browser
30
31 You can easily bundle _path2_ for browser with [modules-webmake](https://github.com/medikoo/modules-webmake)
32
33 ## Tests [![Build Status](https://travis-ci.org/medikoo/path2.png)](https://travis-ci.org/medikoo/path2)
34
35 $ npm test