Last active
August 25, 2016 21:33
-
-
Save adambankin/df3c0dca1574ce450f29925daea65797 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
operatorToFromSDL: (function () { | |
// create hash of values once | |
var obj = { | |
'equal to': 'equals', | |
'not equal to': 'not equals', | |
'starts with': 'startswith', | |
'does not start with': 'not startswith', | |
'ends with': 'endswith', | |
'does not end with': 'not endswith', | |
'does not contain': 'not contains', | |
'equals': 'equal to', | |
'not equals': 'not equal to', | |
'startswith': 'starts with', | |
'not startswith': 'does not start with', | |
'endswith': 'ends with', | |
'not endswith': 'does not end with', | |
'contains': 'contains', | |
'not contains': 'does not contain' | |
}; | |
// return this function. This will be run each time operatorToFromSDL is called | |
return key => (typeof key === 'string' && obj[key.trim().toLowerCase()]) || false; | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment