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

@abramstyle/redux-api

v0.2.4

Published

A redux middleware making api call, but with middlewares.

Readme

Redux API

A redux middleware making api call, but with middlewares.

usage

install

yarn add @abramstyle/redux-api

quick start

import {createStore, applyMiddleware } from 'redux';
import reduxApiGenerator from '@abramstyle/redux-api';

const reduxApi = reduxApiGenerator();
const middlewares = [reduxApi];
const store = createStore(reducers, applyMiddlewares(middlewares));

API

reduxApiGenerator(options = {})

it returns a reduxMiddleware

options.before

an function that will transform fetchOptions before request.

you can do some common things for every request.

options.middleware

define global middleware just like callAPI.middleware

options.isSuccess

define global success checker just like callAPI.isSuccess

options.success

define global success callback just like callAPI.success

options.failure

define global failure callback just like callAPI.failure

CALL_API Action

example

a api requesting action has [CALL_API] property. it specified request info.

import {CALL_API} from '@abramstyle/redux-api';
const action = {
  [CALL_API]: {
    url: 'https://api.domain.com',
    types: [
      'REQUEST_TYPE',
      'SUCCESS_TYPE',
      'FAILURE_TYPE'
    ],
  }
};

properties

callAPI.credentials

one of omit, same-origin, or include. must be a string.

callAPI.headers

must be an object. specified request headers.

callAPI.query

it will be append to url as query.

callAPI.data

data should be sent to server. if it is an get method, it will be append to url as query.

callAPI.method

request method, should be a valid method.

callAPI.isSuccess

check if a request is success.

the resultPayload will be passed into the function.

return true or false to identity if result is succeed.

NOTE: It will override global options.isSuccess

callAPI.success

this function will be called after request is success finished.

the result payload will be passed into the function.

NOTE: It will override global options.success

callAPI.failure

this function will be called after request is failure.

the result payload will be passed into the function.

NOTE: It will override global options.failure

Lifecycle

an api request has these status: initial, requesting, success, failure.

redux-api will dispatch these actions.

once a call api action is dispatched, an promise is returned.

request action:

{
  type: requestType,
  payload: callAPI.data || {},
  meta: callAPI.meta || {}
}

success action

{
  type: successType,
  payload: parsedResponseData,
  meta: callAPI.meta || {},
}

failure action

{
  type: failureType,
  payload: errorInstance,
  meta: callAPI.meta,
  error: true,
}

NOTE: payload is an error instance. http status code will be found as error.status. the error message responded from server will be found as error.data. the full response will be find as error.response.

TODO

  • add tests for new features