Created
July 5, 2016 14:39
-
-
Save gaboelnuevo/f14889e77317eab5d56fa10b01adac58 to your computer and use it in GitHub Desktop.
Normalizr takes JSON and a schema and replaces nested entities with their IDs, gathering all entities in dictionaries.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App/Services/Normalizer.js | |
import { Schema, arrayOf, normalize } from 'normalizr' | |
import { camelizeKeys } from 'humps' | |
const normalizer = (data, schema) => { | |
const camelizedJson = camelizeKeys(data) | |
return normalize(camelizedJson, schema) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment