Skip to content

Commit b859425

Browse files
authored
Merge pull request #15 from skywarth/private-attr-fix
Private attributes changed to underscore private
2 parents 4e0a53a + b055e4c commit b859425

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

src/routing-result.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,62 @@
22
//export {RoutingResult as default};
33

44
export default class RoutingResult{
5-
#foundPath=[];
6-
#traversedCountries=[];
7-
#isClosest=false;
5+
_foundPath=[];
6+
_traversedCountries=[];
7+
_isClosest=false;
88

9-
#fromCountryCode='';
10-
#toCountryCode='';
9+
_fromCountryCode='';
10+
_toCountryCode='';
1111

1212

1313
get isClosest() {
14-
return this.#isClosest;
14+
return this._isClosest;
1515
}
1616

1717
set isClosest(value) {
18-
this.#isClosest = value;
18+
this._isClosest = value;
1919
}
2020

2121
get traversedCountries() {
22-
return this.#traversedCountries;
22+
return this._traversedCountries;
2323
}
2424

2525
get fromCountryCode() {
26-
return this.#fromCountryCode;
26+
return this._fromCountryCode;
2727
}
2828

2929
get toCountryCode() {
30-
return this.#toCountryCode;
30+
return this._toCountryCode;
3131
}
3232

3333
getFoundPath() {
3434
//TODO: foundPath elements should be a class instance!
35-
return this.#foundPath;
35+
return this._foundPath;
3636
}
3737

3838
prependToFoundPath(foundPathEntry){
3939
//TODO: this is not used sufficiently, use it wherever you can
40-
this.#foundPath=[foundPathEntry,...this.#foundPath];
40+
this._foundPath=[foundPathEntry,...this._foundPath];
4141
}
4242

4343
appendToFoundPath(foundPathEntry){
44-
this.#foundPath.push(foundPathEntry);
44+
this._foundPath.push(foundPathEntry);
4545
}
4646

4747
get pathDistance() {
48-
return this.#foundPath.reduce((n, {distanceBetweenNode}) => n + distanceBetweenNode, 0);
48+
return this._foundPath.reduce((n, {distanceBetweenNode}) => n + distanceBetweenNode, 0);
4949
}
5050

5151
get pathCountryCount() {
52-
return this.#foundPath.length;
52+
return this._foundPath.length;
5353
}
5454

5555

5656
constructor(foundPath, traversedCountries, fromCountryCode, toCountryCode) {
57-
this.#foundPath = foundPath;
58-
this.#traversedCountries = traversedCountries;
59-
this.#fromCountryCode = fromCountryCode;
60-
this.#toCountryCode = toCountryCode;
57+
this._foundPath = foundPath;
58+
this._traversedCountries = traversedCountries;
59+
this._fromCountryCode = fromCountryCode;
60+
this._toCountryCode = toCountryCode;
6161
}
6262

6363

src/traverse-country-node/traverse-country-node.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
import Utils from "../utils.js";
44

55
export class CountryNode {
6-
#countryCode;
7-
#attributes;
6+
_countryCode;
7+
_attributes;
88

99

1010

1111
constructor(countryCode, attributes) {
12-
this.#countryCode = countryCode;
13-
this.#attributes = attributes;
12+
this._countryCode = countryCode;
13+
this._attributes = attributes;
1414
}
1515

1616
get countryCode() {
17-
return this.#countryCode;
17+
return this._countryCode;
1818
}
1919

2020
get attributes() {
21-
return this.#attributes;
21+
return this._attributes;
2222
}
2323

2424
isSameCountryNode(targetCountryNode){
@@ -45,23 +45,23 @@ export class CountryNode {
4545

4646
export class TraverseCountryNode extends CountryNode {
4747

48-
#distanceToFinalDestination;//TODO: this can be handled here. Consider.
48+
_distanceToFinalDestination;//TODO: this can be handled here. Consider.
4949

50-
#distanceBetweenNode;
50+
_distanceBetweenNode;
5151

5252
constructor(countryCode, attributes, distanceToFinalDestination, distanceBetweenNode) {
5353
super(countryCode,attributes);
54-
this.#distanceToFinalDestination = distanceToFinalDestination;
55-
this.#distanceBetweenNode = distanceBetweenNode;
54+
this._distanceToFinalDestination = distanceToFinalDestination;
55+
this._distanceBetweenNode = distanceBetweenNode;
5656
}
5757

5858

5959
get distanceToFinalDestination() {
60-
return this.#distanceToFinalDestination;
60+
return this._distanceToFinalDestination;
6161
}
6262

6363
get distanceBetweenNode() {
64-
return this.#distanceBetweenNode;
64+
return this._distanceBetweenNode;
6565
}
6666

6767

0 commit comments

Comments
 (0)