Skip to content

Instantly share code, notes, and snippets.

@nicohvi
Last active December 18, 2017 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicohvi/a27f1d5b1856ad2a56e366ffc07a3cf8 to your computer and use it in GitHub Desktop.
Save nicohvi/a27f1d5b1856ad2a56e366ffc07a3cf8 to your computer and use it in GitHub Desktop.
const dict = { 'Roger': { value: 'verdi', validationFn: f1 }, 'Ted': { value: 'verdi', validationFn: f2 } };
R.keys(dict)
.map(key => {
const old = dict[key];
return { key: { value: R.prop('value', old), isValid: R.prop('validationFn', old).apply(null, old) } };
})
.reduce((acc, item) => acc[R.prop('key', item] = item, {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment