Skip to content

Instantly share code, notes, and snippets.

@jfmherokiller
Created June 14, 2016 15:34
Show Gist options
  • Save jfmherokiller/1007ea9fcdc192052bb6b26e8086ea54 to your computer and use it in GitHub Desktop.
Save jfmherokiller/1007ea9fcdc192052bb6b26e8086ea54 to your computer and use it in GitHub Desktop.
/**
* Created by jfmmeyers on 6/14/16.
*/
var macros = {};
var ArrayOfCasesAndCodes = [['case1', 'console.log(\'penis\')']];
macros['createswitch'] = {
handler: function (name, ArrayOfCasesAndCodes) {
macros[name + '_evalswitch'] = {
handler: function (casetocheck) {
var index;
for (index = 0; index < ArrayOfCasesAndCodes.length; index++) {
if (casetocheck == ArrayOfCasesAndCodes[0]) {
this.eval(ArrayOfCasesAndCodes[1]);
}
}
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment