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

wweb

v1.2.0

Published

Web APIs -> environment-agnostic key value stores and more!

Downloads

68

Readme

wweb

wweb synchronizes Web APIs across the server and browser so you can stop writing environment conscious code and focus on building features. wweb exposes the same interfaces around Web APIs location.search -> wweb.search, localStorage -> wweb.localStorage, and document.cookie -> wweb.cookie so you can use them like they were key value stores. wweb assumes that your browser or your users' browsers have web APIs. Finally, wweb supports node all the way back to 6.4.0.

Installation

$ npm install wweb

Usage

const wweb = require('wweb')

wweb.redirect('https://myawesomewebsite.com')
// redirects to myawesomewebsite.com, same as window.location = '...'

console.log(window.location.search)
// => '?foo=bar'

const myQueryParam = wweb.search.get('foo')
// => 'bar'

const search = wweb.search.getAll()
// => { foo: 'bar' }

wweb.search.remove('foo')
console.log(window.location.search)
// => ''

wweb.search.set('foo', 'bar')
wweb.search.set('baz', 'qux')
console.log(window.location.search)
// => '?foo=bar&baz=qux'

wweb.search.update({ quux: 'quuz' })
console.log(window.location.search)
// => '?quux=quuz'

wweb.search.clear()
console.log(window.location.search)
// => ''

console.log(window.document.cookie)
// => 'foo=bar; baz=qux'

const myCookie = wweb.cookies.get('foo')
// => 'bar'

const cookies = wweb.cookies.getAll()
// => { foo: 'bar', baz: 'qux' }

wweb.cookies.remove('foo')
console.log(window.document.cookie)
// => 'baz=qux'

wweb.cookies.set('foo', 'bar')
console.log(window.document.cookie)
// => 'foo=bar; baz=qux'

wweb.cookies.update({ quux: 'quuz' })
console.log(window.document.cookie)
// => 'quux=quuz'

wweb.cookies.clear()
console.log(window.document.cookie)
// => ''

wweb.localStorage.update({ foo: 'bar' })
console.log({ ...window.localStorage })
// => { foo: 'bar' }

wweb.localStorage.get('foo')
// => 'bar'

wweb.localStorage.set('quux', 'quuz')
console.log({ ...window.localStorage })
// => { foo: 'bar', quux: 'quuz' }

wweb.localStorage.remove('quux')
console.log({ ...window.localStorage })
// => { foo: 'bar' }

wweb.localStorage.clear()
console.log({ ...window.localStorage })
// => {}

API

Example:

wweb.redirect('https://example.com')

Example:

const foo = wweb.search.get('foo')

Example:

const searchObj = wweb.search.getAll()

Example:

wweb.search.set('foo', 'bar')

Example:

wweb.search.update({ foo: 'bar' })

Example:

wweb.search.clear()

Example:

const foo = wweb.cookie.get('foo')

Example:

const cookieObj = wweb.cookie.getAll()

Example:

wweb.cookie.set('foo', 'bar')

Example:

wweb.cookie.update({ foo: 'bar' })

Example:

wweb.cookie.clear()

Example:

const foo = wweb.localStorage.get('foo')

Example:

const store = wweb.localStorage.getAll()

Example:

wweb.localStorage.set('foo', 'bar')

Example:

wweb.localStorage.update({ foo: 'bar' })

Example:

wweb.localStorage.clear()

Notes

Don't see your favorite web storage mechanism? Raise an issue

License

wweb © richytong