Guest User

Untitled

a guest
Jul 17th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. normalizeData(data) {
  2.  
  3. function deconstruct(d) {
  4. const goodData = {};
  5. Object.keys(d).forEach(key => Object.assign(goodData, typeof d[key] === 'object' ? deconstruct(d[key]) : { [key]: d[key] }));
  6. return goodData;
  7. }
  8.  
  9. const normalize = [];
  10. data.forEach(item => normalize.push(deconstruct(item)));
  11. return normalize;
  12. },
Add Comment
Please, Sign In to add comment