npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsort

v1.0.3

Published

Simple array sorting utility supporting multiple data types

Downloads

392

Readme

jsort Build Status

Simple array sorting utility supporting multiple data types.

Install

npm install --save jsort

Usage

jsort.<dataType>(array [, key])

Available data types include: text, numeric, currency and date. Default sorting order is ASC.

jsort.text(['Argentina', 'Australia', 'New Zealand', 'Ireland', 'Canada']);
jsort.numeric([2.01, 1.3555, 3, 1990]);
jsort.currency(['$1,726', '$3,021,726.00', '$120.75']);
jsort.date(['2015-01-31', '01/30/2015', 'Sat, Jan 3, 2015', 'January 31, 2014']);

When a key gets passed in, jsort assumes the collection contains objects and will try to sort them by the key provided:

jsort.numeric([{name: 'Homer', age: 40}, {name: 'Marge', age: 35}], 'age');

jsort.<dataType>(array [, key]).reverse()

Reverse sort any array (DESC) by using the .reverse() method:

jsort.text(['I', 'am', 'Yoda']).reverse(); // returns ['Yoda', 'I', 'am']

Run Test Suite

npm test

Release Versions

  1. git fetch
  2. git checkout develop && git reset --hard origin/develop
  3. npm version [<newversion> | major | minor | patch]
  4. git checkout master && git reset --hard origin/master
  5. git merge develop
  6. git push --tags && git push && git checkout develop && git push

Publish the package to npm's public registry:

npm publish

To make sure everything worked just fine, go to http://npmjs.com/package/jsort.

Heads up! To publish, you must have a user on the npm registry. If you don't have one, create it with npm adduser. If you created one on the site, use npm login to store the credentials on the client. You can use npm config ls to ensure that the credentials are stored on your client. Check that it has been added to the registry by going to http://npmjs.com/~.

Semantic Versioning

Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards-compatible manner, and
  3. PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

See the Semantic Versioning specification for more information.