From 6bb466de3879a4b9e34007e42f3461a258af22df Mon Sep 17 00:00:00 2001 From: lukasz_brainhub Date: Thu, 14 Dec 2017 10:52:37 +0100 Subject: [PATCH] Updated readme --- README.MD | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.MD b/README.MD index caf5765..c6d4543 100644 --- a/README.MD +++ b/README.MD @@ -41,7 +41,7 @@ case MY_FANCY_ACTION }; ``` -With prefect-immutable you can +With prefect-immutable you can: ```javascript import { set } from 'perfect-immutable'; @@ -49,6 +49,18 @@ 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?