Completed
Push — develop ( 7c8456...1887a3 )
by Xaver
32s
created

nodefilter.js ➔ ... ➔ data.links.filter   A

Complexity

Conditions 1
Paths 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
nop 1
1
define(function () {
2
  'use strict';
3
4
  return function (filter) {
5
    return function (data) {
6
      var n = Object.create(data);
7
      n.nodes = {};
8
9
      for (var key in data.nodes) {
10
        if (data.nodes.hasOwnProperty(key)) {
11
          n.nodes[key] = data.nodes[key].filter(filter);
12
        }
13
      }
14
15
      n.links = data.links.filter(function (d) {
16
        return filter(d.source) && filter(d.target);
17
      });
18
19
      return n;
20
    };
21
  };
22
});
23