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 🙏

© 2024 – Pkg Stats / Ryan Hefner

parser-storages

v0.0.5

Published

Automatic data conversion storage.

Downloads

5

Readme

parser-storages · npm version

When you do a front-end development, you use localStorage, a browser repository, to store the client's data values.

One of the characteristics of localStorage is that it always needs to be stored in character form, and that it always returns in character form whenever it is imported.

Because of this, in the case of the Object type, the JSON.stringify method is used to convert the type and then save the value. In addition, if you save the value in the form of number and boolean, it returns to the form of the character type every time you import the value, causing inconvenience of having to check the type again, which eventually leads to the developer's mistake and increases the probability of error.

To solve these problems, we developed a library called parser-stories.

install

npm install parser-storages

Usage

import { parserLocalStorage, parserSessionStorage } from "parser-storages";

parserLocalStorage.set("test", [1, 2, 3, 4, 5]);
parserLocalStorage.get("test"); // [1,2,3,4,5]
parserLocalStorage.remove("test"); // Clear ID test from local storage
parserLocalStorage.removeAll(); // Clear all local storage

parserSessionStorage.set("test", [1, 2, 3, 4, 5]);
parserSessionStorage.get("test"); // [1,2,3,4,5]
parserSessionStorage.remove("test"); // Clear ID test from session storage
parserSessionStorage.removeAll(); // Clear all session storage
// Code when using an existing localStorage objec
localStorage.setItem("test", JSON.stringify([1, 2, 3, 4, 5]));
JSON.parser(localStorage.getItem("test")); // [1,2,3,4,5]

// Code when using the parser-storage library
parserLocalStorage.set("test", [1, 2, 3, 4, 5]);
parserLocalStorage.get("test"); // [1,2,3,4,5]

// Code when using an existing localStorage objec
localStorage.setItem("test2", 123);
Number(localStorage.getItem("test2")); // 123

// Code when using the parser-storage library
parserLocalStorage.set("test2", 123);
parserLocalStorage.get("test2"); // 123