Skip to content

Instantly share code, notes, and snippets.

@adambankin
Last active August 25, 2016 21:33
Show Gist options
  • Save adambankin/df3c0dca1574ce450f29925daea65797 to your computer and use it in GitHub Desktop.
Save adambankin/df3c0dca1574ce450f29925daea65797 to your computer and use it in GitHub Desktop.
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