Compilation of JavaScript design patterns