Created
July 25, 2019 15:33
-
-
Save amiralies/dca0e085bb7063a27175f20a0e996b73 to your computer and use it in GitHub Desktop.
Object map
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
const map = (obj, fun) => | |
Object.entries(obj).reduce( | |
(prev, [key, value]) => ({ | |
...prev, | |
[key]: fun(key, value) | |
}), | |
{} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment