@isograph/reference-counted-pointer 0.0.0-main-e403ba82 → 0.0.0-main-82cbc3c0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  ../.. |  WARN  Unsupported engine: wanted: {"node":"22.9.0"} (current: {"node":"v22.21.1","pnpm":"10.15.0"})
2
2
 
3
- > @isograph/reference-counted-pointer@0.0.0-main-e403ba82 compile-libs /home/runner/work/isograph/isograph/libs/isograph-reference-counted-pointer
3
+ > @isograph/reference-counted-pointer@0.0.0-main-82cbc3c0 compile-libs /home/runner/work/isograph/isograph/libs/isograph-reference-counted-pointer
4
4
  > rimraf dist && tsc -p tsconfig.pkg.json
5
5
 
@@ -47,10 +47,10 @@ class RefCounter {
47
47
  };
48
48
  }
49
49
  getIfNotDisposed() {
50
- return this.__state === null ? null : this.__state.item;
50
+ return this.__state == null ? null : this.__state.item;
51
51
  }
52
52
  retainIfNotDisposed() {
53
- if (this.__state !== null) {
53
+ if (this.__state != null) {
54
54
  this.__state.activeReferenceCount++;
55
55
  const activeReference = new ActiveReference(this);
56
56
  let disposed = false;
@@ -59,12 +59,12 @@ class RefCounter {
59
59
  throw new Error('Do not dispose an already-disposed ActiveReference.');
60
60
  }
61
61
  disposed = true;
62
- if (activeReference.__original === null) {
62
+ if (activeReference.__original == null) {
63
63
  throw new Error('Attempted to dispose an active reference, but it was already disposed. ' +
64
64
  'This indicates a bug in reference-counted-pointer.');
65
65
  }
66
66
  activeReference.__original = null;
67
- if (this.__state === null) {
67
+ if (this.__state == null) {
68
68
  throw new Error('Attempted to dispose, but the underlying reference counted pointer was disposed. ' +
69
69
  'This indicates a bug in reference-counted-pointer.');
70
70
  }
@@ -78,7 +78,7 @@ class RefCounter {
78
78
  }
79
79
  }
80
80
  __maybeDispose() {
81
- if (this.__state === null) {
81
+ if (this.__state == null) {
82
82
  throw new Error('__maybeDispose was called, but the reference counted pointer was disposed. ' +
83
83
  'This indicates a bug in reference-counted-pointer.');
84
84
  }
@@ -93,7 +93,7 @@ class ActiveReference {
93
93
  this.__original = original;
94
94
  }
95
95
  isDisposed() {
96
- return this.__original === null;
96
+ return this.__original == null;
97
97
  }
98
98
  cloneIfNotDisposed() {
99
99
  var _a, _b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isograph/reference-counted-pointer",
3
- "version": "0.0.0-main-e403ba82",
3
+ "version": "0.0.0-main-82cbc3c0",
4
4
  "description": "Reference counted pointers enable sharing of disposable items.",
5
5
  "homepage": "https://isograph.dev",
6
6
  "main": "dist/index.js",
@@ -8,7 +8,7 @@
8
8
  "author": "Isograph Labs",
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
- "@isograph/disposable-types": "0.0.0-main-e403ba82"
11
+ "@isograph/disposable-types": "0.0.0-main-82cbc3c0"
12
12
  },
13
13
  "devDependencies": {
14
14
  "typescript": "5.6.3"
@@ -71,11 +71,11 @@ class RefCounter<T> {
71
71
  }
72
72
 
73
73
  getIfNotDisposed(): T | null {
74
- return this.__state === null ? null : this.__state.item;
74
+ return this.__state == null ? null : this.__state.item;
75
75
  }
76
76
 
77
77
  retainIfNotDisposed(): ItemCleanupPair<ReferenceCountedPointer<T>> | null {
78
- if (this.__state !== null) {
78
+ if (this.__state != null) {
79
79
  this.__state.activeReferenceCount++;
80
80
 
81
81
  const activeReference = new ActiveReference(this);
@@ -88,14 +88,14 @@ class RefCounter<T> {
88
88
  );
89
89
  }
90
90
  disposed = true;
91
- if (activeReference.__original === null) {
91
+ if (activeReference.__original == null) {
92
92
  throw new Error(
93
93
  'Attempted to dispose an active reference, but it was already disposed. ' +
94
94
  'This indicates a bug in reference-counted-pointer.',
95
95
  );
96
96
  }
97
97
  activeReference.__original = null;
98
- if (this.__state === null) {
98
+ if (this.__state == null) {
99
99
  throw new Error(
100
100
  'Attempted to dispose, but the underlying reference counted pointer was disposed. ' +
101
101
  'This indicates a bug in reference-counted-pointer.',
@@ -112,7 +112,7 @@ class RefCounter<T> {
112
112
  }
113
113
 
114
114
  private __maybeDispose() {
115
- if (this.__state === null) {
115
+ if (this.__state == null) {
116
116
  throw new Error(
117
117
  '__maybeDispose was called, but the reference counted pointer was disposed. ' +
118
118
  'This indicates a bug in reference-counted-pointer.',
@@ -134,7 +134,7 @@ class ActiveReference<T> implements ReferenceCountedPointer<T> {
134
134
  }
135
135
 
136
136
  isDisposed(): boolean {
137
- return this.__original === null;
137
+ return this.__original == null;
138
138
  }
139
139
 
140
140
  cloneIfNotDisposed(): ItemCleanupPair<ReferenceCountedPointer<T>> | null {