Skip to content

Instantly share code, notes, and snippets.

@xaviervia
Created November 21, 2018 15:58
Show Gist options
  • Save xaviervia/c407e5080fd7081d7c97ecacb749c572 to your computer and use it in GitHub Desktop.
Save xaviervia/c407e5080fd7081d7c97ecacb749c572 to your computer and use it in GitHub Desktop.
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