Skip to content

Instantly share code, notes, and snippets.

@sergueyarellano
Created May 26, 2021 14:23
Show Gist options
  • Save sergueyarellano/5bc37e1a3c414572c2877d8b6add7559 to your computer and use it in GitHub Desktop.
Save sergueyarellano/5bc37e1a3c414572c2877d8b6add7559 to your computer and use it in GitHub Desktop.
function substituteOperators (restrictions) {
const operators = {
'less than': (a, b) => a < b
}
return restrictions.map(substituteOperator(operators))
}
function substituteOperator (operators) {
return restriction => {
restriction.operator = operators[restriction.operator]
return restriction
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment