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

src/js/core/Config.js   A

Size

Lines of Code 26

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
nc 1
dl 0
loc 26
rs 10
c 2
b 0
f 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A Config.js ➔ ??? 0 3 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