Skip to content

Instantly share code, notes, and snippets.

@stormpat
Created March 17, 2016 10:35
Show Gist options
  • Save stormpat/78c619eb07269e7dadc1 to your computer and use it in GitHub Desktop.
Save stormpat/78c619eb07269e7dadc1 to your computer and use it in GitHub Desktop.
Helper functions not deserving a library.
// Make it easier to transform an object.
const transform = (object, fn) =>
Object.keys(object).reduce((resulting, key) =>
Object.assign(resulting, {
[key]: fn(object[key])
}),
{}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment