Last active
May 4, 2020 09:00
-
-
Save codeBelt/ddd3432af63847274348fcf62482ebaa to your computer and use it in GitHub Desktop.
For Medium Article: https://medium.com/swlh/dont-let-api-data-structure-your-javascript-application-7fa7fd5a590f
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
import StringUtility from "./StringUtility"; | |
import Util from "./Util"; | |
export default class PropertyNormalizerUtility { | |
static normalize(json) { | |
const dataOrEmptyObject = Boolean(json) ? json : {}; | |
// Makes all property names camelCase so they are consistent in the application. | |
// Also recursively goes through child objects. | |
return Util.clone(dataOrEmptyObject, StringUtility.toCamelCase); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment