Last active
January 5, 2020 02:56
-
-
Save JonathonAshworth/913c772ca15268731aa1f21c40a3fcea to your computer and use it in GitHub Desktop.
Object Utilities
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
| // f of the form (k, v) => v | |
| export const objMap = (obj, f) => | |
| Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, f(k, v)])); | |
| // f of the form ([k, v]) => [k, v] | |
| export const objMapEntries = (obj, f) => | |
| Object.fromEntries(Object.entries(obj).map(f)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment