builder.js
function onlySmHere(jsonFileName,isIndent,outFileName){
    if (fs.existsSync(jsonFileName)) {
        var fcount = JSON.parse(fs.readFileSync(jsonFileName));
        var foooo = [];
        if(fs.existsSync('SUMMARY.md')){
            fcount = lodash.without(fcount,...haslisted.hasListed('SUMMARY.md'));
        }
        if (fcount[0] !== undefined) {
            for (var i = 0; i < fcount.length; i++) {
                var CFpath = fcount[i];
                var CFtitle = gH1.getFirstH1(fcount[i],"both");
                if ( isIndent == true) {
                    var prefix = '\ \ ';
                    var spsign = CFpath.match(/\//g);
                    if (spsign !== null) {
                        var spsignCount = spsign.length;
                        var prefixRep = prefix.repeat(spsignCount);
                        var foo_item = prefixRep + '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    } else {
                        var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    }
                } else {
                    var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                    foooo.push(foo_item);
                }
            }
            var datas = foooo.join('\n');
            fs.writeFile(outFileName, datas, { encoding: 'utf8', flag: 'w' }, function (err) {
                if (err) {
                    throw err;
                }
            });
            console.log(`${chalk.yellow('summarybuilder:  ')}`+outFileName+"......ok");
        }
    }else if(typeof(jsonFileName)=="object"){
        var fcount = jsonFileName;
        var foooo = [];
        if(fs.existsSync('SUMMARY.md')){
            fcount = lodash.without(fcount,...haslisted.hasListed('SUMMARY.md'));
        }
        if (fcount[0] !== undefined) {
            for (var i = 0; i < fcount.length; i++) {
                var CFpath = fcount[i];
                var CFtitle = gH1.getFirstH1(fcount[i],"both");
                if ( isIndent == true) {
                    var prefix = '\ \ ';
                    var spsign = CFpath.match(/\//g);
                    if (spsign !== null) {
                        var spsignCount = spsign.length;
                        var prefixRep = prefix.repeat(spsignCount);
                        var foo_item = prefixRep + '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    } else {
                        var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    }
                } else {
                    var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                    foooo.push(foo_item);
                }
            }
            var datas = foooo.join('\n');
            fs.writeFile(outFileName, datas, { encoding: 'utf8', flag: 'w' }, function (err) {
                if (err) {
                    throw err;
                }
            });
            console.log(`${chalk.yellow('summarybuilder:  ')}`+outFileName+" ....... ok");
        }
        
    }else{
        console.log(`${chalk.yellow('summarybuilder:  ')}`+"No such a file names:"+jsonFileName+'. It is better to be created by the plugin: gulp-filelist.And sure all path of the list in '+jsonFileName+' are existent.');
        console.log(`${chalk.yellow('summarybuilder:  ')}`+' You can use an array type variable ,or like this: SBer_summary(["a.md","b/a.md"],true,"mySummary.md"). ')
    }
}
function onlySmHere(jsonFileName,isIndent,outFileName){
    if (fs.existsSync(jsonFileName)) {
        var fcount = JSON.parse(fs.readFileSync(jsonFileName));
        var foooo = [];
        if(fs.existsSync('SUMMARY.md')){
            fcount = lodash.without(fcount,...haslisted.hasListed('SUMMARY.md'));
        }
        if (fcount[0] !== undefined) {
            for (var i = 0; i < fcount.length; i++) {
                var CFpath = fcount[i];
                var CFtitle = gH1.getFirstH1(fcount[i],"both");
                if ( isIndent == true) {
                    var prefix = '\ \ ';
                    var spsign = CFpath.match(/\//g);
                    if (spsign !== null) {
                        var spsignCount = spsign.length;
                        var prefixRep = prefix.repeat(spsignCount);
                        var foo_item = prefixRep + '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    } else {
                        var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    }
                } else {
                    var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                    foooo.push(foo_item);
                }
            }
            var datas = foooo.join('\n');
            fs.writeFile(outFileName, datas, { encoding: 'utf8', flag: 'w' }, function (err) {
                if (err) {
                    throw err;
                }
            });
            console.log(`${chalk.yellow('summarybuilder:  ')}`+outFileName+"......ok");
        }
    }else if(typeof(jsonFileName)=="object"){
        var fcount = jsonFileName;
        var foooo = [];
        if(fs.existsSync('SUMMARY.md')){
            fcount = lodash.without(fcount,...haslisted.hasListed('SUMMARY.md'));
        }
        if (fcount[0] !== undefined) {
            for (var i = 0; i < fcount.length; i++) {
                var CFpath = fcount[i];
                var CFtitle = gH1.getFirstH1(fcount[i],"both");
                if ( isIndent == true) {
                    var prefix = '\ \ ';
                    var spsign = CFpath.match(/\//g);
                    if (spsign !== null) {
                        var spsignCount = spsign.length;
                        var prefixRep = prefix.repeat(spsignCount);
                        var foo_item = prefixRep + '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    } else {
                        var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                        foooo.push(foo_item);
                    }
                } else {
                    var foo_item = '* [' + CFtitle + '](' + CFpath + ')';
                    foooo.push(foo_item);
                }
            }
            var datas = foooo.join('\n');
            fs.writeFile(outFileName, datas, { encoding: 'utf8', flag: 'w' }, function (err) {
                if (err) {
                    throw err;
                }
            });
            console.log(`${chalk.yellow('summarybuilder:  ')}`+outFileName+" ....... ok");
        }
        
    }else{
        console.log(`${chalk.yellow('summarybuilder:  ')}`+"No such a file names:"+jsonFileName+'. It is better to be created by the plugin: gulp-filelist.And sure all path of the list in '+jsonFileName+' are existent.');
        console.log(`${chalk.yellow('summarybuilder:  ')}`+' You can use an array type variable ,or like this: SBer_summary(["a.md","b/a.md"],true,"mySummary.md"). ')
    }
}
function onlySmHere ( jsonFileName , isIndent , outFileName ) { if ( fs . existsSync ( jsonFileName ) ) { var fcount = JSON . parse ( fs . readFileSync ( jsonFileName ) ) ; var foooo = [ ] ; if ( fs . existsSync ( 'SUMMARY.md' ) ) { fcount = lodash . without ( fcount , ... haslisted . hasListed ( 'SUMMARY.md' ) ) ; } if ( fcount [ 0 ] !== undefined ) { for ( var i = 0 ; i < fcount . length ; i ++ ) { var CFpath = fcount [ i ] ; var CFtitle = gH1 . getFirstH1 ( fcount [ i ] , "both" ) ; if ( isIndent == true ) { var prefix = '\ \ ' ; var spsign = CFpath . match ( / \/ / g ) ; if ( spsign !== null ) { var spsignCount = spsign . length ; var prefixRep = prefix . repeat ( spsignCount ) ; var foo_item = prefixRep + '* [' + CFtitle + '](' + CFpath + ')' ; foooo . push ( foo_item ) ; } else { var foo_item = '* [' + CFtitle + '](' + CFpath + ')' ; foooo . push ( foo_item ) ; } } else { var foo_item = '* [' + CFtitle + '](' + CFpath + ')' ; foooo . push ( foo_item ) ; } } var datas = foooo . join ( '\n' ) ; fs . writeFile ( outFileName , datas , { encoding : 'utf8' , flag : 'w' } , function ( err ) { if ( err ) { throw err ; } } ) ; console . log ( ` ${ chalk . yellow ( 'summarybuilder:  ' ) } ` + outFileName + "......ok" ) ; } } else if ( typeof ( jsonFileName ) == "object" ) { var fcount = jsonFileName ; var foooo = [ ] ; if ( fs . existsSync ( 'SUMMARY.md' ) ) { fcount = lodash . without ( fcount , ... haslisted . hasListed ( 'SUMMARY.md' ) ) ; } if ( fcount [ 0 ] !== undefined ) { for ( var i = 0 ; i < fcount . length ; i ++ ) { var CFpath = fcount [ i ] ; var CFtitle = gH1 . getFirstH1 ( fcount [ i ] , "both" ) ; if ( isIndent == true ) { var prefix = '\ \ ' ; var spsign = CFpath . match ( / \/ / g ) ; if ( spsign !== null ) { var spsignCount = spsign . length ; var prefixRep = prefix . repeat ( spsignCount ) ; var foo_item = prefixRep + '* [' + CFtitle + '](' + CFpath + ')' ; foooo . push ( foo_item ) ; } else { var foo_item = '* [' + CFtitle + '](' + CFpath + ')' ; foooo . push ( foo_item ) ; } } else { var foo_item = '* [' + CFtitle + '](' + CFpath + ')' ; foooo . push ( foo_item ) ; } } var datas = foooo . join ( '\n' ) ; fs . writeFile ( outFileName , datas , { encoding : 'utf8' , flag : 'w' } , function ( err ) { if ( err ) { throw err ; } } ) ; console . log ( ` ${ chalk . yellow ( 'summarybuilder:  ' ) } ` + outFileName + " ....... ok" ) ; } } else { console . log ( ` ${ chalk . yellow ( 'summarybuilder:  ' ) } ` + "No such a file names:" + jsonFileName + '. It is better to be created by the plugin: gulp-filelist.And sure all path of the list in ' + jsonFileName + ' are existent.' ) ; console . log ( ` ${ chalk . yellow ( 'summarybuilder:  ' ) } ` + ' You can use an array type variable ,or like this: SBer_summary(["a.md","b/a.md"],true,"mySummary.md"). ' ) } }
for gulp 
Run only in the specified folder

@param {string} jsonFileName The path of the JSON file.It's better to be created by the plugin: gulp-filelist.
@param {boolean} isIndent indent? If'true'will be indented.
@param {string} outFileName Like this: 'a.md',Any you wanted if you sure it can be read.
for gulp Run only in the specified folder