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

aspic

v0.0.7

Published

An arbitrary key-value store for node and the browser.

Downloads

48

Readme

Aspic

Aspic is a (dumb) key-value store. The module wraps a standard javascript object with some convenience functions that implement the following features:

  • storage/retrieval on any key that is serializable by JSON.stringify, except null and undefined
  • retrieval of just keys
  • retrieval of just values
  • querying the table for lists of key-value pairs
  • deletion by query

Thats it! Like I said, its pretty dumb.

USAGE

var table = require('aspic')();

table({x:10}); //undefined

// arbitrary objects can be keys:

table({x:10,y:20}, "Perhaps a Point?"); 

// so can arrays: 
table([1,2,3], "An array");

table([3,2,1], "Another Array");

// we can look at the keys:

table.keys() // [ {x: 10, y: 20},
             //   [ 1, 2, 3 ],
			 //   [ 3, 2, 1 ] ]
			 
table([3,2,1]) // 'Another Array'

table('[3,2,1]') // undefined

table([3,2,1], 'Updating This value');

table([3,2,1])  //  'Updating This value'

table(function (k,v) {return k.constructor === Array;});

// [ { key : [1, 2, 3],
//     val : 'An array' },
//   { key : [3, 2, 1],
//     val : 'Updating This value' }]

table.size()  // 3

// adding the 'delete' argument will remove and return the matching items

table(function (k,v) {return k.constructor === Array;}, 'delete');

table.size() // 1

API

aspic()

Assuming you did var aspic = require('aspic'), a call to the aspic() funciton returns a table object.

Table Objects

First and foremost, a table is a function that accepts one or two parameters.

table( /* key or query */ arg1, /* value or option */ arg2)

Here are the different ways to call the table object:

  • table(key) : If key is any object that is serializable by JSON.stringify, then a lookup will be performed on the table. Either a value is found and returned, or none is found and undefined is returned.
  • table(key,val) : If key is as above, and val is anything whatsoever other than null or undefined, then the key value pair is entered into the table.
  • table(query) : where query = function (key, value) {...} is a predicate function, then an array of all key-value entries for which query returns true will be returned.
  • table(query, 'delete') : as above, but this time the matching entries will be delete and returned.
  • table(query, 'first') : sometimes you don't want to search the whole table. Using the 'first' option returns as soon as a satisfactory entry is found, or returns false otherwise.
  • table(fn, 'iterate') : where fn = function (key, val) {...} is an arbitrary function. This will be called on each key value pair stored in the table.

Table methods

A table object also has a number of methods:

  • table.size() : returns the size of the table
  • table.drop(key) : deletes at most one entry with the given key. If deleted, the entry will be returned as a {key : key, val: val} pair, otherwise false is returned.
  • table.set(key,val) : an alias for table(key,val).
  • table.get(key) : an alias for table(key).
  • table.keys() : returns an array of all keys in the table.
  • table.values() : returns an array of all values in the table.
  • table.toArray() : returns an array of two element arrays, one per table entry.
  • table.fromArray(a) : accepts an array a of pairs, and feeds them into the table, overwriting anything that is already there.

Enjoy?