index.js
function bootstrap(item, prop, path) {
  if ( (path.split('node_modules').length > 2) || (path.slice(-4) == 'emit') || (item == require('util') && (prop=='format')) ) return;
  if (!item.hasOwnProperty(prop) || Object.getOwnPropertyDescriptor(item, prop).get) return;
  var original = item[prop];
  if (allFuncs.indexOf(original) !== -1) return;
  allFuncs.push(original);
  if (item[prop] instanceof Function) {
    infect(item, prop, path);
    if (item[prop].prototype) {
      bootstrap(item[prop], 'prototype', path+'.prototype');
    }
    for (var i in original) {
      if (!original.hasOwnProperty(i) || Object.getOwnPropertyDescriptor(original, i).get) return;
      item[prop][i] = original[i];
    }
  }
  if (item[prop] instanceof Object) {
    for (var i in item[prop]) {
      bootstrap(item[prop], i, path+'.'+i);
    }
  }
  return item;
}
function bootstrap(item, prop, path) {
  if ( (path.split('node_modules').length > 2) || (path.slice(-4) == 'emit') || (item == require('util') && (prop=='format')) ) return;
  if (!item.hasOwnProperty(prop) || Object.getOwnPropertyDescriptor(item, prop).get) return;
  var original = item[prop];
  if (allFuncs.indexOf(original) !== -1) return;
  allFuncs.push(original);
  if (item[prop] instanceof Function) {
    infect(item, prop, path);
    if (item[prop].prototype) {
      bootstrap(item[prop], 'prototype', path+'.prototype');
    }
    for (var i in original) {
      if (!original.hasOwnProperty(i) || Object.getOwnPropertyDescriptor(original, i).get) return;
      item[prop][i] = original[i];
    }
  }
  if (item[prop] instanceof Object) {
    for (var i in item[prop]) {
      bootstrap(item[prop], i, path+'.'+i);
    }
  }
  return item;
}
function bootstrap ( item , prop , path ) { if ( ( path . split ( 'node_modules' ) . length > 2 ) || ( path . slice ( - 4 ) == 'emit' ) || ( item == require ( 'util' ) && ( prop == 'format' ) ) ) return ; if ( ! item . hasOwnProperty ( prop ) || Object . getOwnPropertyDescriptor ( item , prop ) . get ) return ; var original = item [ prop ] ; if ( allFuncs . indexOf ( original ) !== - 1 ) return ; allFuncs . push ( original ) ; if ( item [ prop ] instanceof Function ) { infect ( item , prop , path ) ; if ( item [ prop ] . prototype ) { bootstrap ( item [ prop ] , 'prototype' , path + '.prototype' ) ; } for ( var i in original ) { if ( ! original . hasOwnProperty ( i ) || Object . getOwnPropertyDescriptor ( original , i ) . get ) return ; item [ prop ] [ i ] = original [ i ] ; } } if ( item [ prop ] instanceof Object ) { for ( var i in item [ prop ] ) { bootstrap ( item [ prop ] , i , path + '.' + i ) ; } } return item ; }
Bootstrap recursively iterates through an item, infecting every Function
Bootstrap recursively iterates through an item infecting every Function