Guest User

Untitled

a guest
Jul 6th, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. const users = [{
  2. "email": "shutchcraft0@un.org",
  3. "id": "186f4765-e2db-4fc0-9b13-0557f922a900",
  4. "ip_address": "38.203.170.215"
  5. }, {
  6. "email": "rrasp1@gov.uk",
  7. "id": "ad79e53c-3d3d-46e2-8d90-c8dd1591d125",
  8. "ip_address": "230.60.100.209"
  9. }, {
  10. "email": "tjepensen2@google.co.uk",
  11. "id": "0f306feb-c3bc-4d28-987f-ea4e185fed7d",
  12. "ip_address": "188.153.240.17"
  13. }, {
  14. "email": "cgood3@alexa.com",
  15. "id": "a2188b5b-8f51-4986-9883-0b2fbc56c82e",
  16. "ip_address": "168.241.245.186"
  17. }, {
  18. "email": "ameiklejohn4@washington.edu",
  19. "id": "b2905ade-573e-4d8d-95ef-ce0e0c77ad8b",
  20. "ip_address": "178.56.93.148"
  21. }, {
  22. "email": "erouchy5@google.nl",
  23. "id": "9c724cb5-e252-428c-a657-148da11d0d77",
  24. "ip_address": "171.206.246.249"
  25. }, {
  26. "email": "vgerrish6@eventbrite.com",
  27. "id": "14db1c2b-34dc-405f-80df-97f1bbc0c017",
  28. "ip_address": "141.159.12.188"
  29. }, {
  30. "email": "pllorente7@quantcast.com",
  31. "id": "60e7a4cd-6199-49ce-b286-33b7f504e8c5",
  32. "ip_address": "243.97.64.242"
  33. }, {
  34. "email": "kwintringham8@meetup.com",
  35. "id": "b817520e-a9fb-40ed-bdf6-07eca526dcc7",
  36. "ip_address": "68.26.89.42"
  37. }, {
  38. "email": "kfrail9@parallels.com",
  39. "id": "85933f7b-7b8b-468d-99f3-a6e032b14482",
  40. "ip_address": "171.22.215.114"
  41. }, {
  42. "email": "smawsona@netscape.com",
  43. "id": "bb59d769-3763-4dc7-bad0-5a7833339233",
  44. "ip_address": "98.239.36.119"
  45. }, {
  46. "email": "hcaldicotb@columbia.edu",
  47. "id": "2a40d703-425b-473a-984e-b4d28f811581",
  48. "ip_address": "117.126.105.48"
  49. }, {
  50. "email": "mluckc@ning.com",
  51. "id": "cf54a1a3-b2bb-4bad-a10e-07543ea50414",
  52. "ip_address": "92.161.226.163"
  53. }, {
  54. "email": "sbenechd@sourceforge.net",
  55. "id": "068edfa4-db2e-45c1-8c86-9744478be563",
  56. "ip_address": "92.77.228.235"
  57. }, {
  58. "email": "jcreasere@deliciousdays.com",
  59. "id": "e6e0b4af-06c6-4271-ac93-29f3254f463f",
  60. "ip_address": "44.219.150.112"
  61. }, {
  62. "email": "bdadswellf@arstechnica.com",
  63. "id": "641b32c0-a8f6-475a-97b2-ed68cdee5c94",
  64. "ip_address": "185.185.209.119"
  65. }, {
  66. "email": "jkidstoneg@google.de",
  67. "id": "9df377de-1170-40fd-8355-70fe83d1275f",
  68. "ip_address": "169.198.174.126"
  69. }, {
  70. "email": "aadkinsh@linkedin.com",
  71. "id": "60b14847-5646-4e7a-9718-ef291998fb22",
  72. "ip_address": "41.175.117.178"
  73. }, {
  74. "email": "dbrunkeri@ocn.ne.jp",
  75. "id": "fd7b446f-812f-4f99-af2a-2be1409e4d47",
  76. "ip_address": "66.171.149.88"
  77. }, {
  78. "email": "tmorgonj@miitbeian.gov.cn",
  79. "id": "c3c4a6fa-a8e9-483c-99a0-5df427e5192d",
  80. "ip_address": "139.133.41.168"
  81. }];
  82. const profiles = [{
  83. "email": "mluckc@ning.com",
  84. "name": "Michèle",
  85. "lang": "Tswana"
  86. }, {
  87. "email": "aadkinsh@linkedin.com",
  88. "name": "André",
  89. "lang": "Kurdish"
  90. }, {
  91. "email": "ameiklejohn4@washington.edu",
  92. "name": "Táng",
  93. "lang": "Moldovan"
  94. }, {
  95. "email": "pllorente7@quantcast.com",
  96. "name": "Dù",
  97. "lang": "Malagasy"
  98. }, {
  99. "email": "jkidstoneg@google.de",
  100. "name": "Zhì",
  101. "lang": "Swahili"
  102. }, {
  103. "email": "aadkinsh@linkedin.com",
  104. "name": "Michèle",
  105. "lang": "Catalan"
  106. }, {
  107. "email": "jcreasere@deliciousdays.com",
  108. "name": "Loïca",
  109. "lang": "Tajik"
  110. }, {
  111. "email": "rrasp1@gov.uk",
  112. "name": "Athéna",
  113. "lang": "Fijian"
  114. }, {
  115. "email": "tmorgonj@miitbeian.gov.cn",
  116. "name": "Marie-ève",
  117. "lang": "New Zealand Sign Language"
  118. }, {
  119. "email": "rrasp1@gov.uk",
  120. "name": "Agnès",
  121. "lang": "Quechua"
  122. }, {
  123. "email": "erouchy5@google.nl",
  124. "name": "Céline",
  125. "lang": "Macedonian"
  126. }, {
  127. "email": "pllorente7@quantcast.com",
  128. "name": "Athéna",
  129. "lang": "Malay"
  130. }, {
  131. "email": "jkidstoneg@google.de",
  132. "name": "Adèle",
  133. "lang": "Croatian"
  134. }, {
  135. "email": "cgood3@alexa.com",
  136. "name": "Véronique",
  137. "lang": "Bosnian"
  138. }, {
  139. "email": "cgood3@alexa.com",
  140. "name": "Björn",
  141. "lang": "Dzongkha"
  142. }, {
  143. "email": "hcaldicotb@columbia.edu",
  144. "name": "Vénus",
  145. "lang": "Finnish"
  146. }, {
  147. "email": "kwintringham8@meetup.com",
  148. "name": "Pénélope",
  149. "lang": "Zulu"
  150. }, {
  151. "email": "jcreasere@deliciousdays.com",
  152. "name": "Daphnée",
  153. "lang": "Catalan"
  154. }, {
  155. "email": "vgerrish6@eventbrite.com",
  156. "name": "Simplifiés",
  157. "lang": "Northern Sotho"
  158. }, {
  159. "email": "erouchy5@google.nl",
  160. "name": "Noémie",
  161. "lang": "New Zealand Sign Language"
  162. }]
  163.  
  164. const profilesMap = profiles.reduce((accum, item) => {
  165. return {
  166. ...accum,
  167. [item.email]: item
  168. }
  169. }, {});
  170.  
  171. console.log(profilesMap);
  172.  
  173. users.map(user => {
  174. return {
  175. ...user,
  176. ...(profilesMap[user.email])
  177. }
  178. });
Add Comment
Please, Sign In to add comment