daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { normalize } from 'normalizr';
  2.  
  3. let normalizeData = normalize(todosResponse, responseSchema);
  4.  
  5. console.log(normalizedData);
  6. // Outputs:
  7. // {
  8. //   "entities": {
  9. //     "User": {
  10. //       "38": {
  11. //         "id": 38,
  12. //         "name": "Leanne Graham",
  13. //         "email": "Sincere@april.biz"
  14. //       }
  15. //     },
  16. //     "Todo": {
  17. //       "32": {
  18. //         "id": 32,
  19. //         "text": "Buy cheese",
  20. //         "completed": false,
  21. //         "author": 38
  22. //       },
  23. //       "33": {
  24. //         "id": 33,
  25. //         "text": "Clean laundry",
  26. //         "completed": true,
  27. //         "author": 38
  28. //       }
  29. //     }
  30. //   },
  31. //   "result": {
  32. //     "status": 200,
  33. //     "body": [32, 33]
  34. //   }
  35. // }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top