Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

immutable-redux

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-redux

Provides utilities for dealing with Immutable.js data structures in Redux.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-57.14%
Maintainers
1
Weekly downloads
 
Created
Source

Immutable Redux Version Build Status Dependency Status Coverage Status

Provides utilities for dealing with Immutable data structures in Redux.

Installation

To install the stable version along with Immutable and Redux, run the following:

$ npm install --save immutable-redux immutable redux

This assumes that you're using the npm package manager with a module bundler like Webpack or Browserify.

If you don't yet use npm or a modern module bundler, and would rather prefer a single-file UMD build that makes ImmutableRedux available as a global object, you can build it yourself by running the following:

$ npm run build

You'll find the development (immutable-redux.js) and production (immutable-redux.min.js) versions of the library in the dist folder. I don't recommend this approach for any serious application.

Usage

import {List} from 'immutable'
import {createStore} from 'redux'
import {combineImmutableReducers} from 'immutable-redux'

const reducer = combineImmutableReducers({
  counter: (state = 0, action) =>
    action.type === 'INCREMENT' ? state + 1 : state,
  stack: (state = List(), action) =>
    action.type === 'PUSH' ? state.push(action.payload) : state
})

let store = createStore(reducer)

store.subscribe(() =>
  console.log(store.getState())
)

store.dispatch({type: 'INCREMENT'})
// => Map { "counter": 1, "stack": List [] }
store.dispatch({type: 'PUSH', payload: 'a'})
// => Map { "counter": 1, "stack": List [ "a" ] }

Meta

Contributors

License

Copyright (c) 2015 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.

FAQs

Package last updated on 12 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc