quiq-socket
Advanced tools
Comparing version 0.3.1 to 0.3.3
@@ -138,3 +138,41 @@ function _classCallCheck(instance, Constructor) { | ||
/** Used to match a single whitespace character. */ | ||
var reWhitespace = /\s/; | ||
/** | ||
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace | ||
* character of `string`. | ||
* | ||
* @private | ||
* @param {string} string The string to inspect. | ||
* @returns {number} Returns the index of the last non-whitespace character. | ||
*/ | ||
function trimmedEndIndex(string) { | ||
var index = string.length; | ||
while (index-- && reWhitespace.test(string.charAt(index))) {} | ||
return index; | ||
} | ||
var _trimmedEndIndex = trimmedEndIndex; | ||
/** Used to match leading whitespace. */ | ||
var reTrimStart = /^\s+/; | ||
/** | ||
* The base implementation of `_.trim`. | ||
* | ||
* @private | ||
* @param {string} string The string to trim. | ||
* @returns {string} Returns the trimmed string. | ||
*/ | ||
function baseTrim(string) { | ||
return string | ||
? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '') | ||
: string; | ||
} | ||
var _baseTrim = baseTrim; | ||
/** | ||
* Checks if `value` is the | ||
@@ -344,5 +382,2 @@ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) | ||
/** Used to match leading and trailing whitespace. */ | ||
var reTrim = /^\s+|\s+$/g; | ||
/** Used to detect bad signed hexadecimal string values. */ | ||
@@ -397,3 +432,3 @@ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; | ||
} | ||
value = value.replace(reTrim, ''); | ||
value = _baseTrim(value); | ||
var isBinary = reIsBinary.test(value); | ||
@@ -1304,2 +1339,9 @@ return (isBinary || reIsOctal.test(value)) | ||
_this._connecting = false; | ||
_this._fireHandlers(Events.CONNECTION_LOSS, { | ||
code: 0, | ||
reason: 'Connection timeout' | ||
}); | ||
_this._retryConnection(); | ||
@@ -1306,0 +1348,0 @@ }, _this._options.connectionAttemptTimeout); // Make connection |
@@ -142,3 +142,41 @@ 'use strict'; | ||
/** Used to match a single whitespace character. */ | ||
var reWhitespace = /\s/; | ||
/** | ||
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace | ||
* character of `string`. | ||
* | ||
* @private | ||
* @param {string} string The string to inspect. | ||
* @returns {number} Returns the index of the last non-whitespace character. | ||
*/ | ||
function trimmedEndIndex(string) { | ||
var index = string.length; | ||
while (index-- && reWhitespace.test(string.charAt(index))) {} | ||
return index; | ||
} | ||
var _trimmedEndIndex = trimmedEndIndex; | ||
/** Used to match leading whitespace. */ | ||
var reTrimStart = /^\s+/; | ||
/** | ||
* The base implementation of `_.trim`. | ||
* | ||
* @private | ||
* @param {string} string The string to trim. | ||
* @returns {string} Returns the trimmed string. | ||
*/ | ||
function baseTrim(string) { | ||
return string | ||
? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '') | ||
: string; | ||
} | ||
var _baseTrim = baseTrim; | ||
/** | ||
* Checks if `value` is the | ||
@@ -348,5 +386,2 @@ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) | ||
/** Used to match leading and trailing whitespace. */ | ||
var reTrim = /^\s+|\s+$/g; | ||
/** Used to detect bad signed hexadecimal string values. */ | ||
@@ -401,3 +436,3 @@ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; | ||
} | ||
value = value.replace(reTrim, ''); | ||
value = _baseTrim(value); | ||
var isBinary = reIsBinary.test(value); | ||
@@ -1305,2 +1340,9 @@ return (isBinary || reIsOctal.test(value)) | ||
_this._connecting = false; | ||
_this._fireHandlers(exports.Events.CONNECTION_LOSS, { | ||
code: 0, | ||
reason: 'Connection timeout' | ||
}); | ||
_this._retryConnection(); | ||
@@ -1307,0 +1349,0 @@ }, _this._options.connectionAttemptTimeout); // Make connection |
{ | ||
"name": "quiq-socket", | ||
"version": "0.3.1", | ||
"version": "0.3.3", | ||
"description": "WebSocket API wrapper with automatic retry handling and heartbeat", | ||
@@ -78,4 +78,7 @@ "main": "dist/index.js", | ||
"resolutions": { | ||
"serialize-javascript": "2.1.2" | ||
"serialize-javascript": "3.1.0", | ||
"lodash": "4.17.21", | ||
"node-forge": "0.10.0", | ||
"node-fetch": "2.6.1" | ||
} | ||
} | ||
} |
124030
3215