You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sort-scripts

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

sort-scripts

Sort a map of scripts in a logical order

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
5.4K
22.54%
Maintainers
1
Weekly downloads
 
Created
Source

sort-scripts

Sort scripts based on prefix and suffix

Usage

Given an map of script names to behavior (as is found in package.json files for Node projects), sort the scripts in a logical order, considering pre and post prefixes:

const sort = require('sort-scripts');
const scripts = {
  test: "jest",
  pretest: "check-engines",
  postmerge: "lint-staged",
  docs: "markdown-magic",
  postdocs: "echo \"'.md' files updated\""
};

sort(scripts);
// [
//   ["docs", "markdown-magic"], 
//   ["postdocs", "echo \"'.md' files updated\"],
//   ["postmerge", "lint-staged"],
//   ["pretest", "check-engines"],
//   ["test", "jest"]
// ]

Keywords

sort

FAQs

Package last updated on 28 Jun 2019

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