Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/helper-string-parser

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-string-parser - npm Package Compare versions

Comparing version 7.18.10 to 7.19.4

lib/index.js.map

53

lib/index.js

@@ -30,3 +30,3 @@ "use strict";

let out = "";
let containsInvalid = false;
let firstInvalidLoc = null;
let chunkStart = pos;

@@ -53,16 +53,19 @@ const {

out += input.slice(chunkStart, pos);
let escaped;
const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
if (res.ch === null && !firstInvalidLoc) {
firstInvalidLoc = {
pos,
lineStart,
curLine
};
} else {
out += res.ch;
}
({
ch: escaped,
pos,
lineStart,
curLine
} = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors));
if (escaped === null) {
containsInvalid = true;
} else {
out += escaped;
}
} = res);
chunkStart = pos;

@@ -95,5 +98,6 @@ } else if (ch === 8232 || ch === 8233) {

str: out,
containsInvalid,
firstInvalidLoc,
lineStart,
curLine
curLine,
containsInvalid: !!firstInvalidLoc
};

@@ -219,3 +223,3 @@ }

pos
} = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors));
} = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));

@@ -236,3 +240,3 @@ if (n === null) {

function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors) {
function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
const start = pos;

@@ -253,4 +257,12 @@ const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;

if (!allowNumSeparator) {
if (bailOnError) return {
n: null,
pos
};
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
if (bailOnError) return {
n: null,
pos
};
errors.unexpectedNumericSeparator(pos, lineStart, curLine);

@@ -274,3 +286,8 @@ }

if (val >= radix) {
if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
if (val <= 9 && bailOnError) {
return {
n: null,
pos
};
} else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
val = 0;

@@ -335,2 +352,4 @@ } else if (forceLen) {

};
}
}
//# sourceMappingURL=index.js.map
{
"name": "@babel/helper-string-parser",
"version": "7.18.10",
"version": "7.19.4",
"description": "A utility package to parse strings",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc