lib/parse/parseStructureFile.js
function parseFile(fs, file, type) {
    var filepath = file.getPath();
    var parser = file.getParser();

    if (!parser) {
        return Promise.reject(
            error.FileNotParsableError({
                filename: filepath
            })
        );
    }

    return fs.readAsString(filepath)
    .then(function(content) {
        if (type === 'readme') {
            return parser.parseReadme(content);
        } else if (type === 'glossary') {
            return parser.parseGlossary(content);
        } else if (type === 'summary') {
            return parser.parseSummary(content);
        } else if (type === 'langs') {
            return parser.parseLanguages(content);
        } else {
            throw new Error('Parsing invalid type "' + type + '"');
        }
    })
    .then(function(result) {
        return [
            file,
            result
        ];
    });
}
function parseFile(fs, file, type) {
    var filepath = file.getPath();
    var parser = file.getParser();

    if (!parser) {
        return Promise.reject(
            error.FileNotParsableError({
                filename: filepath
            })
        );
    }

    return fs.readAsString(filepath)
    .then(function(content) {
        if (type === 'readme') {
            return parser.parseReadme(content);
        } else if (type === 'glossary') {
            return parser.parseGlossary(content);
        } else if (type === 'summary') {
            return parser.parseSummary(content);
        } else if (type === 'langs') {
            return parser.parseLanguages(content);
        } else {
            throw new Error('Parsing invalid type "' + type + '"');
        }
    })
    .then(function(result) {
        return [
            file,
            result
        ];
    });
}
function parseFile ( fs , file , type ) { var filepath = file . getPath ( ) ; var parser = file . getParser ( ) ; if ( ! parser ) { return Promise . reject ( error . FileNotParsableError ( { filename : filepath } ) ) ; } return fs . readAsString ( filepath ) . then ( function ( content ) { if ( type === 'readme' ) { return parser . parseReadme ( content ) ; } else if ( type === 'glossary' ) { return parser . parseGlossary ( content ) ; } else if ( type === 'summary' ) { return parser . parseSummary ( content ) ; } else if ( type === 'langs' ) { return parser . parseLanguages ( content ) ; } else { throw new Error ( 'Parsing invalid type "' + type + '"' ) ; } } ) . then ( function ( result ) { return [ file , result ] ; } ) ; }
Parse a ParsableFile using a specific method

@param {FS} fs
@param {ParsableFile} file
@param {String} type
@return {Promise<Array<String, List|Map>>}
Parse a ParsableFile using a specific method