index.js
function determineTargetDir(source, target) {
	return stat(source).
		then(results => results.isDirectory() ? target : path.dirname(target));
}
function determineTargetDir(source, target) {
	return stat(source).
		then(results => results.isDirectory() ? target : path.dirname(target));
}
function determineTargetDir ( source , target ) { return stat ( source ) . then ( results => results . isDirectory ( ) ? target : path . dirname ( target ) ) ; }
If `source` is a directory, `target` is used as target directory - otherwise, `target`'s parent directory is used
If source is a directory target is used as target directory - otherwise target s parent directory is used