Skip to content

Instantly share code, notes, and snippets.

View npup's full-sized avatar
💭
transpiling

P. Envall npup

💭
transpiling
View GitHub Profile
@npup
npup / gist:563727
Created September 3, 2010 10:38
Exploring some ways of fixing when ppl call a constructor function and forgetting a needed "new" operator.
(function (global, ns) {
// Awesome model
function Apa(name, dryg) {
// try to fix if "new" wasn't used
if (!(this instanceof arguments.callee)) {
console.log('No "new" operator used when creating Apa "%s". Fixing..', name);
// v1
//return newFix1(arguments);
// v2