# path2

> Modular and extended version of `path` package

Latest version **0.1.0** (published 2014-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install path2
pnpm add path2
yarn add path2
bun add path2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-02-17 |
| First published | 2014-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Maintainers | medikoo |
| Keywords | path, node, commonpath |

## Links

- npm: https://www.npmjs.com/package/path2
- Repository: https://github.com/medikoo/path2
- Issues: https://github.com/medikoo/path2/issues
- npm.io page: https://npm.io/package/path2

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-02-17

## README

# path2
## Modular and extended version of [Node's path](http://nodejs.org/api/path.html) 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 posix `path2/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. If `process.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:
```javascript
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`](https://github.com/joyent/node/pull/6328)

### Installation
#### NPM

In your project path:

	$ npm install path2

##### Browser

You can easily bundle _path2_ for browser with [modules-webmake](https://github.com/medikoo/modules-webmake)

## Tests [![Build Status](https://travis-ci.org/medikoo/path2.png)](https://travis-ci.org/medikoo/path2)

	$ npm test

---
_Source: https://npm.io/package/path2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
