summaryrefslogtreecommitdiff
path: root/node_modules/source-map/lib/base64-vlq.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-11-05 17:16:09 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-11-05 17:16:09 +0800
commitd1d9f00b1bd660842addf5e6b1d1b64c852a9eea (patch)
tree60fb37ae73a1109d95301de5ec9b61b5726a4b61 /node_modules/source-map/lib/base64-vlq.js
parent7c85166c4cbdd862fc4252007d2df5befcbc2a58 (diff)
added hover prefixer
Diffstat (limited to 'node_modules/source-map/lib/base64-vlq.js')
-rw-r--r--node_modules/source-map/lib/base64-vlq.js51
1 files changed, 11 insertions, 40 deletions
diff --git a/node_modules/source-map/lib/base64-vlq.js b/node_modules/source-map/lib/base64-vlq.js
index 612b4040..fc1049c8 100644
--- a/node_modules/source-map/lib/base64-vlq.js
+++ b/node_modules/source-map/lib/base64-vlq.js
@@ -35,7 +35,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-var base64 = require('./base64');
+const base64 = require("./base64");
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
@@ -49,16 +49,16 @@ var base64 = require('./base64');
// V V
// 101011
-var VLQ_BASE_SHIFT = 5;
+const VLQ_BASE_SHIFT = 5;
// binary: 100000
-var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
+const VLQ_BASE = 1 << VLQ_BASE_SHIFT;
// binary: 011111
-var VLQ_BASE_MASK = VLQ_BASE - 1;
+const VLQ_BASE_MASK = VLQ_BASE - 1;
// binary: 100000
-var VLQ_CONTINUATION_BIT = VLQ_BASE;
+const VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
@@ -78,9 +78,10 @@ function toVLQSigned(aValue) {
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
+// eslint-disable-next-line no-unused-vars
function fromVLQSigned(aValue) {
- var isNegative = (aValue & 1) === 1;
- var shifted = aValue >> 1;
+ const isNegative = (aValue & 1) === 1;
+ const shifted = aValue >> 1;
return isNegative
? -shifted
: shifted;
@@ -90,10 +91,10 @@ function fromVLQSigned(aValue) {
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
- var encoded = "";
- var digit;
+ let encoded = "";
+ let digit;
- var vlq = toVLQSigned(aValue);
+ let vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
@@ -108,33 +109,3 @@ exports.encode = function base64VLQ_encode(aValue) {
return encoded;
};
-
-/**
- * Decodes the next base 64 VLQ value from the given string and returns the
- * value and the rest of the string via the out parameter.
- */
-exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
- var strLen = aStr.length;
- var result = 0;
- var shift = 0;
- var continuation, digit;
-
- do {
- if (aIndex >= strLen) {
- throw new Error("Expected more digits in base 64 VLQ value.");
- }
-
- digit = base64.decode(aStr.charCodeAt(aIndex++));
- if (digit === -1) {
- throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
- }
-
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
- digit &= VLQ_BASE_MASK;
- result = result + (digit << shift);
- shift += VLQ_BASE_SHIFT;
- } while (continuation);
-
- aOutParam.value = fromVLQSigned(result);
- aOutParam.rest = aIndex;
-};