Created
December 17, 2019 00:50
-
-
Save kthompson/59e494bb6e226ad971e6e512c4860b3a to your computer and use it in GitHub Desktop.
Rambda.js deepMap
This file contains 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
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