Code coverage report for master/lib/jsdoc/config.js

Statements: 100% (15 / 15)      Branches: 100% (6 / 6)      Functions: 100% (4 / 4)      Lines: 100% (15 / 15)      Ignored: none     

All files » master/lib/jsdoc/ » config.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63                      1 11 14 5 1   5     9       11       1                                         1 6 6     1         1 5    
/**
    @overview
    @author Michael Mathews <micmath@gmail.com>
    @license Apache License 2.0 - See file 'LICENSE.md' in this project.
 */
 
/**
    @module jsdoc/config
 */
'use strict';
 
function mergeRecurse(target, source) {
    Object.keys(source).forEach(function(p) {
        if ( source[p].constructor === Object ) {
            if ( !target[p] ) {
                target[p] = {};
            }
            mergeRecurse(target[p], source[p]);
        }
        else {
            target[p] = source[p];
        }
    });
 
    return target;
}
 
// required config values, override these defaults in your config.json if necessary
var defaults = {
    tags: {
        allowUnknownTags: true,
        dictionaries: ['jsdoc', 'closure']
    },
    templates: {
        monospaceLinks: false,
        cleverLinks: false
    },
    source: {
        includePattern: '.+\\.js(doc)?$',
        excludePattern: ''
    },
    plugins: []
};
 
/**
    @class
    @classdesc Represents a JSDoc application configuration.
    @param {string} [json] - The contents of config.json.
 */
function Config(json) {
    json = JSON.parse( (json || '{}') );
    this._config = mergeRecurse(defaults, json);
}
 
module.exports = Config;
 
/**
    Get the merged configuration values.
 */
Config.prototype.get = function() {
    return this._config;
};