Skip to content

Instantly share code, notes, and snippets.

@irissilvermoon
Last active December 20, 2015 10:39
Show Gist options
  • Save irissilvermoon/6116994 to your computer and use it in GitHub Desktop.
Save irissilvermoon/6116994 to your computer and use it in GitHub Desktop.
module.exports = function Bob() {
this.hey = function(str){
var map = { "[A-Z][^a-z]":"Woah, chill out!",
"[\?$]":'Sure',
'^$':'Fine, be that way.'
};
for (var k in map) {
var regex = new RegExp(k);
if (str.match(regex)) {
return map[k]
}
}
return 'Whatever';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment