Skip to content

Instantly share code, notes, and snippets.

@sangheestyle
Last active August 11, 2017 14:55
Show Gist options
  • Save sangheestyle/c939eb062f58940a87360c742c67248e to your computer and use it in GitHub Desktop.
Save sangheestyle/c939eb062f58940a87360c742c67248e to your computer and use it in GitHub Desktop.
Practice #1 for Chicago on August 10, 2017
// Two inputs
const users = [
{ userId: 1, name: 'matt', email: '[email protected]' },
{ userId: 2, name: 'sanghee', email: '[email protected]' },
];
const dashboards = [
{ dashboardId: 1, ownerId: 1, title: 'summer trend 2016' },
{ dashboardId: 2, ownerId: 1, title: 'autumn trend 2016' },
{ dashboardId: 3, ownerId: 1, title: 'shared to me' },
{ dashboardId: 4, ownerId: 2, title: 'spring trend 2015' },
{ dashboardId: 5, ownerId: 2, title: 'shared to me' },
];
// expected output
const expected = [
{ owner_name: "matt", title: "summer trend 2016" },
{ owner_name: "matt", title: "autumn trend 2016"},
{ owner_name: "matt", title: "shared to me" },
{ owner_name: "sanghee", title: "spring trend 2015"},
{ owner_name: "sanghee", title: "shared to me"},
];
const original = [
{ owner_name: 'matt', title: 'shared to me' },
{ owner_name: 'matt', title: 'autumn trend 2016' },
{ owner_name: 'sanghee', title: 'shared to me' },
{ owner_name: 'matt', title: 'summer trend 2016' },
{ owner_name: 'sanghee', title: 'spring trend 2015' },
];
const expected = [
{ owner_name: 'matt', title: 'autumn trend 2016' },
{ owner_name: 'matt', title: 'shared to me' },
{ owner_name: 'matt', title: 'summer trend 2016' },
{ owner_name: 'sanghee', title: 'shared to me' },
{ owner_name: 'sanghee', title: 'spring trend 2015' },
];
@sangheestyle
Copy link
Author

const name = "example";

@sangheestyle
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment