From ab7777a321d030e6fb5e097d7b22e16cf0a79207 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 24 Aug 2015 15:35:31 +0300 Subject: [PATCH] Update README.md --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8589e8a9..4e1ed4a2 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,14 @@ Kudos to Jing Chen for suggesting this approach. ### Sample App +#### Flux + See **[flux-react-router-example](https://github.com/gaearon/flux-react-router-example)**. +#### Redux + +See **[redux/examples/real-world](https://github.com/rackt/redux/tree/master/examples/real-world)**. + ### The Problem * You have a JSON API that returns deeply nested objects; @@ -255,11 +261,13 @@ article.define({ }); ``` -####`normalize(obj, schema)` +####`normalize(obj, schema, [options])` Normalizes object according to schema. Passed `schema` should be a nested object reflecting the structure of API response. +You may optionally specify a custom `assignEntity` function in `options`. This is useful if your backend emits additional fields, such as separate ID fields, you'd like to delete in the normalized entity. See [the test](https://github.com/babsonmatt/normalizr/blob/de08c29bc03120bf9fc2964041f46ad3950d01af/test/index.js#L80-L126) and the [discussion](https://github.com/gaearon/normalizr/issues/10) for a usage example. + ```javascript const article = new Schema('articles');