Created
November 21, 2018 15:58
-
-
Save xaviervia/c407e5080fd7081d7c97ecacb749c572 to your computer and use it in GitHub Desktop.
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 R = require('ramda') | |
const args = [2, [1, 2, 3]] | |
const output = [[1, 2], [3]] | |
const whichRamdaFunctionShouldIUse = (args, output) => { | |
return Object.keys(R).filter((key) => { | |
if (typeof R[key] !== 'function') { | |
return false | |
} | |
try { | |
return R.equals( | |
R[key].apply(null, args), | |
output | |
) | |
} catch (e) { | |
return false | |
} | |
}) | |
} | |
console.log( | |
whichRamdaFunctionShouldIUse(args, output) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment