@babel/types
Advanced tools
Comparing version
@@ -54,3 +54,3 @@ "use strict"; | ||
const pattern = value.source; | ||
const flags = value.toString().match(/\/([a-z]+|)$/)[1]; | ||
const flags = /\/([a-z]+|)$/.exec(value.toString())[1]; | ||
return (0, _index.regExpLiteral)(pattern, flags); | ||
@@ -57,0 +57,0 @@ } |
@@ -239,3 +239,4 @@ "use strict"; | ||
defineType("ObjectTypeInternalSlot", { | ||
visitor: ["id", "value", "optional", "static", "method"], | ||
visitor: ["id", "value"], | ||
builder: ["id", "value", "optional", "static", "method"], | ||
aliases: ["UserWhitespacable"], | ||
@@ -242,0 +243,0 @@ fields: { |
@@ -90,3 +90,3 @@ "use strict"; | ||
function validate(node, key, val) { | ||
if (values.indexOf(val) < 0) { | ||
if (!values.includes(val)) { | ||
throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`); | ||
@@ -234,3 +234,3 @@ } | ||
for (const k of Object.keys(opts)) { | ||
if (validTypeOpts.indexOf(k) === -1) { | ||
if (!validTypeOpts.includes(k)) { | ||
throw new Error(`Unknown type option "${k}" on ${type}`); | ||
@@ -247,3 +247,3 @@ } | ||
const field = fields[key]; | ||
if (field.default !== undefined && builder.indexOf(key) === -1) { | ||
if (field.default !== undefined && !builder.includes(key)) { | ||
field.optional = true; | ||
@@ -257,3 +257,3 @@ } | ||
for (const k of Object.keys(field)) { | ||
if (validFieldKeys.indexOf(k) === -1) { | ||
if (!validFieldKeys.includes(k)) { | ||
throw new Error(`Unknown field key "${k}" on ${type}.${key}`); | ||
@@ -260,0 +260,0 @@ } |
@@ -20,3 +20,3 @@ "use strict"; | ||
if (!node) continue; | ||
if (types.indexOf(node) >= 0) { | ||
if (types.includes(node)) { | ||
continue; | ||
@@ -23,0 +23,0 @@ } |
@@ -20,3 +20,3 @@ "use strict"; | ||
if (!node) continue; | ||
if (types.indexOf(node) >= 0) { | ||
if (types.includes(node)) { | ||
continue; | ||
@@ -23,0 +23,0 @@ } |
@@ -47,3 +47,7 @@ "use strict"; | ||
if (nodes) { | ||
Array.isArray(nodes) ? search.push(...nodes) : search.push(nodes); | ||
if (Array.isArray(nodes)) { | ||
search.push(...nodes); | ||
} else { | ||
search.push(nodes); | ||
} | ||
} | ||
@@ -55,3 +59,3 @@ } | ||
} | ||
getBindingIdentifiers.keys = { | ||
const keys = { | ||
DeclareClass: ["id"], | ||
@@ -97,3 +101,4 @@ DeclareFunction: ["id"], | ||
}; | ||
getBindingIdentifiers.keys = keys; | ||
//# sourceMappingURL=getBindingIdentifiers.js.map |
@@ -13,3 +13,3 @@ "use strict"; | ||
for (let i = 0; i < lines.length; i++) { | ||
if (lines[i].match(/[^ \t]/)) { | ||
if (/[^ \t]/.exec(lines[i])) { | ||
lastNonEmptyLine = i; | ||
@@ -16,0 +16,0 @@ } |
@@ -18,3 +18,3 @@ "use strict"; | ||
if (Array.isArray(val)) { | ||
if (val.indexOf(node) >= 0) return true; | ||
if (val.includes(node)) return true; | ||
} else { | ||
@@ -21,0 +21,0 @@ if (val === node) return true; |
{ | ||
"name": "@babel/types", | ||
"version": "7.24.7", | ||
"version": "7.24.8", | ||
"description": "Babel Types is a Lodash-esque utility library for AST nodes", | ||
@@ -27,3 +27,3 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"dependencies": { | ||
"@babel/helper-string-parser": "^7.24.7", | ||
"@babel/helper-string-parser": "^7.24.8", | ||
"@babel/helper-validator-identifier": "^7.24.7", | ||
@@ -33,4 +33,4 @@ "to-fast-properties": "^2.0.0" | ||
"devDependencies": { | ||
"@babel/generator": "^7.24.7", | ||
"@babel/parser": "^7.24.7", | ||
"@babel/generator": "^7.24.8", | ||
"@babel/parser": "^7.24.8", | ||
"glob": "^7.2.0" | ||
@@ -37,0 +37,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2412089
-0.05%20235
-0.14%