Skip to content

Instantly share code, notes, and snippets.

@wcamarao
Last active December 5, 2022 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wcamarao/348db6d101c99df23fb08975cfe2b769 to your computer and use it in GitHub Desktop.
Save wcamarao/348db6d101c99df23fb08975cfe2b769 to your computer and use it in GitHub Desktop.

Given the following events

[
  {
    "Type": "UserCreated",
    "Payload": {
      "UserID": "a33cb19f",
      "Name": "Olivia"
    }
  },
  {
    "Type": "UserEmailAdded",
    "Payload": {
      "UserID": "a33cb19f",
      "Email": "olivia@gmail.com"
    }
  },
  {
    "Type": "UserCreated",
    "Payload": {
      "UserID": "e39ff3f6",
      "Name": "Sophia"
    }
  },
  {
    "Type": "UserEmailAdded",
    "Payload": {
      "UserID": "e39ff3f6",
      "Email": "sophia@gmail.com"
    }
  },
  {
    "Type": "UserEmailAdded",
    "Payload": {
      "UserID": "e39ff3f6",
      "Email": "sophia@icloud.com"
    }
  }
]

Display the following output

Olivia: olivia@gmail.com
Sophia: sophia@gmail.com, sophia@icloud.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment