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

get-set-action

v1.0.0

Published

A React State Management Library similar and alternative to mobx, redux.etc. it's the simplest, smallest and fastest state management library for react with dev tools support.

Readme

Action Management Library

This library provides a set of utilities for managing actions, async actions, and fetch operations, particularly useful for making AI calls. It is designed to simplify the handling of asynchronous operations and state management in JavaScript applications.

Features

  • Debounce and Throttle: Easily debounce or throttle your functions to control the rate of execution.
  • Async Actions: Manage asynchronous operations with built-in support for debouncing, throttling, and state management.
  • Fetch Utility: Simplified fetch operations with interceptors for request, response, and error handling.
  • State Management: Track and manage the state of your actions with ease.

Installation

To use this library, simply import the functions you need from the index.ts file.

Usage

Action

The action function allows you to create enhanced functions with interceptors and subscription capabilities.

API

  • intercept: Add an interceptor to modify the input before execution.
  • subscribe: Subscribe to the result of the action.
  • retry: Retry the last action with the same parameters.
  • getState: Get the current state of the action.

Example

import { action } from './index';

const myAction = action((props) => {
  console.log('Action executed with:', props);
  return props;
});

myAction.intercept((props) => {
  console.log('Intercepted:', props);
  return { ...props, intercepted: true };
});

myAction.subscribe((result) => {
  console.log('Result:', result);
});

myAction({ key: 'value' });

AsyncAction

The asyncAction function is used to manage asynchronous operations with support for debouncing and throttling.

API

  • run: Execute the async action.
  • abort: Abort the current async operation.
  • intercept: Add an interceptor to modify the input before execution.
  • interceptAfter: Add an interceptor to modify the result after execution.
  • interceptError: Add an interceptor to handle errors.

Example

import { asyncAction } from './index';

const myAsyncAction = asyncAction(async (payload) => {
  const response = await fetch(payload.url);
  return response.json();
}, { debounce: 500 });

myAsyncAction.run({ url: 'https://api.example.com/data' })
  .then(data => console.log('Data:', data))
  .catch(error => console.error('Error:', error));

Fetch

The Fetch function simplifies fetch operations with built-in interceptors for request, response, and error handling.

API

  • intercept: Add an interceptor to modify the request before execution.
  • interceptAfter: Add an interceptor to modify the response after execution.
  • interceptError: Add an interceptor to handle errors.

Example

import { Fetch } from './index';

const fetchAction = Fetch({ debounce: 1000 });

fetchAction.run({ url: 'https://api.example.com/data' })
  .then(response => console.log('Response:', response))
  .catch(error => console.error('Error:', error));

fetchAction.intercept((payload) => {
  console.log('Request Intercepted:', payload);
  return payload;
});

fetchAction.interceptAfter((data) => {
  console.log('Response Intercepted:', data);
  return data;
});

fetchAction.interceptError((error) => {
  console.error('Error Intercepted:', error);
  return error;
});

Conclusion

This library provides a comprehensive set of tools for managing actions and asynchronous operations in your applications. Whether you need to debounce a function, manage async actions, or perform fetch operations with custom interceptors, this library has you covered.