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

@bonny-kato/localstorage

v0.0.2

Published

A highly efficient and user-friendly wrapper library for the browser's LocalStorage API. This robust tool abstracts away the intricacies of dealing with client-side storage, offering an intuitive way to manage data persistence in a user's browser.

Downloads

104

Readme

Overview

@bonny-kato/localstorage is a highly efficient and user-friendly wrapper library for the browser's LocalStorage API. This robust tool abstracts away the intricacies of dealing with client-side storage, offering an intuitive way to manage data persistence in a user's browser.

Fitted with methods for storing, retrieving, and removing data, this library brings an unparalleled level of convenience to interaction with local storage. Its design accommodates single and batch operations, allowing the setting and removal of multiple key-value pairs at once.

Beyond these, it also offers unique key management to circumvent potential key conflicts, lending itself useful during local development. To add to this, @bonny-kato/localstorage is Server-Side Rendering (SSR) compatible, catering for a variety of development scenarios.

For those diving into local storage operations for the first time or developers looking to streamline their data persistence process, @bonny-kato/localstorage is the library of choice.

Installation

npm i @bonny-kato/localstorage
yarn add @bonny-kato/localstorage

Usage

Methods

  • getValue(key: string | null = null, defaultValue?: any): any: Retrieves the value stored in the local storage for the given key. If no key is provided, it returns the entire store. If the key doesn't exist, it returns the provided defaultValue or null.

  • setValue(key: string, value: string | boolean | Array<any> | object): void: Sets the value for a given key in the local storage. If the key already exists, its value will be updated.

  • setValues(data: object): void: Sets multiple key-value pairs at once in the local storage.

  • removeValues(keys: string | Array<string>): void: Removes the specified key(s) and their corresponding values from the local storage.

  • has(key: string): boolean: Checks if a key is present in the local storage.

Examples

const lStorage = new LocalStorage("StorageKey");

// Getting a value
const value = lStorage.getValue("my-key", defaultValueIfExist);

// Setting a value
lStorage.setValue("my-key", {"key":"value"});

// Setting multiple values
lStorage.setValues({ "my-key1": "my-value", "my-key2": {key:"value"}});

// Removing values
lStorage.removeValues(["key1", "key2", "key3"]);

// Checking if a key exists
const hasName = lStorage.has("name");

Features

  • Unique Key Management: The LocalStorage library creates localstorage within its own object. This eliminates the potential for key conflicts with other scripts or sites that use the same keys, especially during local development.
  • Server Side Rendering (SSR) Compatible: Can be run on the server side without throwing any errors.
  • Bulk Removal: The removeValues method allows removing multiple key-value pairs from the local storage at once.
  • Bulk Addition: The setValues method enables setting multiple key-value pairs to the local storage simultaneously.
  • Key Checking: The has method allows users to check if a specific key exists in the local storage.
  • Usability: The interface and methods of the LocalStorage library are straightforward and intuitive, making it easy even for beginners.
  • Comprehensive Documentation: The library is thoroughly documented, providing clear instructions on how to use each method.
  • Default Value: The getValue method allows passing a default value in case a the key does not exist in storage