Nodejs Function Clone clone()

Here you can find the source of clone()

Method Source Code

Function.prototype.clone = function() {
  var that = this;
  var newFunc = function() {
    return that.apply(this, arguments); 
  };/*w ww . ja v  a  2  s .c  o  m*/
  for (var i in this) {
    newFunc[i] = this[i];
  }
  return newFunc;
};