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

lsdb.js

v0.2.1

Published

LocalStorage database functionality in JavaScript with no dependencies.

Readme

Usage

Creating a database and table

// Instantiate the database.
var db = new LSDb( 'music' );

// Create a new table, setting default keys. Returns true on success.
db.create( 'publishers', ['name', 'location'] );
// return: true

// Create another table, setting default keys and value types.
db.create( 'albums', {'artist':'string', 'title':'string', 'year':'number', 'publishers':'array'} );
// return: true

Listing, describing, and dropping tables

// Get a list of all table names.
db.showTables();
// return: ["albums", "publishers"]

// Get a list of all keys in a table.
db.describe('albums');
// return: Object {artist: "string", title: "string", year: "number", publishers: "array"}

// Drop a table. Returns true on success.
db.drop('publishers');
// return: true

db.showTables();
// return: ["albums"]

Inserting into tables

// Insertions must follow the defined table data types.
db.insert( 'albums', ['s / s / s', 'beak & claw', 2013, ['anticon']] );
// return: true

// Inserting the wrong type will return false. If debug is enabled, the console will log an error.
db.insert( 'albums', ['s / s / s', 'beak & claw', '2013', 'anticon'] );
// return: false
/* console:
  LSDb: failed to insert, 'year' accepts number format only
  LSDb: failed to insert, 'publishers' accepts array format only
*/

// Inserting additional entries will incrementally build the table.
db.insert( 'albums', ['volcano choir', 'repave', 2013, ['jagjaguwar']] );
db.insert( 'albums', ['pedro the lion', 'winners never quit', 2000, ['jade tree']] );
db.insert( 'albums', ['pedro the lion', 'control', 2002, ['jade tree']] );

Querying the database

LSDb provides 2 methods for querying the database.

query( ) - Returns all rows and data from a specific table in an array.

// Select all data from a table.
db.query( 'albums' );
/* return:
  [
    {
      ID: 0,
      artist: 's / s / s',
      publishers: [
        'anticon'
      ],
      title: 'beak & claw',
      year: 2013
    },
    {
      ID: 1,
      artist: 'volcano choir',
      publishers: [
        'jagjaguwar'
      ],
      title: 'repave',
      year: 2013
    },
    {
      ID: 2,
      artist: 'pedro the lion',
      publishers: [
        'jade tree'
      ],
      title: 'winners never quit',
      year: 2000
    },
    {
      ID: 3,
      artist: 'pedro the lion',
      publishers: [
        'jade tree'
      ],
      title: 'control',
      year: 2002
    }
  ]
*/

select( ) - Starts a chainable complex query against a specific table. Use in conjunction with results( ) to return an array of results.

// Select all data from a table.
db.select( 'albums' ).results();
// returns same results as db.query( 'albums' );

db.select( 'albums', ['artist','title'] )
  .limit( 2 )
  .results();
/* return:
  [
    {
      ID: 0,
      artist: 's / s / s',
      title: 'beak & claw'
    },
    {
      ID: 1,
      artist: 'volcano choir',
      title: 'repave'
    }
  ]
*/

db.select( 'albums', ['artist','title','year'] )
  .where({ column: 'year', operator: '>', pattern: 2000 })
  .results();
/* return:
  [
    {
      ID: 0,
      artist: 's / s / s',
      title: 'beak & claw',
      year: 2013
    },
    {
      ID: 1,
      artist: 'volcano choir',
      title: 'repave',
      year: 2013
    },
    {
      ID: 3,
      artist: 'pedro the lion',
      title: 'control',
      year: 2002
    }
  ]
*/

db.select( 'albums', ['title','year'] )
  .where({ column: 'artist', operator: '===', pattern: 'pedro the lion' })
  .limit( 1 )
  .results();
/* return:
  [
    {
      ID: 2,
      title: 'winners never quit',
      year: 2000
    }
  ]
*/

Methods