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 ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

bystr-sort

v1.3.1

Published

Does sort your arrays of T object following a verbose sortString ๐Ÿ™‚ .

Readme

Build Status npm version

ByStr~Sort

Does sort your arrays of T object following a verbose sortString ๐Ÿ™‚ .


Getting started ๐Ÿš€

  1. install it
    $ npm install -D bystr-sort
    and require it
    const { sort } = require( "bystr-sort" );
  2. define a sort string: Assuming you have an array of T object like this:
    const greetings : T[] = [ 
        { order:14 , greet:"Hello" ,        level:"medium" ,   lang:"en" },
        { order:3 ,  greet:"yo" ,           level:"familiar" , lang:"fr" },
        { order:5 ,  greet:"selamat pagi" , level:"medium" ,   lang:"id" }
    ];
    A valid sort string could be
    const sortString = `
         by greet of a greater than b's then
         by level of a < than b's
    `;
  3. sort your T[] :
    const sorted : T[] = sort( greetings , sortString );

Sortstring

  • it is a string used to sort your array of T objects.
  • It gives you the ability to set multiple sorts by using the then keyword at the end of a sort sentence. a sort sentence is matches this regex pattern
    by {colA|colB|colC|...|colN} of a[|b] lower[|greater,<,>] than b[|a]'s [then]
  • The by keyword starts the sentence and a's or b's ends it. Then is used to chain the next sort sentence
  • To invert the sort direction, you can play with keywords lower, greater, >, < but also with a, b order in the sentence. So: by ... b ... > ... a's is also valid. Because why not ?

Note

  • further updates will allow the case insensitiveness of the whole sort sentence ...

Bonus ๐ŸŽˆ

there is a littel more ...

parameters

Assuming the signature for sort is like the following:

const sort = (
    objectArray: any[] ,
    sortString = "" ,
    crashOnError = false ,
    logfn = console.error
): any[]
  • crashOnError

    • When set to true : It gives you the abbility to throw an exception when your sort string is invalid. You will be prompted with hints to fix your problem.

    • When set to false : It will prompt the error in the console.

  • logfn Use this to check errors within your tests.