Skip to content

Instantly share code, notes, and snippets.

@ahume
Last active September 22, 2016 21:17
Show Gist options
  • Save ahume/6e9a4eaa3fd6854122c4b65c1bc81352 to your computer and use it in GitHub Desktop.
Save ahume/6e9a4eaa3fd6854122c4b65c1bc81352 to your computer and use it in GitHub Desktop.
const extendObj =
R.curry((key, valueCreator, obj) => Object.assign({}, obj, { [key]: valueCreator(obj) }));
// e.g.
fetch(url).then(results => results.json())
.then(
R.map(extendObj('deployment_id', () => deploymentId)))
.then(
R.map(extendObj('friendly_created_at', r => moment(r.created_at).format('YYYY-MM-DD HH:mm'))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment