@babel/types
Advanced tools
Comparing version 7.0.0-beta.43 to 7.0.0-beta.44
@@ -14,5 +14,5 @@ "use strict"; | ||
if (!(0, _isNode.default)(node)) { | ||
const type = node && node.type || JSON.stringify(node); | ||
throw new TypeError(`Not a valid node of type "${type}"`); | ||
var type = node && node.type || JSON.stringify(node); | ||
throw new TypeError("Not a valid node of type \"" + type + "\""); | ||
} | ||
} |
@@ -265,995 +265,1987 @@ "use strict"; | ||
if (!(0, _is.default)(type, node, opts)) { | ||
throw new Error(`Expected type "${type}" with option ${JSON.stringify(opts)}, but instead got "${node.type}".`); | ||
throw new Error("Expected type \"" + type + "\" with option " + JSON.stringify(opts) + ", but instead got \"" + node.type + "\"."); | ||
} | ||
} | ||
function assertArrayExpression(node, opts = {}) { | ||
function assertArrayExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ArrayExpression", node, opts); | ||
} | ||
function assertAssignmentExpression(node, opts = {}) { | ||
function assertAssignmentExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("AssignmentExpression", node, opts); | ||
} | ||
function assertBinaryExpression(node, opts = {}) { | ||
function assertBinaryExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BinaryExpression", node, opts); | ||
} | ||
function assertDirective(node, opts = {}) { | ||
function assertDirective(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Directive", node, opts); | ||
} | ||
function assertDirectiveLiteral(node, opts = {}) { | ||
function assertDirectiveLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DirectiveLiteral", node, opts); | ||
} | ||
function assertBlockStatement(node, opts = {}) { | ||
function assertBlockStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BlockStatement", node, opts); | ||
} | ||
function assertBreakStatement(node, opts = {}) { | ||
function assertBreakStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BreakStatement", node, opts); | ||
} | ||
function assertCallExpression(node, opts = {}) { | ||
function assertCallExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("CallExpression", node, opts); | ||
} | ||
function assertCatchClause(node, opts = {}) { | ||
function assertCatchClause(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("CatchClause", node, opts); | ||
} | ||
function assertConditionalExpression(node, opts = {}) { | ||
function assertConditionalExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ConditionalExpression", node, opts); | ||
} | ||
function assertContinueStatement(node, opts = {}) { | ||
function assertContinueStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ContinueStatement", node, opts); | ||
} | ||
function assertDebuggerStatement(node, opts = {}) { | ||
function assertDebuggerStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DebuggerStatement", node, opts); | ||
} | ||
function assertDoWhileStatement(node, opts = {}) { | ||
function assertDoWhileStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DoWhileStatement", node, opts); | ||
} | ||
function assertEmptyStatement(node, opts = {}) { | ||
function assertEmptyStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("EmptyStatement", node, opts); | ||
} | ||
function assertExpressionStatement(node, opts = {}) { | ||
function assertExpressionStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExpressionStatement", node, opts); | ||
} | ||
function assertFile(node, opts = {}) { | ||
function assertFile(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("File", node, opts); | ||
} | ||
function assertForInStatement(node, opts = {}) { | ||
function assertForInStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ForInStatement", node, opts); | ||
} | ||
function assertForStatement(node, opts = {}) { | ||
function assertForStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ForStatement", node, opts); | ||
} | ||
function assertFunctionDeclaration(node, opts = {}) { | ||
function assertFunctionDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FunctionDeclaration", node, opts); | ||
} | ||
function assertFunctionExpression(node, opts = {}) { | ||
function assertFunctionExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FunctionExpression", node, opts); | ||
} | ||
function assertIdentifier(node, opts = {}) { | ||
function assertIdentifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Identifier", node, opts); | ||
} | ||
function assertIfStatement(node, opts = {}) { | ||
function assertIfStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("IfStatement", node, opts); | ||
} | ||
function assertLabeledStatement(node, opts = {}) { | ||
function assertLabeledStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("LabeledStatement", node, opts); | ||
} | ||
function assertStringLiteral(node, opts = {}) { | ||
function assertStringLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("StringLiteral", node, opts); | ||
} | ||
function assertNumericLiteral(node, opts = {}) { | ||
function assertNumericLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("NumericLiteral", node, opts); | ||
} | ||
function assertNullLiteral(node, opts = {}) { | ||
function assertNullLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("NullLiteral", node, opts); | ||
} | ||
function assertBooleanLiteral(node, opts = {}) { | ||
function assertBooleanLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BooleanLiteral", node, opts); | ||
} | ||
function assertRegExpLiteral(node, opts = {}) { | ||
function assertRegExpLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("RegExpLiteral", node, opts); | ||
} | ||
function assertLogicalExpression(node, opts = {}) { | ||
function assertLogicalExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("LogicalExpression", node, opts); | ||
} | ||
function assertMemberExpression(node, opts = {}) { | ||
function assertMemberExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("MemberExpression", node, opts); | ||
} | ||
function assertNewExpression(node, opts = {}) { | ||
function assertNewExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("NewExpression", node, opts); | ||
} | ||
function assertProgram(node, opts = {}) { | ||
function assertProgram(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Program", node, opts); | ||
} | ||
function assertObjectExpression(node, opts = {}) { | ||
function assertObjectExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectExpression", node, opts); | ||
} | ||
function assertObjectMethod(node, opts = {}) { | ||
function assertObjectMethod(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectMethod", node, opts); | ||
} | ||
function assertObjectProperty(node, opts = {}) { | ||
function assertObjectProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectProperty", node, opts); | ||
} | ||
function assertRestElement(node, opts = {}) { | ||
function assertRestElement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("RestElement", node, opts); | ||
} | ||
function assertReturnStatement(node, opts = {}) { | ||
function assertReturnStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ReturnStatement", node, opts); | ||
} | ||
function assertSequenceExpression(node, opts = {}) { | ||
function assertSequenceExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("SequenceExpression", node, opts); | ||
} | ||
function assertSwitchCase(node, opts = {}) { | ||
function assertSwitchCase(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("SwitchCase", node, opts); | ||
} | ||
function assertSwitchStatement(node, opts = {}) { | ||
function assertSwitchStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("SwitchStatement", node, opts); | ||
} | ||
function assertThisExpression(node, opts = {}) { | ||
function assertThisExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ThisExpression", node, opts); | ||
} | ||
function assertThrowStatement(node, opts = {}) { | ||
function assertThrowStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ThrowStatement", node, opts); | ||
} | ||
function assertTryStatement(node, opts = {}) { | ||
function assertTryStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TryStatement", node, opts); | ||
} | ||
function assertUnaryExpression(node, opts = {}) { | ||
function assertUnaryExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("UnaryExpression", node, opts); | ||
} | ||
function assertUpdateExpression(node, opts = {}) { | ||
function assertUpdateExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("UpdateExpression", node, opts); | ||
} | ||
function assertVariableDeclaration(node, opts = {}) { | ||
function assertVariableDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("VariableDeclaration", node, opts); | ||
} | ||
function assertVariableDeclarator(node, opts = {}) { | ||
function assertVariableDeclarator(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("VariableDeclarator", node, opts); | ||
} | ||
function assertWhileStatement(node, opts = {}) { | ||
function assertWhileStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("WhileStatement", node, opts); | ||
} | ||
function assertWithStatement(node, opts = {}) { | ||
function assertWithStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("WithStatement", node, opts); | ||
} | ||
function assertAssignmentPattern(node, opts = {}) { | ||
function assertAssignmentPattern(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("AssignmentPattern", node, opts); | ||
} | ||
function assertArrayPattern(node, opts = {}) { | ||
function assertArrayPattern(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ArrayPattern", node, opts); | ||
} | ||
function assertArrowFunctionExpression(node, opts = {}) { | ||
function assertArrowFunctionExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ArrowFunctionExpression", node, opts); | ||
} | ||
function assertClassBody(node, opts = {}) { | ||
function assertClassBody(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ClassBody", node, opts); | ||
} | ||
function assertClassDeclaration(node, opts = {}) { | ||
function assertClassDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ClassDeclaration", node, opts); | ||
} | ||
function assertClassExpression(node, opts = {}) { | ||
function assertClassExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ClassExpression", node, opts); | ||
} | ||
function assertExportAllDeclaration(node, opts = {}) { | ||
function assertExportAllDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExportAllDeclaration", node, opts); | ||
} | ||
function assertExportDefaultDeclaration(node, opts = {}) { | ||
function assertExportDefaultDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExportDefaultDeclaration", node, opts); | ||
} | ||
function assertExportNamedDeclaration(node, opts = {}) { | ||
function assertExportNamedDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExportNamedDeclaration", node, opts); | ||
} | ||
function assertExportSpecifier(node, opts = {}) { | ||
function assertExportSpecifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExportSpecifier", node, opts); | ||
} | ||
function assertForOfStatement(node, opts = {}) { | ||
function assertForOfStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ForOfStatement", node, opts); | ||
} | ||
function assertImportDeclaration(node, opts = {}) { | ||
function assertImportDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ImportDeclaration", node, opts); | ||
} | ||
function assertImportDefaultSpecifier(node, opts = {}) { | ||
function assertImportDefaultSpecifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ImportDefaultSpecifier", node, opts); | ||
} | ||
function assertImportNamespaceSpecifier(node, opts = {}) { | ||
function assertImportNamespaceSpecifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ImportNamespaceSpecifier", node, opts); | ||
} | ||
function assertImportSpecifier(node, opts = {}) { | ||
function assertImportSpecifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ImportSpecifier", node, opts); | ||
} | ||
function assertMetaProperty(node, opts = {}) { | ||
function assertMetaProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("MetaProperty", node, opts); | ||
} | ||
function assertClassMethod(node, opts = {}) { | ||
function assertClassMethod(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ClassMethod", node, opts); | ||
} | ||
function assertObjectPattern(node, opts = {}) { | ||
function assertObjectPattern(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectPattern", node, opts); | ||
} | ||
function assertSpreadElement(node, opts = {}) { | ||
function assertSpreadElement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("SpreadElement", node, opts); | ||
} | ||
function assertSuper(node, opts = {}) { | ||
function assertSuper(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Super", node, opts); | ||
} | ||
function assertTaggedTemplateExpression(node, opts = {}) { | ||
function assertTaggedTemplateExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TaggedTemplateExpression", node, opts); | ||
} | ||
function assertTemplateElement(node, opts = {}) { | ||
function assertTemplateElement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TemplateElement", node, opts); | ||
} | ||
function assertTemplateLiteral(node, opts = {}) { | ||
function assertTemplateLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TemplateLiteral", node, opts); | ||
} | ||
function assertYieldExpression(node, opts = {}) { | ||
function assertYieldExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("YieldExpression", node, opts); | ||
} | ||
function assertAnyTypeAnnotation(node, opts = {}) { | ||
function assertAnyTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("AnyTypeAnnotation", node, opts); | ||
} | ||
function assertArrayTypeAnnotation(node, opts = {}) { | ||
function assertArrayTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ArrayTypeAnnotation", node, opts); | ||
} | ||
function assertBooleanTypeAnnotation(node, opts = {}) { | ||
function assertBooleanTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BooleanTypeAnnotation", node, opts); | ||
} | ||
function assertBooleanLiteralTypeAnnotation(node, opts = {}) { | ||
function assertBooleanLiteralTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BooleanLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertNullLiteralTypeAnnotation(node, opts = {}) { | ||
function assertNullLiteralTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("NullLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertClassImplements(node, opts = {}) { | ||
function assertClassImplements(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ClassImplements", node, opts); | ||
} | ||
function assertDeclareClass(node, opts = {}) { | ||
function assertDeclareClass(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareClass", node, opts); | ||
} | ||
function assertDeclareFunction(node, opts = {}) { | ||
function assertDeclareFunction(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareFunction", node, opts); | ||
} | ||
function assertDeclareInterface(node, opts = {}) { | ||
function assertDeclareInterface(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareInterface", node, opts); | ||
} | ||
function assertDeclareModule(node, opts = {}) { | ||
function assertDeclareModule(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareModule", node, opts); | ||
} | ||
function assertDeclareModuleExports(node, opts = {}) { | ||
function assertDeclareModuleExports(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareModuleExports", node, opts); | ||
} | ||
function assertDeclareTypeAlias(node, opts = {}) { | ||
function assertDeclareTypeAlias(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareTypeAlias", node, opts); | ||
} | ||
function assertDeclareOpaqueType(node, opts = {}) { | ||
function assertDeclareOpaqueType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareOpaqueType", node, opts); | ||
} | ||
function assertDeclareVariable(node, opts = {}) { | ||
function assertDeclareVariable(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareVariable", node, opts); | ||
} | ||
function assertDeclareExportDeclaration(node, opts = {}) { | ||
function assertDeclareExportDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareExportDeclaration", node, opts); | ||
} | ||
function assertDeclareExportAllDeclaration(node, opts = {}) { | ||
function assertDeclareExportAllDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclareExportAllDeclaration", node, opts); | ||
} | ||
function assertDeclaredPredicate(node, opts = {}) { | ||
function assertDeclaredPredicate(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DeclaredPredicate", node, opts); | ||
} | ||
function assertExistsTypeAnnotation(node, opts = {}) { | ||
function assertExistsTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExistsTypeAnnotation", node, opts); | ||
} | ||
function assertFunctionTypeAnnotation(node, opts = {}) { | ||
function assertFunctionTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FunctionTypeAnnotation", node, opts); | ||
} | ||
function assertFunctionTypeParam(node, opts = {}) { | ||
function assertFunctionTypeParam(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FunctionTypeParam", node, opts); | ||
} | ||
function assertGenericTypeAnnotation(node, opts = {}) { | ||
function assertGenericTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("GenericTypeAnnotation", node, opts); | ||
} | ||
function assertInferredPredicate(node, opts = {}) { | ||
function assertInferredPredicate(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("InferredPredicate", node, opts); | ||
} | ||
function assertInterfaceExtends(node, opts = {}) { | ||
function assertInterfaceExtends(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("InterfaceExtends", node, opts); | ||
} | ||
function assertInterfaceDeclaration(node, opts = {}) { | ||
function assertInterfaceDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("InterfaceDeclaration", node, opts); | ||
} | ||
function assertIntersectionTypeAnnotation(node, opts = {}) { | ||
function assertIntersectionTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("IntersectionTypeAnnotation", node, opts); | ||
} | ||
function assertMixedTypeAnnotation(node, opts = {}) { | ||
function assertMixedTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("MixedTypeAnnotation", node, opts); | ||
} | ||
function assertEmptyTypeAnnotation(node, opts = {}) { | ||
function assertEmptyTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("EmptyTypeAnnotation", node, opts); | ||
} | ||
function assertNullableTypeAnnotation(node, opts = {}) { | ||
function assertNullableTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("NullableTypeAnnotation", node, opts); | ||
} | ||
function assertNumberLiteralTypeAnnotation(node, opts = {}) { | ||
function assertNumberLiteralTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("NumberLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertNumberTypeAnnotation(node, opts = {}) { | ||
function assertNumberTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("NumberTypeAnnotation", node, opts); | ||
} | ||
function assertObjectTypeAnnotation(node, opts = {}) { | ||
function assertObjectTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectTypeAnnotation", node, opts); | ||
} | ||
function assertObjectTypeCallProperty(node, opts = {}) { | ||
function assertObjectTypeCallProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectTypeCallProperty", node, opts); | ||
} | ||
function assertObjectTypeIndexer(node, opts = {}) { | ||
function assertObjectTypeIndexer(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectTypeIndexer", node, opts); | ||
} | ||
function assertObjectTypeProperty(node, opts = {}) { | ||
function assertObjectTypeProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectTypeProperty", node, opts); | ||
} | ||
function assertObjectTypeSpreadProperty(node, opts = {}) { | ||
function assertObjectTypeSpreadProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectTypeSpreadProperty", node, opts); | ||
} | ||
function assertOpaqueType(node, opts = {}) { | ||
function assertOpaqueType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("OpaqueType", node, opts); | ||
} | ||
function assertQualifiedTypeIdentifier(node, opts = {}) { | ||
function assertQualifiedTypeIdentifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("QualifiedTypeIdentifier", node, opts); | ||
} | ||
function assertStringLiteralTypeAnnotation(node, opts = {}) { | ||
function assertStringLiteralTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("StringLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertStringTypeAnnotation(node, opts = {}) { | ||
function assertStringTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("StringTypeAnnotation", node, opts); | ||
} | ||
function assertThisTypeAnnotation(node, opts = {}) { | ||
function assertThisTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ThisTypeAnnotation", node, opts); | ||
} | ||
function assertTupleTypeAnnotation(node, opts = {}) { | ||
function assertTupleTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TupleTypeAnnotation", node, opts); | ||
} | ||
function assertTypeofTypeAnnotation(node, opts = {}) { | ||
function assertTypeofTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TypeofTypeAnnotation", node, opts); | ||
} | ||
function assertTypeAlias(node, opts = {}) { | ||
function assertTypeAlias(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TypeAlias", node, opts); | ||
} | ||
function assertTypeAnnotation(node, opts = {}) { | ||
function assertTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TypeAnnotation", node, opts); | ||
} | ||
function assertTypeCastExpression(node, opts = {}) { | ||
function assertTypeCastExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TypeCastExpression", node, opts); | ||
} | ||
function assertTypeParameter(node, opts = {}) { | ||
function assertTypeParameter(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TypeParameter", node, opts); | ||
} | ||
function assertTypeParameterDeclaration(node, opts = {}) { | ||
function assertTypeParameterDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TypeParameterDeclaration", node, opts); | ||
} | ||
function assertTypeParameterInstantiation(node, opts = {}) { | ||
function assertTypeParameterInstantiation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TypeParameterInstantiation", node, opts); | ||
} | ||
function assertUnionTypeAnnotation(node, opts = {}) { | ||
function assertUnionTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("UnionTypeAnnotation", node, opts); | ||
} | ||
function assertVariance(node, opts = {}) { | ||
function assertVariance(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Variance", node, opts); | ||
} | ||
function assertVoidTypeAnnotation(node, opts = {}) { | ||
function assertVoidTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("VoidTypeAnnotation", node, opts); | ||
} | ||
function assertJSXAttribute(node, opts = {}) { | ||
function assertJSXAttribute(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXAttribute", node, opts); | ||
} | ||
function assertJSXClosingElement(node, opts = {}) { | ||
function assertJSXClosingElement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXClosingElement", node, opts); | ||
} | ||
function assertJSXElement(node, opts = {}) { | ||
function assertJSXElement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXElement", node, opts); | ||
} | ||
function assertJSXEmptyExpression(node, opts = {}) { | ||
function assertJSXEmptyExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXEmptyExpression", node, opts); | ||
} | ||
function assertJSXExpressionContainer(node, opts = {}) { | ||
function assertJSXExpressionContainer(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXExpressionContainer", node, opts); | ||
} | ||
function assertJSXSpreadChild(node, opts = {}) { | ||
function assertJSXSpreadChild(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXSpreadChild", node, opts); | ||
} | ||
function assertJSXIdentifier(node, opts = {}) { | ||
function assertJSXIdentifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXIdentifier", node, opts); | ||
} | ||
function assertJSXMemberExpression(node, opts = {}) { | ||
function assertJSXMemberExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXMemberExpression", node, opts); | ||
} | ||
function assertJSXNamespacedName(node, opts = {}) { | ||
function assertJSXNamespacedName(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXNamespacedName", node, opts); | ||
} | ||
function assertJSXOpeningElement(node, opts = {}) { | ||
function assertJSXOpeningElement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXOpeningElement", node, opts); | ||
} | ||
function assertJSXSpreadAttribute(node, opts = {}) { | ||
function assertJSXSpreadAttribute(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXSpreadAttribute", node, opts); | ||
} | ||
function assertJSXText(node, opts = {}) { | ||
function assertJSXText(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXText", node, opts); | ||
} | ||
function assertJSXFragment(node, opts = {}) { | ||
function assertJSXFragment(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXFragment", node, opts); | ||
} | ||
function assertJSXOpeningFragment(node, opts = {}) { | ||
function assertJSXOpeningFragment(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXOpeningFragment", node, opts); | ||
} | ||
function assertJSXClosingFragment(node, opts = {}) { | ||
function assertJSXClosingFragment(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSXClosingFragment", node, opts); | ||
} | ||
function assertNoop(node, opts = {}) { | ||
function assertNoop(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Noop", node, opts); | ||
} | ||
function assertParenthesizedExpression(node, opts = {}) { | ||
function assertParenthesizedExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ParenthesizedExpression", node, opts); | ||
} | ||
function assertAwaitExpression(node, opts = {}) { | ||
function assertAwaitExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("AwaitExpression", node, opts); | ||
} | ||
function assertBindExpression(node, opts = {}) { | ||
function assertBindExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BindExpression", node, opts); | ||
} | ||
function assertClassProperty(node, opts = {}) { | ||
function assertClassProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ClassProperty", node, opts); | ||
} | ||
function assertOptionalMemberExpression(node, opts = {}) { | ||
function assertOptionalMemberExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("OptionalMemberExpression", node, opts); | ||
} | ||
function assertOptionalCallExpression(node, opts = {}) { | ||
function assertOptionalCallExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("OptionalCallExpression", node, opts); | ||
} | ||
function assertImport(node, opts = {}) { | ||
function assertImport(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Import", node, opts); | ||
} | ||
function assertDecorator(node, opts = {}) { | ||
function assertDecorator(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Decorator", node, opts); | ||
} | ||
function assertDoExpression(node, opts = {}) { | ||
function assertDoExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("DoExpression", node, opts); | ||
} | ||
function assertExportDefaultSpecifier(node, opts = {}) { | ||
function assertExportDefaultSpecifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExportDefaultSpecifier", node, opts); | ||
} | ||
function assertExportNamespaceSpecifier(node, opts = {}) { | ||
function assertExportNamespaceSpecifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExportNamespaceSpecifier", node, opts); | ||
} | ||
function assertTSParameterProperty(node, opts = {}) { | ||
function assertTSParameterProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSParameterProperty", node, opts); | ||
} | ||
function assertTSDeclareFunction(node, opts = {}) { | ||
function assertTSDeclareFunction(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSDeclareFunction", node, opts); | ||
} | ||
function assertTSDeclareMethod(node, opts = {}) { | ||
function assertTSDeclareMethod(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSDeclareMethod", node, opts); | ||
} | ||
function assertTSQualifiedName(node, opts = {}) { | ||
function assertTSQualifiedName(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSQualifiedName", node, opts); | ||
} | ||
function assertTSCallSignatureDeclaration(node, opts = {}) { | ||
function assertTSCallSignatureDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSCallSignatureDeclaration", node, opts); | ||
} | ||
function assertTSConstructSignatureDeclaration(node, opts = {}) { | ||
function assertTSConstructSignatureDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSConstructSignatureDeclaration", node, opts); | ||
} | ||
function assertTSPropertySignature(node, opts = {}) { | ||
function assertTSPropertySignature(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSPropertySignature", node, opts); | ||
} | ||
function assertTSMethodSignature(node, opts = {}) { | ||
function assertTSMethodSignature(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSMethodSignature", node, opts); | ||
} | ||
function assertTSIndexSignature(node, opts = {}) { | ||
function assertTSIndexSignature(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSIndexSignature", node, opts); | ||
} | ||
function assertTSAnyKeyword(node, opts = {}) { | ||
function assertTSAnyKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSAnyKeyword", node, opts); | ||
} | ||
function assertTSNumberKeyword(node, opts = {}) { | ||
function assertTSNumberKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSNumberKeyword", node, opts); | ||
} | ||
function assertTSObjectKeyword(node, opts = {}) { | ||
function assertTSObjectKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSObjectKeyword", node, opts); | ||
} | ||
function assertTSBooleanKeyword(node, opts = {}) { | ||
function assertTSBooleanKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSBooleanKeyword", node, opts); | ||
} | ||
function assertTSStringKeyword(node, opts = {}) { | ||
function assertTSStringKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSStringKeyword", node, opts); | ||
} | ||
function assertTSSymbolKeyword(node, opts = {}) { | ||
function assertTSSymbolKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSSymbolKeyword", node, opts); | ||
} | ||
function assertTSVoidKeyword(node, opts = {}) { | ||
function assertTSVoidKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSVoidKeyword", node, opts); | ||
} | ||
function assertTSUndefinedKeyword(node, opts = {}) { | ||
function assertTSUndefinedKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSUndefinedKeyword", node, opts); | ||
} | ||
function assertTSNullKeyword(node, opts = {}) { | ||
function assertTSNullKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSNullKeyword", node, opts); | ||
} | ||
function assertTSNeverKeyword(node, opts = {}) { | ||
function assertTSNeverKeyword(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSNeverKeyword", node, opts); | ||
} | ||
function assertTSThisType(node, opts = {}) { | ||
function assertTSThisType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSThisType", node, opts); | ||
} | ||
function assertTSFunctionType(node, opts = {}) { | ||
function assertTSFunctionType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSFunctionType", node, opts); | ||
} | ||
function assertTSConstructorType(node, opts = {}) { | ||
function assertTSConstructorType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSConstructorType", node, opts); | ||
} | ||
function assertTSTypeReference(node, opts = {}) { | ||
function assertTSTypeReference(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeReference", node, opts); | ||
} | ||
function assertTSTypePredicate(node, opts = {}) { | ||
function assertTSTypePredicate(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypePredicate", node, opts); | ||
} | ||
function assertTSTypeQuery(node, opts = {}) { | ||
function assertTSTypeQuery(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeQuery", node, opts); | ||
} | ||
function assertTSTypeLiteral(node, opts = {}) { | ||
function assertTSTypeLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeLiteral", node, opts); | ||
} | ||
function assertTSArrayType(node, opts = {}) { | ||
function assertTSArrayType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSArrayType", node, opts); | ||
} | ||
function assertTSTupleType(node, opts = {}) { | ||
function assertTSTupleType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTupleType", node, opts); | ||
} | ||
function assertTSUnionType(node, opts = {}) { | ||
function assertTSUnionType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSUnionType", node, opts); | ||
} | ||
function assertTSIntersectionType(node, opts = {}) { | ||
function assertTSIntersectionType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSIntersectionType", node, opts); | ||
} | ||
function assertTSConditionalType(node, opts = {}) { | ||
function assertTSConditionalType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSConditionalType", node, opts); | ||
} | ||
function assertTSInferType(node, opts = {}) { | ||
function assertTSInferType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSInferType", node, opts); | ||
} | ||
function assertTSParenthesizedType(node, opts = {}) { | ||
function assertTSParenthesizedType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSParenthesizedType", node, opts); | ||
} | ||
function assertTSTypeOperator(node, opts = {}) { | ||
function assertTSTypeOperator(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeOperator", node, opts); | ||
} | ||
function assertTSIndexedAccessType(node, opts = {}) { | ||
function assertTSIndexedAccessType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSIndexedAccessType", node, opts); | ||
} | ||
function assertTSMappedType(node, opts = {}) { | ||
function assertTSMappedType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSMappedType", node, opts); | ||
} | ||
function assertTSLiteralType(node, opts = {}) { | ||
function assertTSLiteralType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSLiteralType", node, opts); | ||
} | ||
function assertTSExpressionWithTypeArguments(node, opts = {}) { | ||
function assertTSExpressionWithTypeArguments(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSExpressionWithTypeArguments", node, opts); | ||
} | ||
function assertTSInterfaceDeclaration(node, opts = {}) { | ||
function assertTSInterfaceDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSInterfaceDeclaration", node, opts); | ||
} | ||
function assertTSInterfaceBody(node, opts = {}) { | ||
function assertTSInterfaceBody(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSInterfaceBody", node, opts); | ||
} | ||
function assertTSTypeAliasDeclaration(node, opts = {}) { | ||
function assertTSTypeAliasDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeAliasDeclaration", node, opts); | ||
} | ||
function assertTSAsExpression(node, opts = {}) { | ||
function assertTSAsExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSAsExpression", node, opts); | ||
} | ||
function assertTSTypeAssertion(node, opts = {}) { | ||
function assertTSTypeAssertion(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeAssertion", node, opts); | ||
} | ||
function assertTSEnumDeclaration(node, opts = {}) { | ||
function assertTSEnumDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSEnumDeclaration", node, opts); | ||
} | ||
function assertTSEnumMember(node, opts = {}) { | ||
function assertTSEnumMember(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSEnumMember", node, opts); | ||
} | ||
function assertTSModuleDeclaration(node, opts = {}) { | ||
function assertTSModuleDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSModuleDeclaration", node, opts); | ||
} | ||
function assertTSModuleBlock(node, opts = {}) { | ||
function assertTSModuleBlock(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSModuleBlock", node, opts); | ||
} | ||
function assertTSImportEqualsDeclaration(node, opts = {}) { | ||
function assertTSImportEqualsDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSImportEqualsDeclaration", node, opts); | ||
} | ||
function assertTSExternalModuleReference(node, opts = {}) { | ||
function assertTSExternalModuleReference(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSExternalModuleReference", node, opts); | ||
} | ||
function assertTSNonNullExpression(node, opts = {}) { | ||
function assertTSNonNullExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSNonNullExpression", node, opts); | ||
} | ||
function assertTSExportAssignment(node, opts = {}) { | ||
function assertTSExportAssignment(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSExportAssignment", node, opts); | ||
} | ||
function assertTSNamespaceExportDeclaration(node, opts = {}) { | ||
function assertTSNamespaceExportDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSNamespaceExportDeclaration", node, opts); | ||
} | ||
function assertTSTypeAnnotation(node, opts = {}) { | ||
function assertTSTypeAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeAnnotation", node, opts); | ||
} | ||
function assertTSTypeParameterInstantiation(node, opts = {}) { | ||
function assertTSTypeParameterInstantiation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeParameterInstantiation", node, opts); | ||
} | ||
function assertTSTypeParameterDeclaration(node, opts = {}) { | ||
function assertTSTypeParameterDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeParameterDeclaration", node, opts); | ||
} | ||
function assertTSTypeParameter(node, opts = {}) { | ||
function assertTSTypeParameter(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeParameter", node, opts); | ||
} | ||
function assertExpression(node, opts = {}) { | ||
function assertExpression(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Expression", node, opts); | ||
} | ||
function assertBinary(node, opts = {}) { | ||
function assertBinary(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Binary", node, opts); | ||
} | ||
function assertScopable(node, opts = {}) { | ||
function assertScopable(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Scopable", node, opts); | ||
} | ||
function assertBlockParent(node, opts = {}) { | ||
function assertBlockParent(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("BlockParent", node, opts); | ||
} | ||
function assertBlock(node, opts = {}) { | ||
function assertBlock(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Block", node, opts); | ||
} | ||
function assertStatement(node, opts = {}) { | ||
function assertStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Statement", node, opts); | ||
} | ||
function assertTerminatorless(node, opts = {}) { | ||
function assertTerminatorless(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Terminatorless", node, opts); | ||
} | ||
function assertCompletionStatement(node, opts = {}) { | ||
function assertCompletionStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("CompletionStatement", node, opts); | ||
} | ||
function assertConditional(node, opts = {}) { | ||
function assertConditional(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Conditional", node, opts); | ||
} | ||
function assertLoop(node, opts = {}) { | ||
function assertLoop(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Loop", node, opts); | ||
} | ||
function assertWhile(node, opts = {}) { | ||
function assertWhile(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("While", node, opts); | ||
} | ||
function assertExpressionWrapper(node, opts = {}) { | ||
function assertExpressionWrapper(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExpressionWrapper", node, opts); | ||
} | ||
function assertFor(node, opts = {}) { | ||
function assertFor(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("For", node, opts); | ||
} | ||
function assertForXStatement(node, opts = {}) { | ||
function assertForXStatement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ForXStatement", node, opts); | ||
} | ||
function assertFunction(node, opts = {}) { | ||
function assertFunction(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Function", node, opts); | ||
} | ||
function assertFunctionParent(node, opts = {}) { | ||
function assertFunctionParent(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FunctionParent", node, opts); | ||
} | ||
function assertPureish(node, opts = {}) { | ||
function assertPureish(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Pureish", node, opts); | ||
} | ||
function assertDeclaration(node, opts = {}) { | ||
function assertDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Declaration", node, opts); | ||
} | ||
function assertPatternLike(node, opts = {}) { | ||
function assertPatternLike(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("PatternLike", node, opts); | ||
} | ||
function assertLVal(node, opts = {}) { | ||
function assertLVal(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("LVal", node, opts); | ||
} | ||
function assertTSEntityName(node, opts = {}) { | ||
function assertTSEntityName(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSEntityName", node, opts); | ||
} | ||
function assertLiteral(node, opts = {}) { | ||
function assertLiteral(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Literal", node, opts); | ||
} | ||
function assertImmutable(node, opts = {}) { | ||
function assertImmutable(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Immutable", node, opts); | ||
} | ||
function assertUserWhitespacable(node, opts = {}) { | ||
function assertUserWhitespacable(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("UserWhitespacable", node, opts); | ||
} | ||
function assertMethod(node, opts = {}) { | ||
function assertMethod(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Method", node, opts); | ||
} | ||
function assertObjectMember(node, opts = {}) { | ||
function assertObjectMember(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ObjectMember", node, opts); | ||
} | ||
function assertProperty(node, opts = {}) { | ||
function assertProperty(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Property", node, opts); | ||
} | ||
function assertUnaryLike(node, opts = {}) { | ||
function assertUnaryLike(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("UnaryLike", node, opts); | ||
} | ||
function assertPattern(node, opts = {}) { | ||
function assertPattern(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Pattern", node, opts); | ||
} | ||
function assertClass(node, opts = {}) { | ||
function assertClass(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Class", node, opts); | ||
} | ||
function assertModuleDeclaration(node, opts = {}) { | ||
function assertModuleDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ModuleDeclaration", node, opts); | ||
} | ||
function assertExportDeclaration(node, opts = {}) { | ||
function assertExportDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ExportDeclaration", node, opts); | ||
} | ||
function assertModuleSpecifier(node, opts = {}) { | ||
function assertModuleSpecifier(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("ModuleSpecifier", node, opts); | ||
} | ||
function assertFlow(node, opts = {}) { | ||
function assertFlow(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("Flow", node, opts); | ||
} | ||
function assertFlowType(node, opts = {}) { | ||
function assertFlowType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FlowType", node, opts); | ||
} | ||
function assertFlowBaseAnnotation(node, opts = {}) { | ||
function assertFlowBaseAnnotation(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FlowBaseAnnotation", node, opts); | ||
} | ||
function assertFlowDeclaration(node, opts = {}) { | ||
function assertFlowDeclaration(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FlowDeclaration", node, opts); | ||
} | ||
function assertFlowPredicate(node, opts = {}) { | ||
function assertFlowPredicate(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("FlowPredicate", node, opts); | ||
} | ||
function assertJSX(node, opts = {}) { | ||
function assertJSX(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("JSX", node, opts); | ||
} | ||
function assertTSTypeElement(node, opts = {}) { | ||
function assertTSTypeElement(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSTypeElement", node, opts); | ||
} | ||
function assertTSType(node, opts = {}) { | ||
function assertTSType(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
assert("TSType", node, opts); | ||
@@ -1260,0 +2252,0 @@ } |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _clone() { | ||
const data = _interopRequireDefault(require("lodash/clone")); | ||
var data = _interopRequireDefault(require("lodash/clone")); | ||
_clone = function () { | ||
_clone = function _clone() { | ||
return data; | ||
@@ -25,17 +25,21 @@ }; | ||
function builder(type, ...args) { | ||
const keys = _definitions.BUILDER_KEYS[type]; | ||
const countArgs = args.length; | ||
function builder(type) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
var keys = _definitions.BUILDER_KEYS[type]; | ||
var countArgs = args.length; | ||
if (countArgs > keys.length) { | ||
throw new Error(`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`); | ||
throw new Error(type + ": Too many arguments passed. Received " + countArgs + " but can receive no more than " + keys.length); | ||
} | ||
const node = { | ||
type | ||
var node = { | ||
type: type | ||
}; | ||
let i = 0; | ||
keys.forEach(key => { | ||
const field = _definitions.NODE_FIELDS[type][key]; | ||
let arg; | ||
var i = 0; | ||
keys.forEach(function (key) { | ||
var field = _definitions.NODE_FIELDS[type][key]; | ||
var arg; | ||
if (i < countArgs) arg = args[i]; | ||
@@ -47,3 +51,3 @@ if (arg === undefined) arg = (0, _clone().default)(field.default); | ||
for (const key in node) { | ||
for (var key in node) { | ||
(0, _validate.default)(node, key, node[key]); | ||
@@ -50,0 +54,0 @@ } |
@@ -15,3 +15,3 @@ "use strict"; | ||
function createUnionTypeAnnotation(types) { | ||
const flattened = (0, _removeTypeDuplicates.default)(types); | ||
var flattened = (0, _removeTypeDuplicates.default)(types); | ||
@@ -18,0 +18,0 @@ if (flattened.length === 1) { |
@@ -15,6 +15,6 @@ "use strict"; | ||
function buildChildren(node) { | ||
const elements = []; | ||
var elements = []; | ||
for (let i = 0; i < node.children.length; i++) { | ||
let child = node.children[i]; | ||
for (var i = 0; i < node.children.length; i++) { | ||
var child = node.children[i]; | ||
@@ -21,0 +21,0 @@ if ((0, _generated.isJSXText)(child)) { |
@@ -10,3 +10,3 @@ "use strict"; | ||
const has = Function.call.bind(Object.prototype.hasOwnProperty); | ||
var has = Function.call.bind(Object.prototype.hasOwnProperty); | ||
@@ -23,3 +23,5 @@ function cloneIfNode(obj, deep) { | ||
if (Array.isArray(obj)) { | ||
return obj.map(node => cloneIfNode(node, deep)); | ||
return obj.map(function (node) { | ||
return cloneIfNode(node, deep); | ||
}); | ||
} | ||
@@ -30,9 +32,11 @@ | ||
function cloneNode(node, deep = true) { | ||
function cloneNode(node, deep) { | ||
if (deep === void 0) { | ||
deep = true; | ||
} | ||
if (!node) return node; | ||
const { | ||
type | ||
} = node; | ||
const newNode = { | ||
type | ||
var type = node.type; | ||
var newNode = { | ||
type: type | ||
}; | ||
@@ -43,5 +47,9 @@ | ||
} else if (!has(_definitions.NODE_FIELDS, type)) { | ||
throw new Error(`Unknown node type: "${type}"`); | ||
throw new Error("Unknown node type: \"" + type + "\""); | ||
} else { | ||
for (const field of Object.keys(_definitions.NODE_FIELDS[type])) { | ||
var _arr = Object.keys(_definitions.NODE_FIELDS[type]); | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var field = _arr[_i]; | ||
if (has(node, field)) { | ||
@@ -48,0 +56,0 @@ newNode[field] = deep ? cloneIfNodeOrArray(node[field], true) : node[field]; |
@@ -13,5 +13,5 @@ "use strict"; | ||
function cloneWithoutLoc(node) { | ||
const newNode = (0, _clone.default)(node); | ||
var newNode = (0, _clone.default)(node); | ||
newNode.loc = null; | ||
return newNode; | ||
} |
@@ -10,3 +10,3 @@ "use strict"; | ||
if (!comments || !node) return node; | ||
const key = `${type}Comments`; | ||
var key = type + "Comments"; | ||
@@ -13,0 +13,0 @@ if (node[key]) { |
@@ -11,3 +11,3 @@ "use strict"; | ||
function removeComments(node) { | ||
_constants.COMMENT_KEYS.forEach(key => { | ||
_constants.COMMENT_KEYS.forEach(function (key) { | ||
node[key] = null; | ||
@@ -14,0 +14,0 @@ }); |
@@ -10,83 +10,83 @@ "use strict"; | ||
const EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"]; | ||
var EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"]; | ||
exports.EXPRESSION_TYPES = EXPRESSION_TYPES; | ||
const BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"]; | ||
var BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"]; | ||
exports.BINARY_TYPES = BINARY_TYPES; | ||
const SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"]; | ||
var SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"]; | ||
exports.SCOPABLE_TYPES = SCOPABLE_TYPES; | ||
const BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"]; | ||
var BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"]; | ||
exports.BLOCKPARENT_TYPES = BLOCKPARENT_TYPES; | ||
const BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"]; | ||
var BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"]; | ||
exports.BLOCK_TYPES = BLOCK_TYPES; | ||
const STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"]; | ||
var STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"]; | ||
exports.STATEMENT_TYPES = STATEMENT_TYPES; | ||
const TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"]; | ||
var TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"]; | ||
exports.TERMINATORLESS_TYPES = TERMINATORLESS_TYPES; | ||
const COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"]; | ||
var COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"]; | ||
exports.COMPLETIONSTATEMENT_TYPES = COMPLETIONSTATEMENT_TYPES; | ||
const CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"]; | ||
var CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"]; | ||
exports.CONDITIONAL_TYPES = CONDITIONAL_TYPES; | ||
const LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"]; | ||
var LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"]; | ||
exports.LOOP_TYPES = LOOP_TYPES; | ||
const WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"]; | ||
var WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"]; | ||
exports.WHILE_TYPES = WHILE_TYPES; | ||
const EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"]; | ||
var EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"]; | ||
exports.EXPRESSIONWRAPPER_TYPES = EXPRESSIONWRAPPER_TYPES; | ||
const FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"]; | ||
var FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"]; | ||
exports.FOR_TYPES = FOR_TYPES; | ||
const FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"]; | ||
var FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"]; | ||
exports.FORXSTATEMENT_TYPES = FORXSTATEMENT_TYPES; | ||
const FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"]; | ||
var FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"]; | ||
exports.FUNCTION_TYPES = FUNCTION_TYPES; | ||
const FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"]; | ||
var FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"]; | ||
exports.FUNCTIONPARENT_TYPES = FUNCTIONPARENT_TYPES; | ||
const PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"]; | ||
var PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"]; | ||
exports.PUREISH_TYPES = PUREISH_TYPES; | ||
const DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"]; | ||
var DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"]; | ||
exports.DECLARATION_TYPES = DECLARATION_TYPES; | ||
const PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"]; | ||
var PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"]; | ||
exports.PATTERNLIKE_TYPES = PATTERNLIKE_TYPES; | ||
const LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"]; | ||
var LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"]; | ||
exports.LVAL_TYPES = LVAL_TYPES; | ||
const TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"]; | ||
var TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"]; | ||
exports.TSENTITYNAME_TYPES = TSENTITYNAME_TYPES; | ||
const LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"]; | ||
var LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"]; | ||
exports.LITERAL_TYPES = LITERAL_TYPES; | ||
const IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"]; | ||
var IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"]; | ||
exports.IMMUTABLE_TYPES = IMMUTABLE_TYPES; | ||
const USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"]; | ||
var USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"]; | ||
exports.USERWHITESPACABLE_TYPES = USERWHITESPACABLE_TYPES; | ||
const METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"]; | ||
var METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"]; | ||
exports.METHOD_TYPES = METHOD_TYPES; | ||
const OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"]; | ||
var OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"]; | ||
exports.OBJECTMEMBER_TYPES = OBJECTMEMBER_TYPES; | ||
const PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"]; | ||
var PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"]; | ||
exports.PROPERTY_TYPES = PROPERTY_TYPES; | ||
const UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"]; | ||
var UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"]; | ||
exports.UNARYLIKE_TYPES = UNARYLIKE_TYPES; | ||
const PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"]; | ||
var PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"]; | ||
exports.PATTERN_TYPES = PATTERN_TYPES; | ||
const CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"]; | ||
var CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"]; | ||
exports.CLASS_TYPES = CLASS_TYPES; | ||
const MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"]; | ||
var MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"]; | ||
exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES; | ||
const EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"]; | ||
var EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"]; | ||
exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES; | ||
const MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"]; | ||
var MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"]; | ||
exports.MODULESPECIFIER_TYPES = MODULESPECIFIER_TYPES; | ||
const FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"]; | ||
var FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"]; | ||
exports.FLOW_TYPES = FLOW_TYPES; | ||
const FLOWTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowType"]; | ||
var FLOWTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowType"]; | ||
exports.FLOWTYPE_TYPES = FLOWTYPE_TYPES; | ||
const FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; | ||
var FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; | ||
exports.FLOWBASEANNOTATION_TYPES = FLOWBASEANNOTATION_TYPES; | ||
const FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"]; | ||
var FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"]; | ||
exports.FLOWDECLARATION_TYPES = FLOWDECLARATION_TYPES; | ||
const FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"]; | ||
var FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"]; | ||
exports.FLOWPREDICATE_TYPES = FLOWPREDICATE_TYPES; | ||
const JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"]; | ||
var JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"]; | ||
exports.JSX_TYPES = JSX_TYPES; | ||
const TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"]; | ||
var TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"]; | ||
exports.TSTYPEELEMENT_TYPES = TSTYPEELEMENT_TYPES; | ||
const TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"]; | ||
var TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"]; | ||
exports.TSTYPE_TYPES = TSTYPE_TYPES; |
@@ -7,35 +7,35 @@ "use strict"; | ||
exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = void 0; | ||
const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; | ||
var STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; | ||
exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS; | ||
const FLATTENABLE_KEYS = ["body", "expressions"]; | ||
var FLATTENABLE_KEYS = ["body", "expressions"]; | ||
exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS; | ||
const FOR_INIT_KEYS = ["left", "init"]; | ||
var FOR_INIT_KEYS = ["left", "init"]; | ||
exports.FOR_INIT_KEYS = FOR_INIT_KEYS; | ||
const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; | ||
var COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; | ||
exports.COMMENT_KEYS = COMMENT_KEYS; | ||
const LOGICAL_OPERATORS = ["||", "&&", "??"]; | ||
var LOGICAL_OPERATORS = ["||", "&&", "??"]; | ||
exports.LOGICAL_OPERATORS = LOGICAL_OPERATORS; | ||
const UPDATE_OPERATORS = ["++", "--"]; | ||
var UPDATE_OPERATORS = ["++", "--"]; | ||
exports.UPDATE_OPERATORS = UPDATE_OPERATORS; | ||
const BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; | ||
var BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; | ||
exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS; | ||
const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; | ||
var EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; | ||
exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS; | ||
const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"]; | ||
var COMPARISON_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS.concat(["in", "instanceof"]); | ||
exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS; | ||
const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS]; | ||
var BOOLEAN_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS.concat(BOOLEAN_NUMBER_BINARY_OPERATORS); | ||
exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS; | ||
const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; | ||
var NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; | ||
exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS; | ||
const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS]; | ||
var BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS); | ||
exports.BINARY_OPERATORS = BINARY_OPERATORS; | ||
const BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; | ||
var BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; | ||
exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS; | ||
const NUMBER_UNARY_OPERATORS = ["+", "-", "~"]; | ||
var NUMBER_UNARY_OPERATORS = ["+", "-", "~"]; | ||
exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS; | ||
const STRING_UNARY_OPERATORS = ["typeof"]; | ||
var STRING_UNARY_OPERATORS = ["typeof"]; | ||
exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS; | ||
const UNARY_OPERATORS = ["void", "throw", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS]; | ||
var UNARY_OPERATORS = ["void", "throw"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS); | ||
exports.UNARY_OPERATORS = UNARY_OPERATORS; | ||
const INHERIT_KEYS = { | ||
var INHERIT_KEYS = { | ||
optional: ["typeAnnotation", "typeParameters", "returnType"], | ||
@@ -45,5 +45,5 @@ force: ["start", "loc", "end"] | ||
exports.INHERIT_KEYS = INHERIT_KEYS; | ||
const BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); | ||
var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); | ||
exports.BLOCK_SCOPED_SYMBOL = BLOCK_SCOPED_SYMBOL; | ||
const NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); | ||
var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); | ||
exports.NOT_LOCAL_BINDING = NOT_LOCAL_BINDING; |
@@ -12,4 +12,8 @@ "use strict"; | ||
function ensureBlock(node, key = "body") { | ||
function ensureBlock(node, key) { | ||
if (key === void 0) { | ||
key = "body"; | ||
} | ||
return node[key] = (0, _toBlock.default)(node[key], node); | ||
} |
@@ -19,6 +19,18 @@ "use strict"; | ||
function gatherSequenceExpressions(nodes, scope, declars) { | ||
const exprs = []; | ||
let ensureLastUndefined = true; | ||
var exprs = []; | ||
var ensureLastUndefined = true; | ||
for (const node of nodes) { | ||
for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var node = _ref; | ||
ensureLastUndefined = false; | ||
@@ -32,7 +44,9 @@ | ||
if (node.kind !== "var") return; | ||
var _arr = node.declarations; | ||
for (const declar of node.declarations) { | ||
const bindings = (0, _getBindingIdentifiers.default)(declar); | ||
for (var _i2 = 0; _i2 < _arr.length; _i2++) { | ||
var declar = _arr[_i2]; | ||
var bindings = (0, _getBindingIdentifiers.default)(declar); | ||
for (const key in bindings) { | ||
for (var key in bindings) { | ||
declars.push({ | ||
@@ -51,8 +65,8 @@ kind: node.kind, | ||
} else if ((0, _generated.isIfStatement)(node)) { | ||
const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode(); | ||
const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode(); | ||
var consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode(); | ||
var alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode(); | ||
if (!consequent || !alternate) return; | ||
exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate)); | ||
} else if ((0, _generated.isBlockStatement)(node)) { | ||
const body = gatherSequenceExpressions(node.body, scope, declars); | ||
var body = gatherSequenceExpressions(node.body, scope, declars); | ||
if (!body) return; | ||
@@ -59,0 +73,0 @@ exprs.push(body); |
@@ -17,3 +17,3 @@ "use strict"; | ||
let blockNodes = []; | ||
var blockNodes = []; | ||
@@ -20,0 +20,0 @@ if ((0, _generated.isEmptyStatement)(node)) { |
@@ -12,5 +12,9 @@ "use strict"; | ||
function toComputedKey(node, key = node.key || node.property) { | ||
function toComputedKey(node, key) { | ||
if (key === void 0) { | ||
key = node.key || node.property; | ||
} | ||
if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name); | ||
return key; | ||
} |
@@ -26,3 +26,3 @@ "use strict"; | ||
if (!(0, _generated.isExpression)(node)) { | ||
throw new Error(`cannot turn ${node.type} to an expression`); | ||
throw new Error("cannot turn " + node.type + " to an expression"); | ||
} | ||
@@ -29,0 +29,0 @@ |
@@ -21,3 +21,3 @@ "use strict"; | ||
if (!(0, _isValidIdentifier.default)(name)) { | ||
name = `_${name}`; | ||
name = "_" + name; | ||
} | ||
@@ -24,0 +24,0 @@ |
@@ -16,5 +16,9 @@ "use strict"; | ||
function toKeyAlias(node, key = node.key) { | ||
let alias; | ||
function toKeyAlias(node, key) { | ||
if (key === void 0) { | ||
key = node.key; | ||
} | ||
var alias; | ||
if (node.kind === "method") { | ||
@@ -31,7 +35,7 @@ return toKeyAlias.increment() + ""; | ||
if (node.computed) { | ||
alias = `[${alias}]`; | ||
alias = "[" + alias + "]"; | ||
} | ||
if (node.static) { | ||
alias = `static:${alias}`; | ||
alias = "static:" + alias; | ||
} | ||
@@ -38,0 +42,0 @@ |
@@ -14,7 +14,8 @@ "use strict"; | ||
if (!nodes || !nodes.length) return; | ||
const declars = []; | ||
const result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars); | ||
var declars = []; | ||
var result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars); | ||
if (!result) return; | ||
for (const declar of declars) { | ||
for (var _i = 0; _i < declars.length; _i++) { | ||
var declar = declars[_i]; | ||
scope.push(declar); | ||
@@ -21,0 +22,0 @@ } |
@@ -17,4 +17,4 @@ "use strict"; | ||
let mustHaveId = false; | ||
let newType; | ||
var mustHaveId = false; | ||
var newType; | ||
@@ -39,3 +39,3 @@ if ((0, _generated.isClass)(node)) { | ||
} else { | ||
throw new Error(`cannot turn ${node.type} to a statement`); | ||
throw new Error("cannot turn " + node.type + " to a statement"); | ||
} | ||
@@ -42,0 +42,0 @@ } |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _isPlainObject() { | ||
const data = _interopRequireDefault(require("lodash/isPlainObject")); | ||
var data = _interopRequireDefault(require("lodash/isPlainObject")); | ||
_isPlainObject = function () { | ||
_isPlainObject = function _isPlainObject() { | ||
return data; | ||
@@ -20,5 +20,5 @@ }; | ||
function _isRegExp() { | ||
const data = _interopRequireDefault(require("lodash/isRegExp")); | ||
var data = _interopRequireDefault(require("lodash/isRegExp")); | ||
_isRegExp = function () { | ||
_isRegExp = function _isRegExp() { | ||
return data; | ||
@@ -58,4 +58,4 @@ }; | ||
if ((0, _isRegExp().default)(value)) { | ||
const pattern = value.source; | ||
const flags = value.toString().match(/\/([a-z]+|)$/)[1]; | ||
var pattern = value.source; | ||
var flags = value.toString().match(/\/([a-z]+|)$/)[1]; | ||
return (0, _generated.regExpLiteral)(pattern, flags); | ||
@@ -69,6 +69,6 @@ } | ||
if ((0, _isPlainObject().default)(value)) { | ||
const props = []; | ||
var props = []; | ||
for (const key in value) { | ||
let nodeKey; | ||
for (var key in value) { | ||
var nodeKey = void 0; | ||
@@ -75,0 +75,0 @@ if ((0, _isValidIdentifier.default)(key)) { |
@@ -52,3 +52,3 @@ "use strict"; | ||
operator: { | ||
validate: (0, _utils.assertOneOf)(..._constants.BINARY_OPERATORS) | ||
validate: _utils.assertOneOf.apply(void 0, _constants.BINARY_OPERATORS) | ||
}, | ||
@@ -236,3 +236,3 @@ left: { | ||
}); | ||
const functionCommon = { | ||
var functionCommon = { | ||
params: { | ||
@@ -251,3 +251,3 @@ validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("LVal"))) | ||
exports.functionCommon = functionCommon; | ||
const functionTypeAnnotationCommon = { | ||
var functionTypeAnnotationCommon = { | ||
returnType: { | ||
@@ -264,3 +264,3 @@ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), | ||
const functionDeclarationCommon = _objectSpread({}, functionCommon, { | ||
var functionDeclarationCommon = _objectSpread({}, functionCommon, { | ||
declare: { | ||
@@ -300,3 +300,3 @@ validate: (0, _utils.assertValueType)("boolean"), | ||
}); | ||
const patternLikeCommon = { | ||
var patternLikeCommon = { | ||
typeAnnotation: { | ||
@@ -406,3 +406,3 @@ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), | ||
operator: { | ||
validate: (0, _utils.assertOneOf)(..._constants.LOGICAL_OPERATORS) | ||
validate: _utils.assertOneOf.apply(void 0, _constants.LOGICAL_OPERATORS) | ||
}, | ||
@@ -427,6 +427,6 @@ left: { | ||
validate: function () { | ||
const normal = (0, _utils.assertNodeType)("Identifier"); | ||
const computed = (0, _utils.assertNodeType)("Expression"); | ||
var normal = (0, _utils.assertNodeType)("Identifier"); | ||
var computed = (0, _utils.assertNodeType)("Expression"); | ||
return function (node, key, val) { | ||
const validator = node.computed ? computed : normal; | ||
var validator = node.computed ? computed : normal; | ||
validator(node, key, val); | ||
@@ -491,6 +491,6 @@ }; | ||
validate: function () { | ||
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); | ||
const computed = (0, _utils.assertNodeType)("Expression"); | ||
var normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); | ||
var computed = (0, _utils.assertNodeType)("Expression"); | ||
return function (node, key, val) { | ||
const validator = node.computed ? computed : normal; | ||
var validator = node.computed ? computed : normal; | ||
validator(node, key, val); | ||
@@ -519,6 +519,6 @@ }; | ||
validate: function () { | ||
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); | ||
const computed = (0, _utils.assertNodeType)("Expression"); | ||
var normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); | ||
var computed = (0, _utils.assertNodeType)("Expression"); | ||
return function (node, key, val) { | ||
const validator = node.computed ? computed : normal; | ||
var validator = node.computed ? computed : normal; | ||
validator(node, key, val); | ||
@@ -636,3 +636,3 @@ }; | ||
operator: { | ||
validate: (0, _utils.assertOneOf)(..._constants.UNARY_OPERATORS) | ||
validate: _utils.assertOneOf.apply(void 0, _constants.UNARY_OPERATORS) | ||
} | ||
@@ -653,3 +653,3 @@ }, | ||
operator: { | ||
validate: (0, _utils.assertOneOf)(..._constants.UPDATE_OPERATORS) | ||
validate: _utils.assertOneOf.apply(void 0, _constants.UPDATE_OPERATORS) | ||
} | ||
@@ -656,0 +656,0 @@ }, |
@@ -68,3 +68,3 @@ "use strict"; | ||
}); | ||
const classCommon = { | ||
var classCommon = { | ||
typeParameters: { | ||
@@ -257,3 +257,3 @@ validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), | ||
}); | ||
const classMethodOrPropertyCommon = { | ||
var classMethodOrPropertyCommon = { | ||
abstract: { | ||
@@ -281,6 +281,6 @@ validate: (0, _utils.assertValueType)("boolean"), | ||
validate: (0, _utils.chain)(function () { | ||
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); | ||
const computed = (0, _utils.assertNodeType)("Expression"); | ||
var normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); | ||
var computed = (0, _utils.assertNodeType)("Expression"); | ||
return function (node, key, val) { | ||
const validator = node.computed ? computed : normal; | ||
var validator = node.computed ? computed : normal; | ||
validator(node, key, val); | ||
@@ -293,3 +293,3 @@ }; | ||
const classMethodOrDeclareMethodCommon = _objectSpread({}, _core.functionCommon, classMethodOrPropertyCommon, { | ||
var classMethodOrDeclareMethodCommon = _objectSpread({}, _core.functionCommon, classMethodOrPropertyCommon, { | ||
kind: { | ||
@@ -296,0 +296,0 @@ validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("get", "set", "method", "constructor")), |
@@ -65,6 +65,6 @@ "use strict"; | ||
validate: function () { | ||
const normal = (0, _utils.assertNodeType)("Identifier"); | ||
const computed = (0, _utils.assertNodeType)("Expression"); | ||
var normal = (0, _utils.assertNodeType)("Identifier"); | ||
var computed = (0, _utils.assertNodeType)("Expression"); | ||
return function (node, key, val) { | ||
const validator = node.computed ? computed : normal; | ||
var validator = node.computed ? computed : normal; | ||
validator(node, key, val); | ||
@@ -71,0 +71,0 @@ }; |
@@ -8,3 +8,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _utils.VISITOR_KEYS; | ||
@@ -15,3 +15,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _utils.ALIAS_KEYS; | ||
@@ -22,3 +22,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _utils.FLIPPED_ALIAS_KEYS; | ||
@@ -29,3 +29,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _utils.NODE_FIELDS; | ||
@@ -36,3 +36,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _utils.BUILDER_KEYS; | ||
@@ -43,3 +43,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _utils.DEPRECATED_KEYS; | ||
@@ -51,5 +51,5 @@ } | ||
function _toFastProperties() { | ||
const data = _interopRequireDefault(require("to-fast-properties")); | ||
var data = _interopRequireDefault(require("to-fast-properties")); | ||
_toFastProperties = function () { | ||
_toFastProperties = function _toFastProperties() { | ||
return data; | ||
@@ -85,3 +85,3 @@ }; | ||
(0, _toFastProperties().default)(_utils.DEPRECATED_KEYS); | ||
const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS)); | ||
var TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS)); | ||
exports.TYPES = TYPES; |
@@ -15,4 +15,4 @@ "use strict"; | ||
const bool = (0, _utils.assertValueType)("boolean"); | ||
const tSFunctionTypeAnnotationCommon = { | ||
var bool = (0, _utils.assertValueType)("boolean"); | ||
var tSFunctionTypeAnnotationCommon = { | ||
returnType: { | ||
@@ -61,3 +61,3 @@ validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"), | ||
}); | ||
const signatureDeclarationCommon = { | ||
var signatureDeclarationCommon = { | ||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), | ||
@@ -67,3 +67,3 @@ parameters: (0, _utils.validateArrayOfType)(["Identifier", "RestElement"]), | ||
}; | ||
const callConstructSignatureDeclaration = { | ||
var callConstructSignatureDeclaration = { | ||
aliases: ["TSTypeElement"], | ||
@@ -75,3 +75,3 @@ visitor: ["typeParameters", "parameters", "typeAnnotation"], | ||
(0, _utils.default)("TSConstructSignatureDeclaration", callConstructSignatureDeclaration); | ||
const namedTypeElementCommon = { | ||
var namedTypeElementCommon = { | ||
key: (0, _utils.validateType)("Expression"), | ||
@@ -104,5 +104,6 @@ computed: (0, _utils.validate)(bool), | ||
}); | ||
const tsKeywordTypes = ["TSAnyKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSBooleanKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSVoidKeyword", "TSUndefinedKeyword", "TSNullKeyword", "TSNeverKeyword"]; | ||
var tsKeywordTypes = ["TSAnyKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSBooleanKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSVoidKeyword", "TSUndefinedKeyword", "TSNullKeyword", "TSNeverKeyword"]; | ||
for (const type of tsKeywordTypes) { | ||
for (var _i = 0; _i < tsKeywordTypes.length; _i++) { | ||
var type = tsKeywordTypes[_i]; | ||
(0, _utils.default)(type, { | ||
@@ -120,3 +121,3 @@ aliases: ["TSType"], | ||
}); | ||
const fnOrCtr = { | ||
var fnOrCtr = { | ||
aliases: ["TSType"], | ||
@@ -172,3 +173,3 @@ visitor: ["typeParameters", "typeAnnotation"], | ||
}); | ||
const unionOrIntersection = { | ||
var unionOrIntersection = { | ||
aliases: ["TSType"], | ||
@@ -175,0 +176,0 @@ visitor: ["types"], |
@@ -27,13 +27,13 @@ "use strict"; | ||
const VISITOR_KEYS = {}; | ||
var VISITOR_KEYS = {}; | ||
exports.VISITOR_KEYS = VISITOR_KEYS; | ||
const ALIAS_KEYS = {}; | ||
var ALIAS_KEYS = {}; | ||
exports.ALIAS_KEYS = ALIAS_KEYS; | ||
const FLIPPED_ALIAS_KEYS = {}; | ||
var FLIPPED_ALIAS_KEYS = {}; | ||
exports.FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS; | ||
const NODE_FIELDS = {}; | ||
var NODE_FIELDS = {}; | ||
exports.NODE_FIELDS = NODE_FIELDS; | ||
const BUILDER_KEYS = {}; | ||
var BUILDER_KEYS = {}; | ||
exports.BUILDER_KEYS = BUILDER_KEYS; | ||
const DEPRECATED_KEYS = {}; | ||
var DEPRECATED_KEYS = {}; | ||
exports.DEPRECATED_KEYS = DEPRECATED_KEYS; | ||
@@ -55,3 +55,3 @@ | ||
return { | ||
validate | ||
validate: validate | ||
}; | ||
@@ -61,3 +61,3 @@ } | ||
function typeIs(typeName) { | ||
return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName); | ||
return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType.apply(void 0, typeName); | ||
} | ||
@@ -71,3 +71,3 @@ | ||
return { | ||
validate, | ||
validate: validate, | ||
optional: true | ||
@@ -100,4 +100,4 @@ }; | ||
for (let i = 0; i < val.length; i++) { | ||
callback(node, `${key}[${i}]`, val[i]); | ||
for (var i = 0; i < val.length; i++) { | ||
callback(node, key + "[" + i + "]", val[i]); | ||
} | ||
@@ -110,6 +110,10 @@ } | ||
function assertOneOf(...values) { | ||
function assertOneOf() { | ||
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { | ||
values[_key] = arguments[_key]; | ||
} | ||
function validate(node, key, val) { | ||
if (values.indexOf(val) < 0) { | ||
throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`); | ||
throw new TypeError("Property " + key + " expected value to be one of " + JSON.stringify(values) + " but got " + JSON.stringify(val)); | ||
} | ||
@@ -122,7 +126,13 @@ } | ||
function assertNodeType(...types) { | ||
function assertNodeType() { | ||
for (var _len2 = arguments.length, types = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
types[_key2] = arguments[_key2]; | ||
} | ||
function validate(node, key, val) { | ||
let valid = false; | ||
var valid = false; | ||
for (const type of types) { | ||
for (var _i = 0; _i < types.length; _i++) { | ||
var type = types[_i]; | ||
if ((0, _is.default)(type, val)) { | ||
@@ -135,3 +145,3 @@ valid = true; | ||
if (!valid) { | ||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`); | ||
throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + JSON.stringify(types) + " " + ("but instead got " + JSON.stringify(val && val.type))); | ||
} | ||
@@ -144,7 +154,13 @@ } | ||
function assertNodeOrValueType(...types) { | ||
function assertNodeOrValueType() { | ||
for (var _len3 = arguments.length, types = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
types[_key3] = arguments[_key3]; | ||
} | ||
function validate(node, key, val) { | ||
let valid = false; | ||
var valid = false; | ||
for (const type of types) { | ||
for (var _i2 = 0; _i2 < types.length; _i2++) { | ||
var type = types[_i2]; | ||
if (getType(val) === type || (0, _is.default)(type, val)) { | ||
@@ -157,3 +173,3 @@ valid = true; | ||
if (!valid) { | ||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`); | ||
throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + JSON.stringify(types) + " " + ("but instead got " + JSON.stringify(val && val.type))); | ||
} | ||
@@ -168,6 +184,6 @@ } | ||
function validate(node, key, val) { | ||
const valid = getType(val) === type; | ||
var valid = getType(val) === type; | ||
if (!valid) { | ||
throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); | ||
throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType(val)); | ||
} | ||
@@ -180,6 +196,11 @@ } | ||
function chain(...fns) { | ||
function validate(...args) { | ||
for (const fn of fns) { | ||
fn(...args); | ||
function chain() { | ||
for (var _len4 = arguments.length, fns = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
fns[_key4] = arguments[_key4]; | ||
} | ||
function validate() { | ||
for (var _i3 = 0; _i3 < fns.length; _i3++) { | ||
var fn = fns[_i3]; | ||
fn.apply(void 0, arguments); | ||
} | ||
@@ -192,9 +213,13 @@ } | ||
function defineType(type, opts = {}) { | ||
const inherits = opts.inherits && store[opts.inherits] || {}; | ||
const fields = opts.fields || inherits.fields || {}; | ||
const visitor = opts.visitor || inherits.visitor || []; | ||
const aliases = opts.aliases || inherits.aliases || []; | ||
const builder = opts.builder || inherits.builder || opts.visitor || []; | ||
function defineType(type, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
var inherits = opts.inherits && store[opts.inherits] || {}; | ||
var fields = opts.fields || inherits.fields || {}; | ||
var visitor = opts.visitor || inherits.visitor || []; | ||
var aliases = opts.aliases || inherits.aliases || []; | ||
var builder = opts.builder || inherits.builder || opts.visitor || []; | ||
if (opts.deprecatedAlias) { | ||
@@ -204,8 +229,11 @@ DEPRECATED_KEYS[opts.deprecatedAlias] = type; | ||
for (const key of visitor.concat(builder)) { | ||
fields[key] = fields[key] || {}; | ||
var _arr = visitor.concat(builder); | ||
for (var _i4 = 0; _i4 < _arr.length; _i4++) { | ||
var _key5 = _arr[_i4]; | ||
fields[_key5] = fields[_key5] || {}; | ||
} | ||
for (const key in fields) { | ||
const field = fields[key]; | ||
for (var key in fields) { | ||
var field = fields[key]; | ||
@@ -227,3 +255,3 @@ if (builder.indexOf(key) === -1) { | ||
ALIAS_KEYS[type] = opts.aliases = aliases; | ||
aliases.forEach(alias => { | ||
aliases.forEach(function (alias) { | ||
FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || []; | ||
@@ -235,2 +263,2 @@ FLIPPED_ALIAS_KEYS[alias].push(type); | ||
const store = {}; | ||
var store = {}; |
118
lib/index.js
@@ -63,3 +63,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _assertNode.default; | ||
@@ -70,3 +70,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _createTypeAnnotationBasedOnTypeof.default; | ||
@@ -77,3 +77,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _createUnionTypeAnnotation.default; | ||
@@ -84,3 +84,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _cloneNode.default; | ||
@@ -91,3 +91,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _clone.default; | ||
@@ -98,3 +98,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _cloneDeep.default; | ||
@@ -105,3 +105,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _cloneWithoutLoc.default; | ||
@@ -112,3 +112,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _addComment.default; | ||
@@ -119,3 +119,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _addComments.default; | ||
@@ -126,3 +126,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _inheritInnerComments.default; | ||
@@ -133,3 +133,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _inheritLeadingComments.default; | ||
@@ -140,3 +140,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _inheritsComments.default; | ||
@@ -147,3 +147,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _inheritTrailingComments.default; | ||
@@ -154,3 +154,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _removeComments.default; | ||
@@ -161,3 +161,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _ensureBlock.default; | ||
@@ -168,3 +168,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toBindingIdentifierName.default; | ||
@@ -175,3 +175,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toBlock.default; | ||
@@ -182,3 +182,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toComputedKey.default; | ||
@@ -189,3 +189,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toExpression.default; | ||
@@ -196,3 +196,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toIdentifier.default; | ||
@@ -203,3 +203,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toKeyAlias.default; | ||
@@ -210,3 +210,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toSequenceExpression.default; | ||
@@ -217,3 +217,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _toStatement.default; | ||
@@ -224,3 +224,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _valueToNode.default; | ||
@@ -231,3 +231,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _appendToMemberExpression.default; | ||
@@ -238,3 +238,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _inherits.default; | ||
@@ -245,3 +245,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _prependToMemberExpression.default; | ||
@@ -252,3 +252,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _removeProperties.default; | ||
@@ -259,3 +259,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _removePropertiesDeep.default; | ||
@@ -266,3 +266,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _removeTypeDuplicates.default; | ||
@@ -273,3 +273,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _getBindingIdentifiers.default; | ||
@@ -280,3 +280,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _getOuterBindingIdentifiers.default; | ||
@@ -287,3 +287,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _traverse.default; | ||
@@ -294,3 +294,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _traverseFast.default; | ||
@@ -301,3 +301,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _shallowEqual.default; | ||
@@ -308,3 +308,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _is.default; | ||
@@ -315,3 +315,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isBinding.default; | ||
@@ -322,3 +322,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isBlockScoped.default; | ||
@@ -329,3 +329,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isImmutable.default; | ||
@@ -336,3 +336,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isLet.default; | ||
@@ -343,3 +343,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isNode.default; | ||
@@ -350,3 +350,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isNodesEquivalent.default; | ||
@@ -357,3 +357,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isReferenced.default; | ||
@@ -364,3 +364,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isScope.default; | ||
@@ -371,3 +371,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isSpecifierDefault.default; | ||
@@ -378,3 +378,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isType.default; | ||
@@ -385,3 +385,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isValidES3Identifier.default; | ||
@@ -392,3 +392,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isValidIdentifier.default; | ||
@@ -399,3 +399,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isVar.default; | ||
@@ -406,3 +406,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _matchesPattern.default; | ||
@@ -413,3 +413,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _validate.default; | ||
@@ -420,3 +420,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _buildMatchMemberExpression.default; | ||
@@ -442,3 +442,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _generated[key]; | ||
@@ -460,3 +460,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _generated2[key]; | ||
@@ -496,3 +496,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _generated3[key]; | ||
@@ -510,3 +510,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _constants[key]; | ||
@@ -544,3 +544,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _definitions[key]; | ||
@@ -614,3 +614,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _generated4[key]; | ||
@@ -623,3 +623,3 @@ } | ||
const react = { | ||
var react = { | ||
isReactComponent: _isReactComponent.default, | ||
@@ -626,0 +626,0 @@ isCompatTag: _isCompatTag.default, |
@@ -10,3 +10,7 @@ "use strict"; | ||
function appendToMemberExpression(member, append, computed = false) { | ||
function appendToMemberExpression(member, append, computed) { | ||
if (computed === void 0) { | ||
computed = false; | ||
} | ||
member.object = (0, _generated.memberExpression)(member.object, member.property, member.computed); | ||
@@ -13,0 +17,0 @@ member.property = append; |
@@ -11,9 +11,9 @@ "use strict"; | ||
function removeTypeDuplicates(nodes) { | ||
const generics = {}; | ||
const bases = {}; | ||
const typeGroups = []; | ||
const types = []; | ||
var generics = {}; | ||
var bases = {}; | ||
var typeGroups = []; | ||
var types = []; | ||
for (let i = 0; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
for (var i = 0; i < nodes.length; i++) { | ||
var node = nodes[i]; | ||
if (!node) continue; | ||
@@ -44,6 +44,6 @@ | ||
if ((0, _generated.isGenericTypeAnnotation)(node)) { | ||
const name = node.id.name; | ||
var name = node.id.name; | ||
if (generics[name]) { | ||
let existing = generics[name]; | ||
var existing = generics[name]; | ||
@@ -67,8 +67,8 @@ if (existing.typeParameters) { | ||
for (const type in bases) { | ||
for (var type in bases) { | ||
types.push(bases[type]); | ||
} | ||
for (const name in generics) { | ||
types.push(generics[name]); | ||
for (var _name in generics) { | ||
types.push(generics[_name]); | ||
} | ||
@@ -75,0 +75,0 @@ |
@@ -16,15 +16,21 @@ "use strict"; | ||
if (!child || !parent) return child; | ||
var _arr = _constants.INHERIT_KEYS.optional; | ||
for (const key of _constants.INHERIT_KEYS.optional) { | ||
if (child[key] == null) { | ||
child[key] = parent[key]; | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var _key = _arr[_i]; | ||
if (child[_key] == null) { | ||
child[_key] = parent[_key]; | ||
} | ||
} | ||
for (const key in parent) { | ||
for (var key in parent) { | ||
if (key[0] === "_" && key !== "__clone") child[key] = parent[key]; | ||
} | ||
for (const key of _constants.INHERIT_KEYS.force) { | ||
child[key] = parent[key]; | ||
var _arr2 = _constants.INHERIT_KEYS.force; | ||
for (var _i2 = 0; _i2 < _arr2.length; _i2++) { | ||
var _key2 = _arr2[_i2]; | ||
child[_key2] = parent[_key2]; | ||
} | ||
@@ -31,0 +37,0 @@ |
@@ -10,22 +10,50 @@ "use strict"; | ||
const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; | ||
var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; | ||
const CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); | ||
var CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); | ||
function removeProperties(node, opts = {}) { | ||
const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; | ||
function removeProperties(node, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
for (const key of map) { | ||
if (node[key] != null) node[key] = undefined; | ||
var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; | ||
for (var _iterator = map, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _key = _ref; | ||
if (node[_key] != null) node[_key] = undefined; | ||
} | ||
for (const key in node) { | ||
for (var key in node) { | ||
if (key[0] === "_" && node[key] != null) node[key] = undefined; | ||
} | ||
const symbols = Object.getOwnPropertySymbols(node); | ||
var symbols = Object.getOwnPropertySymbols(node); | ||
for (const sym of symbols) { | ||
for (var _iterator2 = symbols, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var sym = _ref2; | ||
node[sym] = null; | ||
} | ||
} |
@@ -11,13 +11,13 @@ "use strict"; | ||
function getBindingIdentifiers(node, duplicates, outerOnly) { | ||
let search = [].concat(node); | ||
const ids = Object.create(null); | ||
var search = [].concat(node); | ||
var ids = Object.create(null); | ||
while (search.length) { | ||
const id = search.shift(); | ||
var id = search.shift(); | ||
if (!id) continue; | ||
const keys = getBindingIdentifiers.keys[id.type]; | ||
var keys = getBindingIdentifiers.keys[id.type]; | ||
if ((0, _generated.isIdentifier)(id)) { | ||
if (duplicates) { | ||
const _ids = ids[id.name] = ids[id.name] || []; | ||
var _ids = ids[id.name] = ids[id.name] || []; | ||
@@ -52,4 +52,4 @@ _ids.push(id); | ||
if (keys) { | ||
for (let i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
@@ -56,0 +56,0 @@ if (id[key]) { |
@@ -17,6 +17,5 @@ "use strict"; | ||
const { | ||
enter, | ||
exit | ||
} = handlers; | ||
var _ref = handlers, | ||
enter = _ref.enter, | ||
exit = _ref.exit; | ||
traverseSimpleImpl(node, enter, exit, state, []); | ||
@@ -26,16 +25,28 @@ } | ||
function traverseSimpleImpl(node, enter, exit, state, ancestors) { | ||
const keys = _definitions.VISITOR_KEYS[node.type]; | ||
var keys = _definitions.VISITOR_KEYS[node.type]; | ||
if (!keys) return; | ||
if (enter) enter(node, ancestors, state); | ||
for (const key of keys) { | ||
const subNode = node[key]; | ||
for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref2 = _i.value; | ||
} | ||
var _key = _ref2; | ||
var subNode = node[_key]; | ||
if (Array.isArray(subNode)) { | ||
for (let i = 0; i < subNode.length; i++) { | ||
const child = subNode[i]; | ||
for (var i = 0; i < subNode.length; i++) { | ||
var child = subNode[i]; | ||
if (!child) continue; | ||
ancestors.push({ | ||
node, | ||
key, | ||
node: node, | ||
key: _key, | ||
index: i | ||
@@ -48,4 +59,4 @@ }); | ||
ancestors.push({ | ||
node, | ||
key | ||
node: node, | ||
key: _key | ||
}); | ||
@@ -52,0 +63,0 @@ traverseSimpleImpl(subNode, enter, exit, state, ancestors); |
@@ -12,3 +12,3 @@ "use strict"; | ||
if (!node) return; | ||
const keys = _definitions.VISITOR_KEYS[node.type]; | ||
var keys = _definitions.VISITOR_KEYS[node.type]; | ||
if (!keys) return; | ||
@@ -18,8 +18,32 @@ opts = opts || {}; | ||
for (const key of keys) { | ||
const subNode = node[key]; | ||
for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var key = _ref; | ||
var subNode = node[key]; | ||
if (Array.isArray(subNode)) { | ||
for (const node of subNode) { | ||
traverseFast(node, enter, opts); | ||
for (var _iterator2 = subNode, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var _node = _ref2; | ||
traverseFast(_node, enter, opts); | ||
} | ||
@@ -26,0 +50,0 @@ } else { |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _uniq() { | ||
const data = _interopRequireDefault(require("lodash/uniq")); | ||
var data = _interopRequireDefault(require("lodash/uniq")); | ||
_uniq = function () { | ||
_uniq = function _uniq() { | ||
return data; | ||
@@ -14,0 +14,0 @@ }; |
@@ -11,6 +11,6 @@ "use strict"; | ||
function cleanJSXElementLiteralChild(child, args) { | ||
const lines = child.value.split(/\r\n|\n|\r/); | ||
let lastNonEmptyLine = 0; | ||
var lines = child.value.split(/\r\n|\n|\r/); | ||
var lastNonEmptyLine = 0; | ||
for (let i = 0; i < lines.length; i++) { | ||
for (var i = 0; i < lines.length; i++) { | ||
if (lines[i].match(/[^ \t]/)) { | ||
@@ -21,10 +21,10 @@ lastNonEmptyLine = i; | ||
let str = ""; | ||
var str = ""; | ||
for (let i = 0; i < lines.length; i++) { | ||
const line = lines[i]; | ||
const isFirstLine = i === 0; | ||
const isLastLine = i === lines.length - 1; | ||
const isLastNonEmptyLine = i === lastNonEmptyLine; | ||
let trimmedLine = line.replace(/\t/g, " "); | ||
for (var _i = 0; _i < lines.length; _i++) { | ||
var line = lines[_i]; | ||
var isFirstLine = _i === 0; | ||
var isLastLine = _i === lines.length - 1; | ||
var isLastNonEmptyLine = _i === lastNonEmptyLine; | ||
var trimmedLine = line.replace(/\t/g, " "); | ||
@@ -31,0 +31,0 @@ if (!isFirstLine) { |
@@ -9,5 +9,8 @@ "use strict"; | ||
function shallowEqual(actual, expected) { | ||
const keys = Object.keys(expected); | ||
var keys = Object.keys(expected); | ||
var _arr = keys; | ||
for (const key of keys) { | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var key = _arr[_i]; | ||
if (actual[key] !== expected[key]) { | ||
@@ -14,0 +17,0 @@ return false; |
@@ -13,4 +13,6 @@ "use strict"; | ||
function buildMatchMemberExpression(match, allowPartial) { | ||
const parts = match.split("."); | ||
return member => (0, _matchesPattern.default)(member, parts, allowPartial); | ||
var parts = match.split("."); | ||
return function (member) { | ||
return (0, _matchesPattern.default)(member, parts, allowPartial); | ||
}; | ||
} |
@@ -16,3 +16,3 @@ "use strict"; | ||
if (!node) return false; | ||
const matches = (0, _isType.default)(node.type, type); | ||
var matches = (0, _isType.default)(node.type, type); | ||
if (!matches) return false; | ||
@@ -19,0 +19,0 @@ |
@@ -13,8 +13,8 @@ "use strict"; | ||
function isBinding(node, parent) { | ||
const keys = _getBindingIdentifiers.default.keys[parent.type]; | ||
var keys = _getBindingIdentifiers.default.keys[parent.type]; | ||
if (keys) { | ||
for (let i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const val = parent[key]; | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
var val = parent[key]; | ||
@@ -21,0 +21,0 @@ if (Array.isArray(val)) { |
@@ -19,5 +19,7 @@ "use strict"; | ||
const fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type); | ||
var fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type); | ||
for (const field of fields) { | ||
for (var _i = 0; _i < fields.length; _i++) { | ||
var field = fields[_i]; | ||
if (typeof a[field] !== typeof b[field]) { | ||
@@ -36,3 +38,3 @@ return false; | ||
for (let i = 0; i < a[field].length; i++) { | ||
for (var i = 0; i < a[field].length; i++) { | ||
if (!isNodesEquivalent(a[field][i], b[field][i])) { | ||
@@ -39,0 +41,0 @@ return false; |
@@ -37,3 +37,6 @@ "use strict"; | ||
case "FunctionExpression": | ||
for (const param of parent.params) { | ||
var _arr = parent.params; | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var param = _arr[_i]; | ||
if (param === node) return false; | ||
@@ -40,0 +43,0 @@ } |
@@ -13,3 +13,3 @@ "use strict"; | ||
if (_definitions.ALIAS_KEYS[targetType]) return false; | ||
const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType]; | ||
var aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType]; | ||
@@ -19,3 +19,15 @@ if (aliases) { | ||
for (const alias of aliases) { | ||
for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var alias = _ref; | ||
if (nodeType === alias) return true; | ||
@@ -22,0 +34,0 @@ } |
@@ -12,3 +12,3 @@ "use strict"; | ||
const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]); | ||
var RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]); | ||
@@ -15,0 +15,0 @@ function isValidES3Identifier(name) { |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _esutils() { | ||
const data = _interopRequireDefault(require("esutils")); | ||
var data = _interopRequireDefault(require("esutils")); | ||
_esutils = function () { | ||
_esutils = function _esutils() { | ||
return data; | ||
@@ -14,0 +14,0 @@ }; |
@@ -12,5 +12,5 @@ "use strict"; | ||
if (!(0, _generated.isMemberExpression)(member)) return false; | ||
const parts = Array.isArray(match) ? match : match.split("."); | ||
const nodes = []; | ||
let node; | ||
var parts = Array.isArray(match) ? match : match.split("."); | ||
var nodes = []; | ||
var node; | ||
@@ -25,10 +25,10 @@ for (node = member; (0, _generated.isMemberExpression)(node); node = node.object) { | ||
for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) { | ||
const node = nodes[j]; | ||
let value; | ||
for (var i = 0, j = nodes.length - 1; i < parts.length; i++, j--) { | ||
var _node = nodes[j]; | ||
var value = void 0; | ||
if ((0, _generated.isIdentifier)(node)) { | ||
value = node.name; | ||
} else if ((0, _generated.isStringLiteral)(node)) { | ||
value = node.value; | ||
if ((0, _generated.isIdentifier)(_node)) { | ||
value = _node.name; | ||
} else if ((0, _generated.isStringLiteral)(_node)) { | ||
value = _node.value; | ||
} else { | ||
@@ -35,0 +35,0 @@ return false; |
@@ -12,4 +12,4 @@ "use strict"; | ||
const isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component"); | ||
var isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component"); | ||
var _default = isReactComponent; | ||
exports.default = _default; |
@@ -12,5 +12,5 @@ "use strict"; | ||
if (!node) return; | ||
const fields = _definitions.NODE_FIELDS[node.type]; | ||
var fields = _definitions.NODE_FIELDS[node.type]; | ||
if (!fields) return; | ||
const field = fields[key]; | ||
var field = fields[key]; | ||
if (!field || !field.validate) return; | ||
@@ -17,0 +17,0 @@ if (field.optional && val == null) return; |
{ | ||
"name": "@babel/types", | ||
"version": "7.0.0-beta.43", | ||
"version": "7.0.0-beta.44", | ||
"description": "Babel Types is a Lodash-esque utility library for AST nodes", | ||
@@ -17,5 +17,5 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"devDependencies": { | ||
"@babel/generator": "7.0.0-beta.43", | ||
"babylon": "7.0.0-beta.43" | ||
"@babel/generator": "7.0.0-beta.44", | ||
"babylon": "7.0.0-beta.44" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
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
596455
10530