Entry 5555

javsacript

   

Submitted by anonymous on July 31, 2010 at 9:06 a.m.
Language: JavaScript. Code size: 397 bytes.

Function.prototype.puncture = function(){
  var wormhole = function(__cmd__){
    return eval(__cmd__);
  };

  var source = ('' + this).match(/function.+?\{([\s\S]*)\}/)[1];
  var fn = new Function('this.wormhole=' + wormhole + '\n' + source);

  fn.prototype = this.prototype;
  for (var prop in this){
    if (this.hasOwnProperty(prop)) fn[prop] = this[prop];
  }

  return fn;
};

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).