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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lsc-storage

v0.0.5

Published

A simple storage library that helps you to manage your local storage, session storage and cookie storage.

Downloads

9

Readme

🚀 lsc-storage

A lightweight storage library that makes managing your web storage a breeze! 🌟
Currently supports local storage with plans for session storage and cookie storage in future releases.

npm version License: MITGitHub issuesGitHub stars


Table of Contents


Features

  • Unified API: Simple methods to interact with your storage.
  • TypeScript Support: Enjoy type safety and IntelliSense.
  • Fallback Mechanism: Automatically falls back to an in-memory storage if localStorage is unavailable.
  • Extensible: Easily add support for session storage and cookie storage in future updates.

Installation

Install via npm:

npm install lsc-storage

Usage

Importing the Library

import { lsc } from "lsc-storage";

Basic Examples for lsc-storage

Storing Data

// Store a simple string
lsc.set("username", "john_doe");

// Store an object
lsc.set("user", { name: "John Doe", age: 30 });

Retrieving Data

// Retrieve a string value
const username = lsc.get<string>("username");

// Retrieve an object
const user = lsc.get<{ name: string; age: number }>("user");

Removing Data

// Remove an item by key
lsc.remove("username");

Clearing All Data

// Clear all items from storage
lsc.clear();

Flushing Data

// Flush expired items (or force flush all with true)
lsc.flush();
lsc.flush(true);

API Reference

| Method/Function| Signature | Description | Parameters | Return Type | |-|-|-|-|-| | set | set<T>(key: string, value: T, localConfig?: Omit<StorageConfig, 'storage'>): void | boolean | Stores a value in storage under the specified key. | key: stringvalue: TlocalConfig (optional): Configuration object (excluding storage) | void if successful, false if error occurs | | get | get<T>(key: string, localConfig?: Omit<StorageConfig, 'storage'>): T | null | Retrieves the value associated with the specified key. | key: stringlocalConfig (optional): Configuration object (excluding storage) | Returns the stored value of type T or null | | remove | remove(key: string): void | Removes the item associated with the specified key from storage. | key: string | void | | clear | clear(): void | Clears all items from storage. | None | void | | flush | flush(force?: boolean): void | Clears expired items from storage. If force is true, clears all items regardless of expiration. | force (optional): boolean (defaults to false) | void | | localMemoryStore | localMemoryStore(): Storage | Creates an in-memory storage object that implements the Storage interface. Used as a fallback mechanism. | None | Storage | | StorageConfig | { storage?: Storage; ttl?: number | null } | Interface defining configuration options for storage operations. | storage (optional): Storage mechanism (e.g., localStorage)ttl (optional): Time-to-live in milliseconds | Interface (no return value) | | KeyValuePair | type KeyValuePair<T = unknown> = Record<string, T>; | Type representing an object with string keys and values of type T. | None | Type definition |

Development

To set up the development environment:

  1. Clone the repository:
     git clone https://github.com/devlopersabbir/lsc-storage.git
     cd lsc-storage
  2. Install dependencies:
    npm install
  3. Run the development server:
    npm run dev
  4. Run tests:
    npm test
  5. Build the project:
    npm run build

Contributing

Contributions are welcome! 🎉 Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -m 'Add YourFeature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Open a pull request.

For detailed contribution guidelines, refer to the CONTRIBUTING.md file.

License

This project is licensed under the MIT License

Author

Future Enhancements

  • 🔮 Session Storage: Coming soon!
  • 🍪 Cookie Storage: On the roadmap!