Skip to content

Commit f9c7181

Browse files
committed
Add empty lines for readability
1 parent 6373d5e commit f9c7181

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

JavaScript/1-graph.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Vertex {
66
this.data = data;
77
this.links = new Map();
88
}
9+
910
link(...args) {
1011
const distinct = new Set(args);
1112
const { links } = this;
@@ -22,6 +23,7 @@ class Cursor {
2223
constructor(vertices) {
2324
this.vertices = vertices;
2425
}
26+
2527
linked(...names) {
2628
const { vertices } = this;
2729
const result = new Set();
@@ -41,6 +43,7 @@ class Graph {
4143
this.keyField = keyField;
4244
this.vertices = new Map();
4345
}
46+
4447
add(data) {
4548
const vertex = new Vertex(this, data);
4649
const key = data[this.keyField];
@@ -49,6 +52,7 @@ class Graph {
4952
}
5053
return vertex;
5154
}
55+
5256
select(query) {
5357
const vertices = new Set();
5458
for (const vertex of this.vertices.values()) {
@@ -75,24 +79,28 @@ const marcus = graph.add({
7579
born: 121,
7680
dynasty: 'Antonine',
7781
});
82+
7883
const lucius = graph.add({
7984
name: 'Lucius Verus',
8085
city: 'Rome',
8186
born: 130,
8287
dynasty: 'Antonine',
8388
});
89+
8490
const pius = graph.add({
8591
name: 'Antoninus Pius',
8692
city: 'Lanuvium',
8793
born: 86,
8894
dynasty: 'Antonine',
8995
});
96+
9097
const hadrian = graph.add({
9198
name: 'Hadrian',
9299
city: 'Santiponce',
93100
born: 76,
94101
dynasty: 'Nerva–Trajan',
95102
});
103+
96104
const trajan = graph.add({
97105
name: 'Trajan',
98106
city: 'Sevilla',

JavaScript/2-insert-link-to.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Vertex {
66
this.data = data;
77
this.links = new Map();
88
}
9+
910
link(...args) {
1011
const distinct = new Set(args);
1112
const { links } = this;
@@ -22,6 +23,7 @@ class Cursor {
2223
constructor(vertices) {
2324
this.vertices = vertices;
2425
}
26+
2527
linked(...names) {
2628
const { vertices } = this;
2729
const result = new Set();
@@ -41,6 +43,7 @@ class Graph {
4143
this.keyField = keyField;
4244
this.vertices = new Map();
4345
}
46+
4447
add(data) {
4548
const vertex = new Vertex(this, data);
4649
const key = data[this.keyField];
@@ -49,6 +52,7 @@ class Graph {
4952
}
5053
return vertex;
5154
}
55+
5256
select(query) {
5357
const vertices = new Set();
5458
for (const vertex of this.vertices.values()) {
@@ -63,6 +67,7 @@ class Graph {
6367
}
6468
return new Cursor(vertices);
6569
}
70+
6671
link(source) {
6772
const { vertices } = this;
6873
const from = vertices.get(source);
@@ -77,6 +82,7 @@ class Graph {
7782
}
7883
};
7984
}
85+
8086
insert(records) {
8187
for (const record of records) {
8288
this.add(record);

JavaScript/3-index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Vertex {
88
this.data = data;
99
this.links = new Map();
1010
}
11+
1112
link(...args) {
1213
const distinct = new Set(args);
1314
const { links } = this;
@@ -24,6 +25,7 @@ class Cursor {
2425
constructor(vertices) {
2526
this.vertices = vertices;
2627
}
28+
2729
linked(...names) {
2830
const { vertices } = this;
2931
const result = new Set();
@@ -44,6 +46,7 @@ class Graph {
4446
this.vertices = new Map();
4547
this.indices = new Map();
4648
}
49+
4750
add(data) {
4851
const vertex = new Vertex(this, data);
4952
const key = data[this.keyField];
@@ -52,6 +55,7 @@ class Graph {
5255
}
5356
return vertex;
5457
}
58+
5559
select(query) {
5660
let vertices;
5761
const keys = Object.keys(query);
@@ -73,6 +77,7 @@ class Graph {
7377
}
7478
return new Cursor(vertices);
7579
}
80+
7681
link(from) {
7782
return {
7883
to(...destinations) {
@@ -82,6 +87,7 @@ class Graph {
8287
}
8388
};
8489
}
90+
8591
insert(rows) {
8692
const vertices = [];
8793
for (const record of rows) {
@@ -102,6 +108,7 @@ class Graph {
102108
}
103109
return vertices;
104110
}
111+
105112
index(key) {
106113
let idx = this.indices.get(key);
107114
if (!idx) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy