New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mutox

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mutox

Functional state management library

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

mutox

Functional state management library inspired by and compatible with redux.

It is a drop-in replacement for redux, aimed at reducing boilerplate. Similar philosophy applies, except for the motion of reducers and actions, which are replaced by mutations. Created in mind with small applications, that want to use state management similar to redux that seamlessly works with react, but without all of the ceremonials that come with redux "boilerplate".

Travis Version

Installation

To install latest version of mutox:

$ npm install --save mutox

Usage

import { createStore, mutate, get } from 'mutex'

let store = createStore({
  counter: 0
})

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

const increment = x => x + 1
const decrement = x => x - 1

const counter = mutate('counter')

store.dispatch(counter(increment))
// { counter: 1 }
store.dispatch(counter(increment))
// { counter: 2 }
store.dispatch(counter(decrement))
// { counter: 1 }

Support for asynchrony is built-in - your mutations and all methods support async/await, so you can do stuff like:

const MY_URL = 'https://random.org/integers/?num=1&min=1&max=100&col=1&base=10&format=plain&rnd=new'
const getJson = url => fetch(url).then(response => response.json())

store.dispatch(
  counter(
    get('data')(
      getJson(MY_URL) // this returns a Promise<Number>
    ),
    increment
  )
)

License

MIT

Keywords

FAQs

Package last updated on 22 Nov 2017

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