src/FileChecker.js
/**
 * Checks whether all files specified in the check/ignore data are included in the defined compilation units.
 *
 * @constructor
 * @extends events.EventEmitter
 *
 * @emits FileChecker#verificationSuccess
 * @emits FileChecker#verificationError
 * @emits FileChecker#verificationDone
 * @emits FileChecker#error
 *
 * @param {FileCheckerOptions} options An object that includes all options required for constructing a FileChecker
 *        instance.
 * @throws {Error} Thrown in case any of the constructor options is bad.
 *
 * @suppress {misplacedTypeAnnotation}
 */
Checks whether all files specified in the check/ignore data are included in the defined compilation units.



@param {FileCheckerOptions} options An object that includes all options required for constructing a FileChecker
instance.
@throws {Error} Thrown in case any of the constructor options is bad.


Checks whether all files specified in the check / ignore data are included in the defined compilation units . @param { FileCheckerOptions } options An object that includes all options required for constructing a FileChecker instance . @throws { Error } Thrown in case any of the constructor options is bad .
function FileChecker (options) {
    if (!Array.isArray(options.filesToCheck)) {
        throw new Error('"options.filesToCheck" must be an array of strings!');
    }
    if (!Array.isArray(options.filesToIgnore)) {
        throw new Error('"options.filesToIgnore" must be an array of strings!');
    }
    if (!Array.isArray(options.filesInUnits)) {
        throw new Error('"options.filesInUnits" must be an array of strings!');
    }
    if (!Array.isArray(options.fileExtensions)) {
        throw new Error('"options.fileExtensions" must be an array of strings!');
    }
    events.EventEmitter.call(this);
    this._filesToCheck = options.filesToCheck;
    this._filesToIgnore = options.filesToIgnore;
    this._fileExtensions = options.fileExtensions;
    var absoluteFilesInUnits = options.filesInUnits.map(function (f) {
        return path.resolve(f);
    });
    this._filesInUnits = utils.arrayToSet(absoluteFilesInUnits);
    this._filteredFilesInUnits = [];
    this._filteredFilesToCheck = [];
    var self = this;
    process.nextTick(function () {
        utils.getAllFilesFromDirectories(self._filesInUnits, self._fileExtensions)
            .then(function (filesInUnits) {
                return self._filterForFileExtensions(filesInUnits);
            })
            .then(function (filteredFilesInUnits) {
                self._filteredFilesInUnits = filteredFilesInUnits;
                self._getFilesToCheck()
                    .then(function (filesToCheck) {
                        return self._filterForFileExtensions(filesToCheck);
                    })
                    .then(function (filteredFilesToCheck) {
                        self._filteredFilesToCheck = filteredFilesToCheck;
                        self._verify();
                    })
                    .then(function () {
                        self.emit('verificationDone');
                    })
                    .catch(function (err) {
                        self.emit('error', err);
                    });
            })
            .catch(function (err) {
                self.emit('error', err);
            });
    });
}
function FileChecker ( options ) { if ( ! Array . isArray ( options . filesToCheck ) ) { throw new Error ( '"options.filesToCheck" must be an array of strings!' ) ; } if ( ! Array . isArray ( options . filesToIgnore ) ) { throw new Error ( '"options.filesToIgnore" must be an array of strings!' ) ; } if ( ! Array . isArray ( options . filesInUnits ) ) { throw new Error ( '"options.filesInUnits" must be an array of strings!' ) ; } if ( ! Array . isArray ( options . fileExtensions ) ) { throw new Error ( '"options.fileExtensions" must be an array of strings!' ) ; } events . EventEmitter . call ( this ) ; this . _filesToCheck = options . filesToCheck ; this . _filesToIgnore = options . filesToIgnore ; this . _fileExtensions = options . fileExtensions ; var absoluteFilesInUnits = options . filesInUnits . map ( function ( f ) { return path . resolve ( f ) ; } ) ; this . _filesInUnits = utils . arrayToSet ( absoluteFilesInUnits ) ; this . _filteredFilesInUnits = [ ] ; this . _filteredFilesToCheck = [ ] ; var self = this ; process . nextTick ( function ( ) { utils . getAllFilesFromDirectories ( self . _filesInUnits , self . _fileExtensions ) . then ( function ( filesInUnits ) { return self . _filterForFileExtensions ( filesInUnits ) ; } ) . then ( function ( filteredFilesInUnits ) { self . _filteredFilesInUnits = filteredFilesInUnits ; self . _getFilesToCheck ( ) . then ( function ( filesToCheck ) { return self . _filterForFileExtensions ( filesToCheck ) ; } ) . then ( function ( filteredFilesToCheck ) { self . _filteredFilesToCheck = filteredFilesToCheck ; self . _verify ( ) ; } ) . then ( function ( ) { self . emit ( 'verificationDone' ) ; } ) . catch ( function ( err ) { self . emit ( 'error' , err ) ; } ) ; } ) . catch ( function ( err ) { self . emit ( 'error' , err ) ; } ) ; } ) ; }
Checks whether all files specified in the check/ignore data are included in the defined compilation units.
Checks whether all files specified in the check / ignore data are included in the defined compilation units .
/**
                         * States that the verification process is done and not more files are needed to be verified.
                         *
                         * @event FileChecker#verificationDone
                         */ /**
                         * States that an error occurred.
                         *
                         * @event FileChecker#error
                         * @param {Error} err The occurred error.
                         */