kinapets / javascript-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Javascript test

Implement function mergePeopleWithAnimals, which should fetch list of people and list of animals, and merge them by animalId. Result should be:

 [
    {
        name: "John",
        id: 1,
        animal: {
            name: "Piggy",
            id: 3,
            sound: "qui",
        },
    },
    ...
  ]

List of people

https://private-anon-d1351ae69b-giboork.apiary-mock.com/people

[
  {
    "name": "John",
    "id": 1,
    "animalId": 3
  },
  {
    "name": "Albert",
    "id": 2,
    "animalId": 9
  },
  {
    "name": "john",
    "id": 3,
    "animalId": 6
  }
]

List of animals

https://private-anon-d1351ae69b-giboork.apiary-mock.com/animals

[
  {
    "name": "Piggy",
    "id": 3,
    "sound": "qui"
  },
  {
    "name": "Tiggy",
    "id": 6,
    "sound": "rawr"
  },
  {
    "name": "Froggy",
    "id": 9,
    "sound": "quack"
  }
]

About


Languages

Language:JavaScript 97.6%Language:TypeScript 1.9%Language:Shell 0.4%