# path-sort2

> Sort a list of file/directory paths

Latest version **1.0.0** (published 2018-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install path-sort2
pnpm add path-sort2
yarn add path-sort2
bun add path-sort2
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-05-30 |
| First published | 2018-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Hugh Kennedy |
| Maintainers | thejameskyle |
| Keywords | sort, path, file, directory, tree |

## Links

- npm: https://www.npmjs.com/package/path-sort2
- Repository: https://github.com/jamiebuilds/path-sort2
- Homepage: https://github.com/jamiebuilds/path-sort2#readme
- Issues: https://github.com/jamiebuilds/path-sort2/issues
- npm.io page: https://npm.io/package/path-sort2

## 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

- 1.0.0 (latest) — 2018-05-30

## README

# path-sort2

Sort a list of file/directory paths, such that something like this:

## Example

```js
const pathSort = require('path-sort2');

let files = [
  'a/c',
  'a/a/a',
  'b/b',
  'b/a/2/a',
  'b/a/1/b',
  'a/b',
  'b/a/1/a',
  'a/a/b',
  'b/a/2/b',
  'c',
];

let sortedFiles = pathSort(files);
// [
//   'a/b',
//   'a/c',
//   'a/a/a',
//   'a/a/b',
//   'b/b',
//   'b/a/1/a',
//   'b/a/1/b',
//   'b/a/2/a',
//   'b/a/2/b',
//   'c',
// ]
```

## Install

```sh
npm install path-sort2
```

## Usage

```js
const pathSort = require('path-sort2');

pathSort(files); // sorted files
pathSort(files, '/'); // custom seperator (defaults to `path.sep`)

files.sort(pathSort.standalone()); // sorted files
files.sort(pathSort.standalone('/')); // custom seperator (defaults to `path.sep`)
```

> **Note:** Using `pathSort.standalone()` is a little bit slower, but is
> sometimes more convenient.

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