Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. normalizeCase = (mixed, clean = {}) => (
  2. Object
  3. .keys(mixed)
  4. .map(
  5. c => clean[c.toLowerCase()] =
  6. mixed[c] instanceof Object
  7. ? normalizeCase(mixed[c])
  8. : mixed[c]
  9. ),
  10. clean
  11. )
  12.  
  13. console.log(normalizeCase({
  14. CamelCase: "Blah",
  15. name: "egerihor",
  16. props: {
  17. john: 4,
  18. PascaL: "nope"
  19. }
  20. }))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement