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

@vyron/storage

v0.1.6

Published

javaScript storage utils

Downloads

2

Readme

@vyron/storage

Powerful Browser Storage

Install

With npm

# npm
npm install @vyron/storage

# yarn
yarn add @vyron/storage

# pnpm
pnpm install @vyron/storage

Storage Config

interface StorageCryptoConfig {
	// storage encrypt Implementation
	encrypt: (v: string) => string
	// storage decrypt Implementation
	decrypt: <T>(v: string) => T
}

interface StorageConfig {
	// enable storage crypto
	enableCrypto?: boolean
	// crypto config
	crypto?: StorageCryptoConfig
	// storage key prefix
	prefix?: string
}

Api

| property | 解释 | | ---------------------- | ----------------- | | get(key) | 获取 storage | | set(key,value,expire?) | 设置 storage | | remove | 移除 storage | | clear | 清空 storage | | key | 获取指定 key | | keys | 获取所有 key | | values | 获取所有值 | | length | 获取 storage 长度 | | isEmpty | storage 是否为空 |

get

return storage data

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.get("text") // null

storage.set("test", "text") // true

storage.get("test") // text

set

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

// storage will expired after 10 seconds
storage.set("test", "text", 10) // true

storage.get("test") // text

setTimeout(() => {
	// storage was expired & will be remove
	storage.get("test") // null
}, 11 * 1000)

remove

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.set("test", "text") // true

storage.set("test2", "text2") // true

storage.set("test3", "text3") // true

storage.remove("test")

storage.remove(["test2", "test3"])

console.log(storage.isEmpty) // true

clear

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.set("test", "text") // true

storage.set("test2", "text2") // true

storage.set("test3", "text3") // true

// storage will remove all but test3
storage.clear("test3")

console.log(storage.length) // 1

storage.get("test3") // text3

key

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.set("test", "text") // true

storage.set("test2", "text2") // true

storage.set("test3", "text3") // true

storage.key(0) // test

storage.key(1) // test2

storage.key(2) // test3

storage.key(100) // null

keys

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.set("test", "text") // true

storage.set("test2", "text2") // true

storage.set("test3", "text3") // true

storage.keys() // ['test','test2','test3']

values

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.set("test", "text") // true

storage.set("test2", "text2") // true

storage.set("test3", "text3") // true

storage.values() // ['text','text2','text3']

length

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.set("test", "text") // true

storage.set("test2", "text2") // true

storage.length // 2

isEmpty

import { LocalStorage } from "@vyron/storage"

const storage = new LocalStorage()

storage.isEmpty // true

storage.set("test", "text") // true

storage.isEmpty // false

License

MIT