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

tiny-little-store

v1.2.6

Published

minimalistic store for your app

Readme

Tiny Little Store

Minimalistic state-management library.

Not really tested in battle;

Please feel free to make Pull Requests, I would be happy to see where it can go

Also check react-tiny-little-store

Getting Started

npm install tiny-little-store will get you started.

to init store just do this:

import createStore from "tiny-little-store";

const store = createStore(initialState);

Where store is an object containing these five methods:

const { subscribe, updateStore, getState, mutation, mutationsObj } = store;

You can guess how it works before you continue reading....

ready...

  • subscribe -- adds event listener which is called when store updates
  • updateStore -- makes shallow merge of the object you pass and the object you have, alternatively you can pass function that will recieve current state and needs to return a new one, after merge it calls all the listeners
  • getState -- guess what it does...
  • mutation -- a wrapper, accepts a pure function, like the one you would pass into updateStore, wraps it with updateStore. Returned function is able to accept payloads(the second argument of passed pure function)
  • mutationsObj -- alternatively you can pass an object, and it will return an object with wrapped methods
  // updateStore example
  updateStore(({count}) => ({count: count+1})); // this will change store and inform all the subscribtions

  // or you can use mutations
  const increment = mutation(({count}) => ({count: count+1}));

  increment();
  increment(); // works the same
  const setCount = mutation( (state, value) => ({count: value}));
  setCount(1);
  setCount(5);

  const mutatoins = mutationsObj({
    increment({ count }) {
      return { count: count + 1 };
    },
    decrement({ count }) {
      return { count: count - 1 };
    }
  })

  mutations.increment(); // but I am not sure anyone would prefer this

Also since v1.2 exports combineStores, you pass there your stores like:

  import createStore, { combineStores } from "tiny-little-store"
  const store1 = createStore(init1);
  const store2 = createStore(init2);

  const rootStore = combineStores({ store1, store2 });

rootStore has only subscribe and getState, which work the same as from non-combined. you cannot create mutations or updateStore directly on combined stores. You should encapsulate those things for each store, and then use those methods, and combinedStore will only notify.

NB

Any mutations you create are syncronous, you can create custom methods(like Vuex actions), which would call desired mutations in asynchronous way.

  const store = createStore({ isLoading: false, data: null });
  const { mutation } = store;
  const setLoading = mutation((store, value) => ({isLoading: value}));
  const setData = mutation((store, data) => ({ data }));
  const fetchData = async () => {
    setLoading(true);
    const data = await fetch(MY_URL)
    setData(data);
    setLoading(false);
  }

Or you can use updateStore inside your actions(or code you mutations smarter) to improve performance. Calling two mutations invokes two updates, and then potentially re-renders twice.

License

This project is licensed under the MIT License - see the LICENSE file for details