Created
May 26, 2021 14:24
-
-
Save sergueyarellano/cb183a2b23d0228b24e9f6b1d0c44995 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function complyWith (input, restrictions) { | |
const formattedRestrictions = substituteOperators(restrictions) | |
return formattedRestrictions.every(applyOperator(input)) | |
} | |
function applyOperator (input) { | |
return restriction => { | |
const value = input[restriction.property] | |
return restriction.operator(value, restriction.value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment