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

loud-map

v1.0.6

Published

JS Map enhanced for state management

Downloads

17

Readme

LoudMap

LoudMap extends the JS Map class to support state management. LoudMap supports computed properties, and it has an EventEmitter for notifying the user of state changes.

Deno import

  • latest - import { EventEmitter } from "https://gitlab.com/rhythnic/loud-map/-/raw/master/src/mod.ts"
  • versioned - import { EventEmitter } from "https://gitlab.com/rhythnic/loud-map/-/raw/VERSION/src/mod.ts"

NPM install

npm install loud-map

Usage

import { LoudMap } from 'loud-map'

const state = new LoudMap()

state.compute('menuClosed', ['menuOpen'], menuOpen => !menuOpen)

state.compute('user', ['userId'], async (userId) => {
  if (!userId) return null
  return fetch(`/users/${userId}`).then(res => res.json())
})

state.events.on('change/menuOpen', (value, oldValue) => {
  // ...
})

state.events.on('change', (changes) => {
  // changes is an object with all changed key/value pairs
})

state.batch({
  userId: '',
  menuOpen: false
})

// state.get('menuOpen') === false
state.set('menuOpen', true)

API

batch(values)

Set many values at once. An change/KEY is emitted for each key in values. One change event is emitted at the end, with the values object as the payload. You can delete a key via batch by passing undefined or void 0 as the value.

compute(key, dependencyKeys, computeHandler)

  • key String - key at which to cache computed value in the map
  • dependencyKeys Array - map keys on which this computed value depends
  • computeHandler Function - function to compute a value

The computeHandler will receive all of the values of it's dependencyKeys as arguments. A computeHandler can return a Promise. In this case, the promise is cached. Computed properties are lazy. The computeFunction doesn't run until it is accessed with get. The result is cached in the map, so future access won't trigger recomputation. If the value of a dependencyKey changes, the computed value is deleted from cache and computed again next time it is accessed.

from(map)

Convert a regular Map into a LoudMap

Events

  • If the user calls the set method, two events are emitted, change/KEY and change.
  • If the user calls the batch method, one change/KEY event is emitted for each key, and one change event is emitted at the end.
  • Calling delete will emit the same events as set

Contributing

Please use issues for all bug reports and feature requests.

LICENSE

MIT license, Copyright Nicholas Baroni 2020