Comparing version 0.0.2 to 0.0.3
56
index.js
@@ -5,3 +5,2 @@ const net = require("net"); | ||
module.exports.ConnectorClient = class ConnectorClient extends EventEmitter { | ||
constructor(key) { | ||
@@ -67,34 +66,31 @@ super(); | ||
return await new Promise((resolve, reject) => { | ||
this._requests[_ID] = (data) => { | ||
try { | ||
if (data.success) { | ||
if (typeof success == "function") | ||
return resolve(success(data.data)); | ||
return resolve(data.data); | ||
} | ||
let e = data.error; | ||
if (typeof error == "object") { | ||
if (typeof error[e.code] == "function") | ||
return resolve(error[e.code](e.data, e)); | ||
i f (typeof error["default"] == "function") | ||
return resolve(error["default"](e.code, e.data, e)); | ||
} else if (typeof error == "function") { | ||
return resolve(error(e.code, e.data, e)); | ||
} | ||
return reject(e); | ||
this._requests[_ID] = (data) => { | ||
try { | ||
if (data.success) { | ||
if (typeof success == "function") | ||
return resolve(success(data.data)); | ||
return resolve(data.data); | ||
} | ||
catch | ||
(e) { | ||
return reject(e); | ||
let e = data.error; | ||
if (typeof error == "object") { | ||
if (typeof error[e.code] == "function") | ||
return resolve(error[e.code](e.data, e)); | ||
if (typeof error["default"] == "function") | ||
return resolve(error["default"](e.code, e.data, e)); | ||
} else if (typeof error == "function") { | ||
return resolve(error(e.code, e.data, e)); | ||
} | ||
}; | ||
setTimeout(() => { | ||
reject("__TIMEOUT__"); | ||
}, timeout | 5000); | ||
} | ||
) | ||
; | ||
return reject(e); | ||
} | ||
catch | ||
(e) { | ||
return reject(e); | ||
} | ||
}; | ||
setTimeout(() => { | ||
reject("__TIMEOUT__"); | ||
}, timeout | 5000); | ||
}); | ||
} | ||
} | ||
; | ||
}; | ||
@@ -101,0 +97,0 @@ module.exports.ConnectorServer = class ConnectorServer extends EventEmitter { |
{ | ||
"name": "aconnector", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9660
4
219