Skip to content

Commit 3cb6641

Browse files
Chris Zirkelthebestnom
Chris Zirkel
authored andcommitted
change getter to return vis datasets
1 parent 9ac9a39 commit 3cb6641

File tree

3 files changed

+8
-32
lines changed

3 files changed

+8
-32
lines changed

__tests__/neovis.tests.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ describe('Neovis', () => {
157157
neovis.render();
158158
await testUtils.neovisRenderDonePromise(neovis);
159159
expect(neovis._data.nodes.length).toBe(2);
160-
expect(Object.keys(neovis.nodes).length).toBe(2);
160+
expect(neovis.nodes.length).toBe(2);
161161
expect(neovis._data.edges.length).toBe(1);
162-
expect(Object.keys(neovis.edges).length).toBe(1);
162+
expect(neovis.edges.length).toBe(1);
163163
});
164164

165165
it('should save multiple records from different types', async () => {
@@ -177,9 +177,9 @@ describe('Neovis', () => {
177177
neovis.render();
178178
await testUtils.neovisRenderDonePromise(neovis);
179179
expect(neovis._data.nodes.length).toBe(5);
180-
expect(Object.keys(neovis.nodes).length).toBe(5);
180+
expect(neovis.nodes.length).toBe(5);
181181
expect(neovis._data.edges.length).toBe(2);
182-
expect(Object.keys(neovis.edges).length).toBe(2);
182+
expect(neovis.edges.length).toBe(2);
183183
});
184184

185185
it('should save raw records', async () => {

index.d.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,9 @@ export interface INeovisConfig {
3535
trust?: "TRUST_ALL_CERTIFICATES" | "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES";
3636
}
3737

38-
export interface INode {
39-
group: string;
40-
id: number;
41-
label: string;
42-
raw: any;
43-
shape: string;
44-
title: string;
45-
value: number;
46-
}
47-
48-
export interface IEdge {
49-
from: number;
50-
id: number;
51-
label: string;
52-
raw: any;
53-
title: string;
54-
to: number;
55-
value: number;
56-
}
57-
5838
declare class Neovis {
59-
nodes: {
60-
[id: number]: INode,
61-
}
62-
edges: {
63-
[id: number]: IEdge,
64-
}
39+
nodes: any;
40+
edges: any;
6541
constructor(config: INeovisConfig);
6642
render(): void;
6743
clearNetwork(): void;

src/neovis.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export default class NeoVis {
1818
* Get current vis nodes from the graph
1919
*/
2020
get nodes() {
21-
return this._nodes;
21+
return this._data.nodes;
2222
}
2323

2424
/**
2525
* Get current vis edges from the graph
2626
*/
2727
get edges() {
28-
return this._edges;
28+
return this._data.edges;
2929
}
3030

3131
/**

0 commit comments

Comments
 (0)