bundler/publish.js
function filterChildren(children, depth) {
	if(depth == 1) {
		let found = false;

		for(let item of children) {
			if(item.name == 'package.json') found = true;
			if(item.name != 'src') item.enterDir = false;
		}

		if(!found) throw(new Error());
	}

	return(children);
}
function filterChildren(children, depth) {
	if(depth == 1) {
		let found = false;

		for(let item of children) {
			if(item.name == 'package.json') found = true;
			if(item.name != 'src') item.enterDir = false;
		}

		if(!found) throw(new Error());
	}

	return(children);
}
function filterChildren ( children , depth ) { if ( depth == 1 ) { let found = false ; for ( let item of children ) { if ( item . name == 'package.json' ) found = true ; if ( item . name != 'src' ) item . enterDir = false ; } if ( ! found ) throw ( new Error ( ) ) ; } return ( children ) ; }
Detect NPM package root directories by presence of a package.json file.
Only enter a subdirectory called "src".
Usable as a "before" callback for the walk function.
@return Filtered list of directory contents.
Detect NPM package root directories by presence of a package . json file . Only enter a subdirectory called src . Usable as a before callback for the walk function .