Guest User

Untitled

a guest
May 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. // async: manually sets the length of a function by wrapping it in another with the desired length
  2.  
  3. fab.arity = function( num ) {
  4. var fn = function(_){ fn.apply( this, arguments ) }
  5. , ends = [ "this(", ")" ]
  6. , args = [];
  7.  
  8. while ( --num ) args[ num - 1 ] = "_" + num;
  9.  
  10. this( Function( "fn", ends.join( fn ).replace( "_", args ) ) );
  11. }
Add Comment
Please, Sign In to add comment