Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz-pluszczewski committed Dec 14, 2017
1 parent f5e2874 commit 6bb466d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,26 @@ case MY_FANCY_ACTION
};
```

With prefect-immutable you can
With prefect-immutable you can:
```javascript
import { set } from 'perfect-immutable';

case MY_FANCY_ACTION
return set(state, 'fieldOne.fieldTwo.fieldThree', 'foo');
```

You can even set multiple fields at once:
```javascript
import { set } from 'perfect-immutable';

case MY_FANCY_ACTION
return set(state, {
'fieldOne.fieldTwo.foo': 'newValue',
'fieldOne.fieldTwo.bar': 'anotherValue',
'fieldOne.fieldTwo.baz': 'thirdValue',
});
```

## FAQ
#### Why this exists?
There are a lot of Immutable.js-like libraries, but they all force you to use immutable specific objects (like Map) and you cannot use their methods on normal JavaScript objects. That's not a problem when you're starting new project and decide to use e.g. Immutable.js but what if the app is already there, and you want immutable tools?
Expand Down

0 comments on commit 6bb466d

Please sign in to comment.