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

indexed-db-lite

v1.3.0

Published

A simple wrapper around the not-so-simple indexedDB.

Readme

indexed-db-lite

A simple implementation of indexed-DB.

Installation

Use the node package manager to install indexed-db-lite.

npm i indexed-db-lite

Usage

import IDB from 'indexed-db-lite';

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Implementing functions

Currently, I have added all the functions responsible for CRUD operations. In future updates, I'll add more functions like key-pair lookup in a nested JSON etc. Some functions mentioned here return promise due to asynchronous nature of IndexedDB. Hence, they should be called from async function with the await keyword or can be resolved using .then()

import IDB from 'indexed-db-lite';

ReadObject = async (StoreName, primKey) => {
    const result = await IDB.ReadObjectStoreById( StoreName, primKey );
    console.log(result);
 }

OR

import IDB from 'indexed-db-lite';

 IDB.ReadObjectStoreById( StoreName, primKey ).then(function(result){
   console.log(result);
});

Functions

InitDB = function(dbName, version)

This is the first function that should be called where we initialise the indexedDB. In the InitDB, database name and inital version should be passed as parameters.

  • @param {} dbName => database name
  • @param {} version => version should be an integer value.

CreateObjectStore = function(dbName, ObjectStoreName, isAutoIncrement = true)

This is function should be called whenever we want to create a new ObjectStore in indexedDB.

  • @param {} dbName => Database name
  • @param {} ObjectStoreName => Name of the store in our Database
  • @param {} isAutoIncrement = true => if true then primary key for each row/entry will be an auto-increment value else a custom key for each entry should be passed while insertion.

InsertObjectStore = function(ObjectStoreName, dataObject, primaryKey = '', valueKey = 'data') 

This is function inserts data to the ObjectStore in indexedDB.

  • @param {} ObjectStoreName => name of the store in our Database
  • @param {} dataObject => data to be inserted in the store
  • @param {} primaryKey => primary key for dataObject. Keep empty for auto-increment stores.
  • @param {} valueKey => 'key' for the dataObject to be inserted. If none passed, then default value will be used.

ReadObjectStoreById = function(ObjectStoreName, primaryKey)

This is function reads the data based on the primary key from an ObjectStore in indexedDB.

  • @param {} ObjectStoreName => Name of the store in our Database
  • @param {} primaryKey => primary key of the record to be fetched

ReadCompleteObjectStore = function(ObjectStoreName) 

This is function reads the complete data from an ObjectStore in indexedDB.

  • @param {} ObjectStoreName => Name of the store in our Database

KeyExists = function(ObjectStoreName, primaryKey) 

This is function checks if a primary key exists in an ObjectStore in indexedDB.

  • @param {} ObjectStoreName => Name of the store in our Database
  • @param {} primaryKey => primary key for the a particular record
  • This function checks if a primary Key exists in the indexedDB or not


UpdateObjectStore = function(ObjectStoreName, primaryKey, appendObj, appendKey = '')

This is function appends the data in an existing data entry in ObjectStore.

  • @param {} ObjectStoreName => Name of the store in our Database
  • @param {} primaryKey => primary key for the a particular record
  • @param {} appendObj => Object to appended in the existing JSON
  • @param {} appendKey = ' ' => Keep appendKey null if appendObj JSON already has a parent key, otherwise provide a key.


DeleteRow = function(ObjectStoreName, primaryKey)

This is function deletes a row/entry in an ObjectStore in indexedDB.

  • @param {} ObjectStoreName => Name of the store in our Database
  • @param {} primaryKey => primary key for the a particular record


DeleteObjectStore = function(dbName, ObjectStoreName)

This is function deletes an ObjectStore in indexedDB.

  • @param {} dbName => Database Name
  • @param {} ObjectStoreName => Name of the store in our Database

DeleteDB = function(dbName)

This is function deletes the entire indexedDB database.

  • @param {} dbName => Database Name

Feel free to reach out to me :) [email protected]