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

more-to-store

v1.0.5

Published

`More to Store` is a lightweight and fast utility to interact with `localStorage`, providing optional encryption, automatic expiration, and seamless data management. Perfect for modern web applications that require secure, persistent, and optimized storag

Downloads

23

Readme

More to Store

More to Store is a lightweight and efficient utility library for managing localStorage with added features like optional encryption and expiration. It simplifies storing, retrieving, and managing data in localStorage while ensuring secure and optimized workflows for developers.


Features

  • Easy-to-use API: Simplifies interactions with localStorage.
  • Optional Encryption: Secure sensitive data using AES encryption.
  • Automatic Expiration: Automatically removes expired data without manual checks.
  • Robust Error Handling: Prevents application crashes due to localStorage issues.
  • Utility Functions: Includes helpers like hasItem and clear for seamless operations.

Installation

Install the library via npm:

npm install more-to-store

Usage

1. Import the Library

const MoreToStore = require('more-to-store');

2. Storing Data

Save an item to localStorage with optional encryption and expiry:

// Save data with encryption and expiry
MoreToStore.setItem('key', { name: 'John Doe' }, 'mySecretKey', 60000); // Expires in 60 seconds

// Save data without encryption or expiry
MoreToStore.setItem('simpleKey', 'Simple Value');

3. Retrieving Data

Retrieve an item from localStorage:

// Retrieve encrypted data
const value = MoreToStore.getItem('key', 'mySecretKey');
console.log(value); // { name: 'John Doe' }

// Retrieve non-encrypted data
const simpleValue = MoreToStore.getItem('simpleKey');
console.log(simpleValue); // 'Simple Value'

4. Automatic Expiration

Data stored with an expiry will be automatically removed once expired. For example:

MoreToStore.setItem('tempKey', 'Temporary Data', '', 5000); // Expires in 5 seconds
setTimeout(() => {
  console.log(MoreToStore.getItem('tempKey')); // null
}, 6000);

5. Removing Data

Manually remove an item from localStorage:

MoreToStore.removeItem('key');

Clear all items from localStorage:

MoreToStore.clear();

6. Checking Existence of Data

Check if a key exists in localStorage:

const exists = MoreToStore.hasItem('key');
console.log(exists); // true or false

API Reference

setItem(key, value, secretKey = '', expiry = 0)

  • key: The key to store the value under.
  • value: The data to store (can be any JavaScript object).
  • secretKey: (Optional) A key for AES encryption. Leave empty for no encryption.
  • expiry: (Optional) Expiry time in milliseconds. Set 0 for no expiry.

getItem(key, secretKey = '')

  • key: The key of the item to retrieve.
  • secretKey: (Optional) The key used to decrypt the data.
  • Returns: The retrieved value or null if the item doesn't exist or is expired.

removeItem(key)

  • key: The key of the item to remove from localStorage.

clear()

  • Removes all items from localStorage.

hasItem(key)

  • key: The key to check existence for.
  • Returns: true if the key exists, otherwise false.

Example Scenarios

  1. Securely Store User Data:

    MoreToStore.setItem('user', { id: 1, name: 'John' }, 'superSecretKey');
  2. Temporary Caching:

    MoreToStore.setItem('cache', { data: 'temp' }, '', 30000); // Expires in 30 seconds
  3. Simplify Reusable Storage Utilities:

    if (!MoreToStore.hasItem('visited')) {
      MoreToStore.setItem('visited', true);
    }

License

This project is licensed under the ISC License.


Author

Meezan Shaikh
Find me on GitHub!