-
-
Save granmoe/20d8b2b0ca0b691c9ffa3940e328e2ad 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 addPrefix = prefix => reduce((result, [key, val]) => { | |
result[prefix + key] = val | |
return result | |
}, {}) | |
const myObj = { | |
foo: 1, | |
bar: 2 | |
} | |
addPrefix('yo_')(Object.entries(myObj)) | |
// returns { yo_foo: 1, yo_bar: 2 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment