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

cella.js

v0.2.1

Published

Easily and securely manage data storage within the browser with a simple API.

Downloads

23

Readme

Cella.JS

Build Status Made with Typescript Documentation Status License: ISC Up to date dependencies Undergoing development Contributors wanted PRs Welcome Tests unspecified Logo Needed Thanks

Cella.JS is a JavaScript package that helps you manage data storage within the browser. It basically serves as a basic wrapper around the browser's default local storage APIs in order to provide extra functionality. Cella.JS eliminates the need to write extra code when working with the browser's local storage. It provides features such as:

  • In-built support for encryption.
  • Store abstract data types without needing to convert to a string first.
  • Ability to add custom storage engine.
  • Ability to add custom (data-transformational) functions to be executed before or after data is stored or retrieved.
  • #Working on in-built support for indexedDB.

Table of Contents

Table of contents generated with markdown-toc

Installation

NPM

$ npm install cella.js

Yarn

$ yarn add cella.js

Browser

https://unpkg.com/[email protected]/dist/index.js

Developing locally

To clone and build this project locally, run the following commands:

$ git clone https://github.com/IggsGrey/cella.js.git
$ npm i
$ npm run dev

Usage

Importing the Library

ES6 Modules

import Cella from 'cella.js';

NodeJS Modules / Commonjs

const Cella = require('cella.js');

Browser

Import the library with a script tag and the Cella API shall be made available.

Cella

How to Use

Usage is unbelievably simple.

Examples

Basic Usage

import Cella from 'cella.js';

// create an instance of Cella!
const cella = new Cella();


// store an item
cella.store({
	key: 'sample-key',
	value: ['item1', 'item2', 'item3', 'item4']
}).then(() => {
    console.log('void');
});
// Promise<void>


// retrieve an item
const retrievedItem = cella.get({
	key: 'sample-key'
}).then((res) => {
    console.log('got',res);
});
// Promise<Array ['item1', 'item2', 'item3', 'item4']>


// delete an item
cella.eject({
	key: 'sample-key',
}).then(() => {
    console.log('void');
});
// Promise<void>

Applying Transforms And Encryption

import Cella from 'cella.js'

const mySetData = new Set(['pineapples', 'are', 'great']);

console.log(mySetData);

const cella = new Cella({
	encrypt: {
		secret: 'my-secret-key' // yup that's it!
	},
	transforms: [
		{
			inbound: function(yourSetData) {
				// convert set to array
				return [...yourSetData];
			},
			outbound: function(yourConvertedSetData) {
				// convert array back to set
				return new Set(yourConvertedSetData);
			}
		},
		// ...unlimitedTransforms
	]
});


cella.store({
	key: 'my-key',
	value: mySetData
});

cella.get({ key: 'my-key' }).then(res => console.log(res));

Specifying A Custom Storage Engine

import Cella from 'cella.js';

// create an instance of Cella!
const cella = new Cella({
    storage: {
        store: (key, value) => {
            // code to implement custom storing
        },
        get: (key) => {
            // code to implement custom retrieval
        },
        eject: (key) => {
            // code to implement custom deletion
        }
    }
});

API

Cella Class Properties (CellaInstance)

Properties you can pass to the new Cella class

| Property name | Description | Data type | Required | Default value | | ------ | ------ | ------ | ------ | ------ | | storage | Specify the StorageEngine to use and additional options. NOTE: If you specify a custom database storage engine object, it must implement the StorageEngine interface. | SpecifiedStorageEngineORStorageEngine | no | { type: 'localStorage' } | encrypt | An object that specifies encryption details including the encryption secret | Record<'secret', string> Eg: { secret: 'some-string' } | no | - | | transforms | Array of objects defining function inbound and outbound functions. Useful for modifying data before storing and retrieving. | TransformObject[] | no | - |

Interfaces

StorageEngine

All instances of the in-built storage engines implement this interface, and all custom storage engines must implement this interface as well.

| Property name | Description | Data type | Parameters | | ------ | ------ | ------ | ------ | | store | The function that inserts data into the local database. | Function | StorageItem: {key: string (required)value: string (required)} | | get | The function that retrieves data from the local database. | Function | RetrievedStorageItem: {key: string (required)} | | eject | The function that deletes data from the local database. | Function | DeletedStorageItem: {key: string (required)} |

StorageItem

The object parameter properties for each time you call cella.store()

| Property name | Description | Data type | Required | Default value | | ------ | ------ | ------ | ------ | ------ | | key | The key/label that identifies the item in the localstorage. | string | true | - | | value | The value of the item to be stored. | any | true | - | | encrypt | Encryption properties for the data to be stored. | { secret: string } | false | null |

RetrievedStorageItem

The object parameter properties for each time you call cella.get()

| Property name | Description | Data type | Required | Default value | | ------ | ------ | ------ | ------ | ------ | | key | The key/label that identifies the item in the localstorage. | string | true | - | | decrypt | Decryption properties for the data to be stored. | { secret: string } | false | null |

DeletedStorageItem

The object parameter properties for each time you call cella.eject()

| Property name | Description | Data type | Required | Default value | | ------ | ------ | ------ | ------ | ------ | | key | The key/label that identifies the item in the localstorage. | string | true | - |

SpecifiedStorageEngine

These properties are valid for the storage object value in the CellaInstance.

| Property name | Description | Data type | Required | Default value | | ------ | ------ | ------ | ------ | ------ | | type | The preferred type of in-built storage. | 'localStorage' | 'indexedDB' | true | 'localStorage' | | name | The preferred name of the indexedDB storage. | string | required only when type == 'indexedDB' | - |

NOTE: IN-BUILT SUPPORT FOR INDEXEDDB IS NOT YET IMPLEMENTED

TransformObject

These properties are valid for an object value in the transforms array specified in a CellaInstance.

| Property name | Description | Data type | Required | Default value | | ------ | ------ | ------ | ------ | ------ | | inbound | Function that is executed ech time data is being stored. This function is executed before any other changes are made to the data. | (args0: T) => any | yes | - | | outbound | Function that is executed ech time data is being retrieved. This function is executed after all other changes have been made to the data. | (args0: T) => any | yes | - |

Contributing

Want to contribute? Great! I am currently seeking contributors for remaining features including adding in-built support for more DB engines. You can get started by reading the current issues or opening one yourself. Don't forget to read the ethics and conduct code for contributors in the CONTRIBUTING.md You may also contact @IggsGrey on:

  • jaygrey.jg@gmail.com
  • discord - scarrexx#5134
  • reddit - @scar_reX
  • twitter - @devx_gh

License

This project uses the ISC license and it can be found here: LICENSE

Upcoming Features!

  • In-built support for indexedDB.
  • Integration with web workers.
  • Data compression.
  • Smart fallbacks for browser support issues. Eg: fallback to localStorage in browsers that do not support indexedDB (optional ofcourse).

Todo

  • Write tests.
  • Implement features above (obviously Tom!).
  • Build docs site with demos
  • Work on browser support docs
  • Codesandbox examples

Browser Support

| IE / EdgeIE / Edge | FirefoxFirefox | ChromeChrome | SafariSafari | iOS SafariiOS Safari | SamsungSamsung | OperaOpera | | --------- | --------- | --------- | --------- | --------- | --------- | --------- | | 12| 3.5 | 4 | 4 | 3.2 | 1.0 | 10.5

Developers for Firefox