petiole-reducers

0.3.1 • Public • Published

petiole-reducers

Utility library for writing cleaner Petiole reducers.

Installation

npm install petiole-reducers --save

Usage

pluck

Returns the value from the action with the supplied property name.

(propName) => (action, state) => any

{
  initialState: {
    name: null,
  },
  actions: {
    setName: 'newName',
  },
  reducers: {
    setName: merge({
      name: pluck('newName'),
    })
  },
}

merge

(objectToMerge) => (action, state) => object

replace

(object) => (action, state) => object

push

(item) => (action, state) => array

remove

(predicate) => (action, state) => array

add

(number) => (action, state) => number

subtract

(number) => (action, state) => number

/petiole-reducers/

    Package Sidebar

    Install

    npm i petiole-reducers

    Weekly Downloads

    1

    Version

    0.3.1

    License

    MIT

    Last publish

    Collaborators

    • ilkkahanninen