Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save negativo/fcaf67d89bc641f6dca71c968a1a3336 to your computer and use it in GitHub Desktop.
Save negativo/fcaf67d89bc641f6dca71c968a1a3336 to your computer and use it in GitHub Desktop.
function evalBool(str){
if( str[0] === 't' &&
str[1] === 'r' &&
str[2] === 'u' &&
str[3] === 'e'
){
return true;
}
if( str[0] === 'f' &&
str[1] === 'a' &&
str[2] === 'l' &&
str[3] === 's' &&
str[4] === 'e'
){
return false;
}
if( str[0] === 'n' &&
str[1] === 'u' &&
str[2] === 'l' &&
str[3] === 'l'
){
return null;
}
return undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment