Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

path-sort

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-sort

Sort a list of file/directory paths

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

path-sort stable

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

[
  'a/world'
, 'a/lib/index.js'
, 'b/package.json'
, 'b/lib/3/index.js'
, 'b/lib/2/README.js'
, 'a/hello'
, 'b/lib/2/index.js'
, 'a/lib/README.md'
, 'b/lib/3/README.js'
, 'c'
]

Becomes something like this:

[
  'a/hello'
, 'a/world'
, 'a/lib/index.js'
, 'a/lib/README.md'
, 'b/package.json'
, 'b/lib/2/index.js'
, 'b/lib/2/README.js'
, 'b/lib/3/index.js'
, 'b/lib/3/README.js'
, 'c'
]

Installation

npm install path-sort

Usage

require('path-sort')(files[, sep])

Takes an array of filenames with an optional delimiter (sep), returning a sorted copy.

require('path-sort').standalone([sep])

Returns a Array.prototype.sort-friendly method. It's a little slower but easier to use in some cases.

var sorter = require('path-sort').standalone('/')

array = array.sort(sorter)

Keywords

FAQs

Package last updated on 09 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc