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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rocketstation/redux-query

v2.1.0

Published

Redux Query provides helpers to search through [immutable maps](https://facebook.github.io/immutable-js/docs/#/Map), cache results, return pure JS objects

Downloads

2

Readme

Redux Query

Redux Query provides helpers to search through immutable maps, cache results, return pure JS objects

Installation

npm i @rocket-station/redux-query

Usage

import { init, get } from 'redux-query'

const store = fromJS({
  app: {
    foo: {
      '1': true,
      '2': false,
      '3': true,
    },
    bar: { tst: ['foo', 'bar'] },
  },
})

console.log(init([
  get('foo', [
    get('1'),
    get('3'),
  ]),
  get(['bar', true], [
    get(['tst', 'testStr'], (s) => s.join('-')),
    get(['tst', 'testArr'])
  ])
], 'app')(store)) // ​​​​​​​​​​{ '1': true,​​​​​ '3': true,​​​​​ bar: { testStr: 'foo-bar', testArr: [ 'foo', 'bar' ] } }​​​​​

Motivation

We created Redux Query to simplify our interactions with Redux state. It resolves several issues:

  • Provides schema-like syntax for getting values of any nesting levels
  • Allows to create custom getters inside a schema
  • Caches results based on provided requests
  • Clears invalid cache
  • Converts any income to immutable map
  • Converts any outcome to js objects

API

init(sequence, scope)(store, props) - initiates a new query and returns a function, which executes it

| Name | Type | Vals | Default | Description | | - | - | - | - | - | | sequence | Array<Function> | Function(get, store) | [] | An array of helpers, which will be executed in the sequential query | scope | Array<String> | [...String] | [] | If it is defined it determines the root node of the map. Otherwise, each query will process the whole store | store | Immutable Map | Immutable Map| Immutable.Map() | | | props | Object | Object | {} | An object, which will be passed to any custom helper |

get(key, val, initial)(store, props, result) - initiates a helper, which gets a value from a store by a key, and returns a function, which executes it

| Name | Type | Vals | Default | Description | | - | - | - | - | - | | key | null, String, Array | null, String, [String, String], [String, true] [null, null], [null, String], [null, true] [String, null], | undefined | If it is passed, it will be searched in a store. If an array of two strings is passed, the first string will be used as a key, which will be searched in a store, and the second string will be used as an alias, which will be returned in a result. If the second item is not defined and a founded value is an object, it will be merged into a result. Otherwise, it will be attached to result by a key or an alias | | val | Function, Array<Function> | [...(get, store)()] | undefined | If it is passed, will be used as a nested helper | | initial | Any | Any | Immutable.Map() | It will be returned, if found val is undefined |

store(sequence)(store, props, result) - initiates a helper, which memorizes a result and calculates it again only if something was changed

| Name | Type | Vals | Default | Description | | - | - | - | - | - | | sequence | Array<Function> | Function(get, store) | [] | An array of helpers, which will be executed in the sequential query

Inspiration

reselect

re-reselect

License

Redux Query Immutable Map is licensed under the MIT License

Created by RocketStation