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

local-storage-plus-plus

v1.1.4

Published

This is the documentation of how to use the `local-storage-plus-plus` package.

Downloads

28

Readme

local-storage-plus-plus package

This is the documentation of how to use the local-storage-plus-plus package.

please follow all of the instructions bellow if you havent already done them.

Installing Node.js

First you will have to install node.js at https://nodejs.org/en/ and click and select one of the two options. I would recommend installing the recommended for most users option but its really up to you.

NOTE: Any package version bellow 1.1.0 will not work properly!

Setting up the project

First, you have to go into your project folder and run npm init --y which will create the package.json file and after that you have to run npm i local-storage-plus-plus which will install the local-storage-plus-plus package.

NOTE: If you want to use the package with vanilla javascript/html, then you have to use a bundler such as webpack, babel, or you can use vite.

  • Webpack- https://webpack.js.org/
  • Babel- https://babeljs.io/
  • Vite- https://vitejs.dev/

Getting started

First you need the import the package such as shown in the example

import {StoragePlusPlus} from 'local-storage-plus-plus'

For you to be able to use the package, you will need to make a instance of the StoragePlusPlus class as shown in the example

const storage = new StoragePlusPlus();

Methods

This is the list of methods that are currently available

  • add(key, value)- adds data to local storage

  • remove(key)- removes a item from local storage

  • clear()- deletes all of the items from local storage

  • getAllKeys()- returns a list of all of the items keys

  • getAllValues()- returns a list of all of the items values

  • getKey(value)- returns the key of the item which value is specified in the parameter

  • getValue(key)- returns the value of the item which key is specified in the parameter

  • parse(value)- parses the given value from type string

  • stringify(value)- stringifies the given value

Examples

note: all of the returned values from all of the methods, except stringify are automaticly parsed

this is the instance of the StoragePlusPlus class

const storage = new StoragePlusPlus();

add()

storage.add("key1", "this is the value")

remove()

storage.remove("key1")

clear()

storage.clear()

getAllKeys()

storage.getAllKeys()

//outupt: ['key1', 'key2', 'key3']

getAllValues()

storage.getAllValues()

//output: ['value1', 'value2', 'value3']

getKey()

storage.getKey('value1')

//output: 'key1'

getValue()

storage.getValue("key1")

//output: 'value1'

parse()

storage.parse("1")

//output: 1

stringify()

storage.stringify(1)

//output: "1"