Created
April 1, 2020 08:08
-
-
Save Alamin02/ede6b5dfdee50e577c6539cacbaeabd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const input = { | |
page1: { | |
group1: [{ url: 'test1' }, { url: 'test2' }], | |
group2: [{ url: 'test3' }, { url: 'test4' }], | |
}, | |
page2: { | |
group1: [{ url: 'test5' }, { url: 'test6' }], | |
group2: [{ url: 'test7' }, { url: 'test8' }], | |
}, | |
}; | |
const formatData = input => { | |
output = [] | |
for (const groups of Object.values(input)) { | |
for (const urlList of Object.values(groups)) { | |
output.push(...urlList); | |
} | |
} | |
return output; | |
} | |
console.log(formatData(input)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment