lib/title.js   A
last analyzed

Complexity

Total Complexity 9
Complexity/F 1.13

Size

Lines of Code 36
Function Count 8

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 9
eloc 19
mnd 1
bc 1
fnc 8
dl 0
loc 36
rs 10
bpm 0.125
cpm 1.125
noi 0
c 0
b 0
f 0

6 Functions

Rating   Name   Duplication   Size   Complexity  
A title.js ➔ destroy 0 2 1
A title.js ➔ resetView 0 3 1
A title.js ➔ gotoLocation 0 3 1
A title.js ➔ gotoLink 0 3 1
A title.js ➔ setTitle 0 9 4
A title.js ➔ gotoNode 0 3 1
1
define(function () {
2
  'use strict';
3
4
  return function () {
5
    function setTitle(d) {
6
      var title = [config.siteName];
7
8
      if (d !== undefined) {
9
        title.unshift(d);
10
      }
11
12
      document.title = title.join(' - ');
13
    }
14
15
    this.resetView = function resetView() {
16
      setTitle();
17
    };
18
19
    this.gotoNode = function gotoNode(d) {
20
      setTitle(d.hostname);
21
    };
22
23
    this.gotoLink = function gotoLink(d) {
24
      setTitle(d[0].source.hostname + ' \u21D4 ' + d[0].target.hostname);
25
    };
26
27
    this.gotoLocation = function gotoLocation() {
28
      // ignore
29
    };
30
31
    this.destroy = function destroy() {
32
    };
33
34
    return this;
35
  };
36
});
37