Completed
Push — master ( dce25d...9db7be )
by Dimas
09:29 queued 12s
created

libs/src/observatory/ts/settings.ts   A

Complexity

Total Complexity 6
Complexity/F 1.2

Size

Lines of Code 41
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 6
mnd 1
bc 1
fnc 5
bpm 0.2
cpm 1.2
noi 0
1
"use strict";
2
3
import constants from "./constants";
4
import _ from "lodash";
5
6
var settings = constants.defaultSettings;
7
8
function setSettings(options?: any) {
9
  if (!options) {
10
    return _.merge(constants.defaultSettings, {});
11
  }
12
13
  return _.merge(settings, options);
14
}
15
16
function width() {
17
  return settings.width;
18
}
19
20
function prefix() {
21
  return settings.prefix;
22
}
23
24
function write(text) {
25
  return settings.write(text);
26
}
27
28
function formatStatus(statusLabel, state) {
29
  return settings.formatStatus(statusLabel, state);
30
}
31
32
settings = setSettings();
33
34
export = {
35
  setSettings: setSettings,
36
  width: width,
37
  prefix: prefix,
38
  write: write,
39
  formatStatus: formatStatus,
40
};
41