Created
July 14, 2019 13:50
-
-
Save derek-adair/7b0d0598faf5f5dba574d453fd8ead32 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//Object.keys returns an array like ['username/clipname': {name: clipname, mp3_file:<link_to_mp3>}] | |
userClips = Object.keys(clips) | |
// filter the array to only include those that start with the username | |
.filter(clip => !clip.indexOf(`${username}/`)) | |
// reduces the original object key array using object explode syntax | |
.reduce((obj, key)=>{ | |
return { | |
// obj is exploded, its the accumulation of the reduce | |
...obj, | |
// inserts the clip into the accumulator | |
[key]:clips[key] | |
} | |
}, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment