Skip to content

Instantly share code, notes, and snippets.

@cararemixed
Created January 10, 2011 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cararemixed/773451 to your computer and use it in GitHub Desktop.
Save cararemixed/773451 to your computer and use it in GitHub Desktop.
Very nice handling by CoffeeScript
(function() {
var Foo, a;
var __slice = Array.prototype.slice;
Foo = (function() {
function Foo() {}
return Foo;
})();
a = [1, 2, 4];
(function(func, args, ctor) {
ctor.prototype = func.prototype;
var child = new ctor, result = func.apply(child, args);
return typeof result === "object" ? result : child;
})(Foo, ['abc'].concat(__slice.call(a)), function() {});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment