UNPKG

552 BJavaScriptView Raw
1(function() {
2 module.exports = function($) {
3 /*
4 clean_(source)
5 */
6 return $.clean_ = async function(source) {
7 var listSource, pathDir, type;
8 type = $.type(source);
9 if (type !== 'string') {
10 throw new Error(`invalid type '${type}'`);
11 }
12 await $.remove_(source);
13 pathDir = $.getDirname(source);
14 listSource = (await $.source_(`${pathDir}/**/*`));
15 if (listSource.length) {
16 return $;
17 }
18 await $.remove_(pathDir);
19 return $; // return
20 };
21 };
22
23}).call(this);