Created
May 1, 2010 00:17
-
-
Save jed/385918 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// async: manually sets the length of a function by wrapping it in another with the desired length | |
fab.arity = function( num ) { | |
var fn = function(_){ fn.apply( this, arguments ) } | |
, ends = [ "this(", ")" ] | |
, args = []; | |
while ( --num ) args[ num - 1 ] = "_" + num; | |
this( Function( "fn", ends.join( fn ).replace( "_", args ) ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment