packages/abuser/index.js
function shidu(filename) {
	const parent = require.cache[filename];

	if (!parent) {
		return;
	}

	// If there are children - iterate over them
	parent.children
		.map(
			({filename}) => filename
		)
		.forEach(
			child => {

				// Load child to memory
				require(child);

				// Remove all of its children from memory, recursively
				shidu(child);

				// Remove it from memory
				delete require.cache[child];
			}
		);
}
function shidu(filename) {
	const parent = require.cache[filename];

	if (!parent) {
		return;
	}

	// If there are children - iterate over them
	parent.children
		.map(
			({filename}) => filename
		)
		.forEach(
			child => {

				// Load child to memory
				require(child);

				// Remove all of its children from memory, recursively
				shidu(child);

				// Remove it from memory
				delete require.cache[child];
			}
		);
}
function shidu ( filename ) { const parent = require . cache [ filename ] ; if ( ! parent ) { return ; } // If there are children - iterate over them parent . children . map ( ( { filename } ) => filename ) . forEach ( child => { // Load child to memory require ( child ) ; // Remove all of its children from memory, recursively shidu ( child ) ; // Remove it from memory delete require . cache [ child ] ; } ) ; }
Remove all children from cache as well
@param  {String} parent
@return {undefined}
Remove all children from cache as well