immutable-mapper

1.0.0 • Public • Published

Immutable Mapper

Mapping two immutable objects into one.

Usually used in a Redux app with Normalizr where there is an object from state and another object from action. They can be merged into one from a pre-defined set.

Usage

import immutableMapper from 'immutable-mapper';

const sets = [
  ['result'],
  ['entities', 'announcement'],
  ['entities', 'author']
];

const mappedObject = immutableMapper(sets, firstImmutableObject, secondImmutableObject);

Make sure that the two object has same data structure. Sets from above means the Immutable object has

{
  result,
  entities: {
    announcement,
    author
  }
}

as data structure.

Readme

Keywords

Package Sidebar

Install

npm i immutable-mapper

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kairxa