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

localjson

v1.2.7

Published

The operation of encapsulating localStorage, it is Stronger and better

Readme

github address: https://github.com/fuel-efficient/localJson

Updated: getLJson() and clearLJson()

You can directly input key to get or delete the set of objects with key

English readme

Install

npm install localjson

If in ES5, without the addition of babel. Delete the export at the beginning of the index.js file and then import it as a script.

Each namespace exists in an array

Each obj exists in an array of objects

Import

Pay attention to the initial capitalization of the class name..

import Localjson from 'localjson'

1. First, set up the localName to store. (localName parameter required)

For example, namespace ----'myjson'is initialized at the time of initialization

This is required. Initialization without namespaces will be wrong

Note that if the namespaces are instantiated at the same time, the last namespace instantiated object will be returned

var myjson = new Localjson('myjson') 

2. Adding obj to myjson. (obj parameters required, optional storageObj parameter)

If there is no storageObj, the obj at this point will be written to the myjson namespace automatically

If you have storageObj, then obj is added to the storageObj first and then written into the myjson namespace

  myjson.setLJson(obj, storageObj)

3. Gets the record of the corresponding localName in localStorage. (index parameter optional)

The content of the cache is first obtained, and localStorage is called if it is not available

  myjson.getLJson() //returns all the contents of the current namespace
  myjson.getLJson(number) //returns the object at the corresponding number subscript position
  myjson.getLJson('key','key',,,,)  //returns the set of objects with the corresponding key input

4. Update the content in the myjson namespace. (obj parameters required, optional index parameter)

obj is a collection of objects (arrays) or object

If there is no index, obj replaces the entire namespace

If there is index, then obj replaces the object corresponding to the index subscript in the namespace

  myjson.upLJson(obj, index)

5. Clear the contents in the myjso

Index parameter optional

If there is a index parameter, the object of the corresponding index position in the namespace is cleared

If you don't have index, empty the entire namespace

  myjson.clearLJson()
  myjson.clearLJson(index)
  myjson.clearLJson('key','key',,,,) //Clears the input set of objects with the corresponding key key and returns the collection of objects without the key 

Chinese readme

安装

npm install localjson

如果在es5,不添加babel的情况。把index.js文件中开头的export删除,然后以脚本的方式导入即可。

每一个命名空间都是以数组的方式存在的

每一个obj都以对象的方式存在数组中

导入

注意类名首字母大写。。

import Localjson from 'localjson'

1. 首先设置要存储的localName。(localName参数必选)

例如初始化时设置命名空间----'myjson'

这个是必需的,初始化没有命名空间会报错

注意如果实例化时的命名空间相同,则会返回上一次的创建的命名空间实例化的对象

var myjson = new Localjson('myjson') 

2. 将obj加入myjson中。(obj参数必选,storageObj参数可选)

如果没有storageObj,此时的obj将会被自动写入myjson命名空间中

如果有storageObj,则obj会被先加入到storageObj中再写入到myjson命名空间中的

  myjson.setLJson(obj, storageObj)

3. 获取localStorage中对应localName的记录。(index参数可选)

会首先获取缓存中的内容,获取不到才会调用localStorage

  myjson.getLJson() //返回当前命名空间所有内容
  myjson.getLJson(number) //返回相应number下标位置的对象
  myjson.getLJson('key','key',,,,)  //返回输入的具有相应key键的对象集合

4. 更新myjson命名空间中的内容。(obj参数必选,index参数可选)

obj可以是对象或对象集合(数组)

如果没有index,则obj会将整个命名空间替换

如果有index,则obj替换命名空间中对应index下标的对象

  myjson.upLJson(obj, index)

5. 清除myjson命名空间中的内容

index参数可选

如果有index参数,则清除命名空间中相应index位置的对象

如果没有index,则清空整个命名空间

  myjson.clearLJson()
  myjson.clearLJson(index)
  myjson.clearLJson('key','key',,,,) //清除输入的具有相应key键的对象集合,并返回不含油key键的对象集合