steamutils 1.4.66 → 1.4.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/SteamClient.js +33 -31
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -2131,49 +2131,51 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
2131
2131
  clearTimeout(_cleanNodeSteamFriendTimeout);
2132
2132
  }
2133
2133
 
2134
- steamClient.logOff();
2135
- await sleep(5000);
2134
+ if (steamClient) {
2135
+ steamClient.logOff();
2136
+ await sleep(5000);
2136
2137
 
2137
- steamClient._connection?.end(true);
2138
+ steamClient._connection?.end(true);
2138
2139
 
2139
- function cleanSteamClient(obj, key) {
2140
- const value = obj[key];
2140
+ function cleanSteamClient(obj, key) {
2141
+ const value = obj[key];
2141
2142
 
2142
- try {
2143
- delete obj[key];
2144
- } catch (e) {
2145
- return;
2146
- }
2143
+ try {
2144
+ delete obj[key];
2145
+ } catch (e) {
2146
+ return;
2147
+ }
2147
2148
 
2148
- if (!value) {
2149
- return;
2150
- }
2149
+ if (!value) {
2150
+ return;
2151
+ }
2151
2152
 
2152
- if (typeof value !== "object") {
2153
- return;
2154
- }
2153
+ if (typeof value !== "object") {
2154
+ return;
2155
+ }
2155
2156
 
2156
- if (Array.isArray(value)) {
2157
- value.length = 0;
2158
- } else {
2159
- const constructorName = Object.getPrototypeOf(value)?.constructor?.name;
2160
- if (constructorName === "TLSSocket") {
2161
- value.destroy?.();
2162
- } else if (constructorName === "Timeout") {
2163
- clearTimeout(value);
2164
- } else if (constructorName === "SteamUser") {
2157
+ if (Array.isArray(value)) {
2158
+ value.length = 0;
2165
2159
  } else {
2166
- for (const valuekey in value) {
2167
- cleanSteamClient(value, valuekey);
2160
+ const constructorName = Object.getPrototypeOf(value)?.constructor?.name;
2161
+ if (constructorName === "TLSSocket") {
2162
+ value.destroy?.();
2163
+ } else if (constructorName === "Timeout") {
2164
+ clearTimeout(value);
2165
+ } else if (constructorName === "SteamUser") {
2166
+ } else {
2167
+ for (const valuekey in value) {
2168
+ cleanSteamClient(value, valuekey);
2169
+ }
2168
2170
  }
2169
2171
  }
2170
2172
  }
2171
- }
2172
2173
 
2173
- for (const key in steamClient) {
2174
- cleanSteamClient(steamClient, key);
2174
+ for (const key in steamClient) {
2175
+ cleanSteamClient(steamClient, key);
2176
+ }
2177
+ steamClient = null;
2175
2178
  }
2176
- steamClient = null;
2177
2179
  }
2178
2180
 
2179
2181
  async function init() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.4.66",
3
+ "version": "1.4.67",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",