Skip to content

Commit 1e25326

Browse files
committed
Prefix internal property.
1 parent 3d15697 commit 1e25326

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/IdentifierIssuer.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ module.exports = class IdentifierIssuer {
1414
*/
1515
constructor(prefix, existing = {refs: 0, map: new Map()}, counter = 0) {
1616
this.prefix = prefix;
17-
this.existing = existing;
17+
this._existing = existing;
1818
// add ref to shared map
19-
this.existing.refs++;
19+
this._existing.refs++;
2020
this.counter = counter;
2121
}
2222

@@ -26,8 +26,8 @@ module.exports = class IdentifierIssuer {
2626
* @return a copy of this IdentifierIssuer.
2727
*/
2828
clone() {
29-
const {prefix, existing, counter} = this;
30-
return new IdentifierIssuer(prefix, existing, counter);
29+
const {prefix, _existing, counter} = this;
30+
return new IdentifierIssuer(prefix, _existing, counter);
3131
}
3232

3333
/**
@@ -40,7 +40,7 @@ module.exports = class IdentifierIssuer {
4040
*/
4141
getId(old) {
4242
// return existing old identifier
43-
const existing = old && this.existing.map.get(old);
43+
const existing = old && this._existing.map.get(old);
4444
if(existing) {
4545
return existing;
4646
}
@@ -51,7 +51,7 @@ module.exports = class IdentifierIssuer {
5151

5252
// save mapping
5353
if(old) {
54-
if(this.existing.refs > 1) {
54+
if(this._existing.refs > 1) {
5555
// copy-on-write shared map
5656
// TODO: improve copy-on-write reference handling
5757
// - current code handles copying the 'existing' maps when it is
@@ -63,14 +63,14 @@ module.exports = class IdentifierIssuer {
6363
// - this won't result in errors, only extra copies if a child does
6464
// not do an update, is done, and a parent then does an update
6565
// unref shared map
66-
this.existing.refs--;
66+
this._existing.refs--;
6767
// copy to new map
68-
this.existing = {
68+
this._existing = {
6969
refs: 1,
70-
map: new Map(this.existing.map)
70+
map: new Map(this._existing.map)
7171
};
7272
}
73-
this.existing.map.set(old, identifier);
73+
this._existing.map.set(old, identifier);
7474
}
7575

7676
return identifier;
@@ -86,7 +86,7 @@ module.exports = class IdentifierIssuer {
8686
* false if not.
8787
*/
8888
hasId(old) {
89-
return this.existing.map.has(old);
89+
return this._existing.map.has(old);
9090
}
9191

9292
/**
@@ -96,6 +96,6 @@ module.exports = class IdentifierIssuer {
9696
* @return the list of old IDs that has been issued new IDs in order.
9797
*/
9898
getOldIds() {
99-
return [...this.existing.map.keys()];
99+
return [...this._existing.map.keys()];
100100
}
101101
};

0 commit comments

Comments
 (0)