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

t-storage

v1.1.4

Published

Wrap html5 storage API: localStorage sessionStorage, and they use the same API

Readme

T-storage

README English doc | 中文 doc

What is T-storage?

T-storage is a storage plugin based on modern browsers that encapsulates LocalStorage and SessionStorage.

It borrows the idea of a database and stores the data you need to store according to the three levels of DB_NAME => TABLE_NAME => FIELD_NAME. The time option is added to the data () storage process to limit the length of data storage.

License NPM version

Features

  • Store data of the same type together to avoid naming conflicts and variable pollution.
  • There is a time limit on the data stored.
  • demo

Install

Introduced through script tags

https://cdn.jsdelivr.net/npm/t-storage/dist/tstorage.min.js
var storage = window.Tstorage;

Introduced through npm

npm install t-storage -S
import storage from 't-storage'

Usage

// localStorage
storage.data();


// sessionStorage
storage.session.data()
// Most used LocalStorage
let dog1 = storage.data('dog', {
  key: 'dog1',
  value: 'Tom'
})
console.log(dog1);
console.log(storage.data('dog'));
console.log('🐶');

let dog2 = storage.data('dog', {
  key: 'dog2',
  value: {
    name: 'Charlie',
    age: 'tow'
  }
})
console.log(dog2);
console.log(storage.data('dog'));
console.log('🐶');


// The usage of sessionStorage is exactly the same as localStorage
// But sessionStorage does not support the time option
let Fish = storage.session.data('Fish', {
  key: 'Fish1',
  value: 'Gldli'
})
console.log(Fish);
console.log(storage.session.data('Fish'));
console.log('🐠');


// Time-Limited Storage: Time in Seconds
// Don't milliseconds
let cat1 = storage.data('cat', {
  key: 'cat1',
  value: {
    name: 'Cleo',
    age: 'one'
  },
  time: 5 * 60 * 60, // 5 hours
  // time: '2020/3/7 8' // Future time YES
  // time: '2020/3/7 8:59' // Future time YES
  // time: '22020/3/7 08:23:23:14:58' // Malformed
  // ...
})
console.log(cat1);
console.log(storage.data('cat'));
console.log('🐱');
  • localStorage uses storage.data (), sessionStorages uses storage.session.data ()
  • time parameter you can pass the number of seconds, representing the length of time you want to store, for example you want to store 1 hour, time should pass 1 * 60 * 60
  • You can also pass a date format to the time parameter, which means that this storage will be deleted on a certain date in the future. For the date format, see demo
  • More usage demo

API List

|api|explain| |----|-----| |.data()|Set and get the specified value| |.has()|Determine if there is a specified value| |.clear()|Clear all values in storage space| |.getAll()|Get all values in space| |.forEach()|forEach each data in the storage space and call the callback function|

License

MIT

T-storage is MIT licensed.