Test Failed
Pull Request — master (#2)
by Luís
03:32 queued 01:49
created

Config.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 1
1
/**
2
 * Class to handle configurations of the application
3
 * 
4
 * @class Config
5
 */
6
class Config {
7
    constructor() {
8
        this._configs = [];
9
    }
10
11
    /**
12
     * Set a new or update an existing configuration
13
     * @param {String} configName
14
     * @param {*} value
15
     */
16
    set(configName, value) {
17
        this._configs[configName] = value;
18
    }
19
20
    /**
21
     * Get the value of the configuration or the default value
22
     * @param {String} configName
23
     * @param {*} defaultValue
24
     * @returns {*}
25
     */
26
    get(configName, defaultValue = null) {
27
        return this._configs[configName] || defaultValue;
28
    }
29
}
30
31
export default Config;
32