immutable-dot

0.0.4 • Public • Published

Immutable Dot

Simple helper for using dot notation with Immutable.js.

Turning

state.getIn(['path', 'to', 'value'])

into

state.getIn(dot('path.to.value')

Inspired by this issue comment.

Installation

  npm install immutable-dot

Usage

  // Import dependencies
  import Immutable from 'immutable'
  import dot from 'immutable-dot'

  // Make immutable map from js object
  const map = Immutable.fromJS({
    path: {
      to: {
        value: 41
      }
    }
  })

  // Fix value with awesome new notation
  map.setIn(dot('path.to.value'), 42)

Should very much work with require as well.

Test

No tests. Living on the edge.

Wait ... You can't be serious?

There's a module for that! No, not really. But it works!

Readme

Keywords

Package Sidebar

Install

npm i immutable-dot

Weekly Downloads

4

Version

0.0.4

License

none

Last publish

Collaborators

  • henrikhaugboelle