UNPKG

470 BJavaScriptView Raw
1let elesfn = ({
2 isNode: function(){
3 return this.group() === 'nodes';
4 },
5
6 isEdge: function(){
7 return this.group() === 'edges';
8 },
9
10 isLoop: function(){
11 return this.isEdge() && this.source()[0] === this.target()[0];
12 },
13
14 isSimple: function(){
15 return this.isEdge() && this.source()[0] !== this.target()[0];
16 },
17
18 group: function(){
19 let ele = this[0];
20
21 if( ele ){
22 return ele._private.group;
23 }
24 }
25});
26
27
28export default elesfn;