var once = function(f) { var called = false; var result = null; return function() { if (!called) { result = f.apply(this, arguments); called = true; } return result; }; };
var argNames = function(f) { var reg = /\(([\s\S]*?)\)/; var head = reg.exec(f)[1]; var argCands = head.split(/[ ,\n\r\t]+/); var names = argCands.filter(function(x) { return x; }; return names; };
"I have been writing JavaScript for 14 years now (...). The super idea is fairly important in the classical pattern, but it appears to be unnecessary in the prototypal and functional patterns. I now see my early attempts to support the classical model in JavaScript as a mistake.” http://www.crockford.com/javascript/inheritance.html