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

nat-sort

v0.1.1

Published

A human sort, either as a module or CLI.

Downloads

7

Readme

nat-sort

A human sort, either as a module or CLI.

Build Status npm install

Usage Example Video

Example

As a library:

var nsort = require('nat-sort')

var unsorted = ['c', 'The A', 'b']

// use nsort directly with an array
nsort(unsorted) // ['The A', 'b', 'c']

// or use it as a comparator
unsorted.sort(nsort.compare) // ['The A', 'b', 'c']

With the command line:

$ npm install -g nat-sort

# These two commands are functionally equivalent:
$ cat newline-delimited-unsorted.txt | nsort > sorted.txt
$ nsort newline-delimited-unsorted.txt > sorted.txt

$ nsort --help  # output a help message

$ cat unsorted-films.txt
Blue Submarine No. 6 (1998)
Sphere (1998)
2010 (1984)
Capricorn One (1977)
The Amittyville Horror (1979)
Dr. Strangelove (1964)
Space Battleship Yamato (1977)
Death Race 2000 (1975)
Moon (2009)
Ju-on: The Grudge (2002)
The Andromeda Strain (1971)
House on Haunted Hill (1999)
Solaris (1972)
The Man Who Fell to Earth (1976)
The Omega Man (1971)
Das Millionenspiel (1970)
House on Haunted Hill (1959)
Logan's Run (1976)

$ nsort unsorted-films.txt
2010 (1984)
The Amittyville Horror (1979)
The Andromeda Strain (1971)
Blue Submarine No. 6 (1998)
Capricorn One (1977)
Das Millionenspiel (1970)
Death Race 2000 (1975)
Dr. Strangelove (1964)
House on Haunted Hill (1959)
House on Haunted Hill (1999)
Ju-on: The Grudge (2002)
Logan's Run (1976)
The Man Who Fell to Earth (1976)
Moon (2009)
The Omega Man (1971)
Solaris (1972)
Space Battleship Yamato (1977)
Sphere (1998)

Caveats

  • There are no options at the moment; there may be some in a future version
  • The sort function expects ASCII text only
  • This is certainly not performant, it was designed for a very specific purpose, and will probably choke on very large data sets.

License

MIT. See LICENSE for details.