lib/robol.js
function(configArray, validExt) {
        var success = true,
            fileMask,
            filePath,
            dirContent;

        configArray.forEach(function(cfg) {
          var files = [];

          // setup files' paths (join file's input directory path with name)
          // check for the wildcards
          cfg.input_files.forEach(function(f,i,array) {
            f = cfg.input_dir + "/" + f;
            fileMask = new RegExp(f.replace(/\*/g, '(.*)'));

            if (~f.indexOf('*')) {
              filePath = f.substr(0, f.lastIndexOf('/')+1);
              dirContent = fs.readdirSync(filePath);

              dirContent.forEach(function(ff) {
                var fp = filePath+ff;
                if (fileMask.test(fp)) {
                  files.push(fp);
                }
              });
            } else {
              files.push(f);
            }
          });

          // Set the input files array after parsing the wildcards
          cfg.input_files = files.concat();

          // check type of files (to reject unsupported scripts/styles)
          success = cfg.input_files.every(function(file) {
            if (validExt && validExt.indexOf(path.extname(file)) < 0) {
              callback(new Error('Cannot compile. Invalid type of file: ' + file));
              return false;
            } else {
              return true;
            }
          });
        });
        return success;
      }
function(configArray, validExt) {
        var success = true,
            fileMask,
            filePath,
            dirContent;

        configArray.forEach(function(cfg) {
          var files = [];

          // setup files' paths (join file's input directory path with name)
          // check for the wildcards
          cfg.input_files.forEach(function(f,i,array) {
            f = cfg.input_dir + "/" + f;
            fileMask = new RegExp(f.replace(/\*/g, '(.*)'));

            if (~f.indexOf('*')) {
              filePath = f.substr(0, f.lastIndexOf('/')+1);
              dirContent = fs.readdirSync(filePath);

              dirContent.forEach(function(ff) {
                var fp = filePath+ff;
                if (fileMask.test(fp)) {
                  files.push(fp);
                }
              });
            } else {
              files.push(f);
            }
          });

          // Set the input files array after parsing the wildcards
          cfg.input_files = files.concat();

          // check type of files (to reject unsupported scripts/styles)
          success = cfg.input_files.every(function(file) {
            if (validExt && validExt.indexOf(path.extname(file)) < 0) {
              callback(new Error('Cannot compile. Invalid type of file: ' + file));
              return false;
            } else {
              return true;
            }
          });
        });
        return success;
      }
function ( configArray , validExt ) { var success = true , fileMask , filePath , dirContent ; configArray . forEach ( function ( cfg ) { var files = [ ] ; // setup files' paths (join file's input directory path with name) // check for the wildcards cfg . input_files . forEach ( function ( f , i , array ) { f = cfg . input_dir + "/" + f ; fileMask = new RegExp ( f . replace ( / \* / g , '(.*)' ) ) ; if ( ~ f . indexOf ( '*' ) ) { filePath = f . substr ( 0 , f . lastIndexOf ( '/' ) + 1 ) ; dirContent = fs . readdirSync ( filePath ) ; dirContent . forEach ( function ( ff ) { var fp = filePath + ff ; if ( fileMask . test ( fp ) ) { files . push ( fp ) ; } } ) ; } else { files . push ( f ) ; } } ) ; // Set the input files array after parsing the wildcards cfg . input_files = files . concat ( ) ; // check type of files (to reject unsupported scripts/styles) success = cfg . input_files . every ( function ( file ) { if ( validExt && validExt . indexOf ( path . extname ( file ) ) < 0 ) { callback ( new Error ( 'Cannot compile. Invalid type of file: ' + file ) ) ; return false ; } else { return true ; } } ) ; } ) ; return success ; }
prepare and check input files
prepare and check input files