1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 | function mergeRecurse(target, source) {
|
13 | Object.keys(source).forEach(function(p) {
|
14 | if ( source[p].constructor === Object ) {
|
15 | if ( !target[p] ) { target[p] = {}; }
|
16 | mergeRecurse(target[p], source[p]);
|
17 | }
|
18 | else {
|
19 | target[p] = source[p];
|
20 | }
|
21 | });
|
22 |
|
23 | return target;
|
24 | }
|
25 |
|
26 |
|
27 | var defaults = {
|
28 | tags: {
|
29 | allowUnknownTags: true,
|
30 | dictionaries: ['jsdoc', 'closure']
|
31 | },
|
32 | templates: {
|
33 | monospaceLinks: false,
|
34 | cleverLinks: false
|
35 | },
|
36 | source: {
|
37 | includePattern: '.+\\.js(doc)?$',
|
38 | excludePattern: ''
|
39 | },
|
40 | plugins: []
|
41 | };
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | function Config(json) {
|
49 | json = JSON.parse( (json || '{}') );
|
50 | this._config = mergeRecurse(defaults, json);
|
51 | }
|
52 |
|
53 | module.exports = Config;
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | Config.prototype.get = function() {
|
59 | return this._config;
|
60 | };
|