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 🙏

© 2025 – Pkg Stats / Ryan Hefner

stateguy

v0.0.2

Published

A minimalistic JS state management library

Downloads

9

Readme

StateGuy

npm version

portrait of the state guy

StateGuy lives inside your website and manages its global state.

by Camden Mecklem, 2021

released under MIT license

available through npm and jsDelivr.

What is StateGuy?

StateGuy is a simple frameworkless state management system inspired by React-Redux.

How do I use it?

Just download stateguy.js and put it in your project folder. You can import it the usual way from any JS file:

import stateguy from "stateguy.js";

Once you've done that, You can tie DOM elements to state object properties by assigning a class name with the "sg-" prefix. For example:

<span class="sg-city-population"></span>

This span element will display the value from state.city.population. StateGuy will automatically update the element each time the state updates.

Keep in mind that, in the current implementation, the "sg-" class must be the first one listed or else StateGuy won't see it. You can add other classes after it if needed.

You can also access values from the state in JavaScript by calling the fetch function. Arguments are turned into an object path.

For example:

const population = stateguy.fetch('kentucky', 'population') => state.kentucky.population

How can I contribute?

The best way you can contribute is by looking through the code and filing issues. I'm still very much a junior-level programmer and it's likely that I haven't used the best implementations of certain things.

Other than that, I would prefer to tackle the design and code myself at this stage. I've learned a lot from making this already and some of the thornier problems left to address (see below) will be a good experience for me in the future.

FAQ

How did you come up with the name?

"State Manager" => "stateman" => make it friendlier => "stateguy"

Will you support feature X in the future?

Probably not. I made this mainly as a learning exercise, though of course if people actually start using it then I'd be willing to put some development time into it. I will not be interested in adding too many features, as StateGuy is aimed at people who are interested in minimalistic websites with fewer lines of code. If you want a state system with all the bells and whistles, you'd likely be better off with React and Redux.

One thing I plan to add in the future is proper management of values that derive from other values, e.g. in a situation such as state.totalPeople = state.users + state.nonUsers. The two operands should be updated first, and the dependent value should be calculated only after those have finished. This would require some kind of dependency tree for each state property, possibly stored in a private metadata object attached to the state object.