Skip to content

Instantly share code, notes, and snippets.

@kthompson
Created December 17, 2019 00:50
Show Gist options
  • Save kthompson/59e494bb6e226ad971e6e512c4860b3a to your computer and use it in GitHub Desktop.
Save kthompson/59e494bb6e226ad971e6e512c4860b3a to your computer and use it in GitHub Desktop.
Rambda.js deepMap
const deepMap = (fn) => R.cond([
[R.is(Array), o => R.map(deepMap(fn))(o)],
[R.is(Object), o => R.compose(fn, R.map(deepMap(fn)))(o)],
[R.T, R.identity],
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment