Total Complexity | 8 |
Complexity/F | 2.67 |
Lines of Code | 29 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
20 | var Level = {} |
||
21 | |||
22 | Level.keys = ['All', 'Trace', 'Debug', 'Info', 'Notice', 'Warn', 'Error'] |
||
23 | Level.values = [] |
||
24 | Level.explicit = [] |
||
25 | Level.implicit = [] |
||
26 | var implicit = ['All', 'Off'] |
||
27 | Level.keys.forEach(function (id) { |
||
28 | var level = { |
||
29 | id: id, |
||
30 | weight: Level.keys.indexOf(id) + 1, |
||
31 | implicit: implicit.indexOf(id) > -1 |
||
32 | } |
||
33 | Level[id] = level |
||
34 | Level.values.push(level) |
||
35 | var target = level.implicit ? Level.implicit : Level.explicit |
||
36 | target.push(level) |
||
37 | }) |
||
38 | |||
39 | Level.find = function (input) { |
||
40 | input = input && input.toLowerCase ? input.toLowerCase() : input |
||
41 | return Level.keys.reduce(function (carrier, id) { |
||
42 | return input === id.toLowerCase() || input === Level[id] ? Level[id] : carrier |
||
43 | }, null) |
||
44 | } |
||
45 | |||
46 | module.exports = { |
||
47 | Level: Level |
||
48 | } |
||
49 |