Total Complexity | 4 |
Complexity/F | 1.33 |
Lines of Code | 36 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /***************************************************************************************************************** |
||
19 | function ParameterBag() { |
||
20 | this.store = new Array(); |
||
|
|||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @public |
||
25 | * @param {string} key |
||
26 | * @param {mixed} data |
||
27 | */ |
||
28 | ParameterBag.prototype.set = function(key, data) { |
||
29 | this.store[key] = data; |
||
30 | }; |
||
31 | /** |
||
32 | * @public |
||
33 | * @param {string} key |
||
34 | * @param {mixed} defaultValue If value is undefined for the key, defaultValue will be returned |
||
35 | * |
||
36 | * @returns {mixed} |
||
37 | */ |
||
38 | ParameterBag.prototype.get = function (key, defaultValue) { |
||
39 | var value = this.store[key]; |
||
40 | if ('undefined' == typeof(value)) { |
||
41 | return defaultValue; |
||
42 | } |
||
43 | |||
44 | return value; |
||
45 | }; |
||
46 | |||
47 | /** |
||
48 | * @private |
||
49 | * @type {Array} |
||
50 | */ |
||
51 | ParameterBag.prototype.store = null; |
||
52 | |||
53 | /* Export class */ |
||
54 | module.exports = ParameterBag; |
||
55 |