@babel/types APIs
- ObjectExpression
- Expression
- Identifier
- CallExpression
- Node
- ImportDeclaration
- ArrayExpression
- VariableDeclarator
- JSXElement
- File
- JSXAttribute
- ImportSpecifier
- Statement
- ObjectProperty
- JSXExpressionContainer
- JSXMemberExpression
- BlockStatement
- JSXIdentifier
- ObjectPattern
- isIdentifier
- identifier
- stringLiteral
- booleanLiteral
- isObjectProperty
- isMemberExpression
- StringLiteral
- ArrowFunctionExpression
- VariableDeclaration
- ImportDefaultSpecifier
- FunctionExpression
- jsxAttribute
- jsxIdentifier
- JSXFragment
- JSXSpreadChild
- JSXText
- expressionStatement
- Program
- BooleanLiteral
- JSXOpeningElement
- MemberExpression
- FunctionDeclaration
- PatternLike
- RestElement
- LVal
- SourceLocation
- SpreadElement
- file
- Comment
- isCallExpression
- isVariableDeclarator
- isLogicalExpression
- isReturnStatement
- conditionalExpression
- isAssignmentExpression
- isNumericLiteral
- arrayPattern
- jsxElement
- isStringLiteral
- isBooleanLiteral
- jsxExpressionContainer
- isExpression
- jsxOpeningElement
- jsxMemberExpression
- isObjectExpression
- jsxClosingElement
- jsxText
- isArrayPattern
- isExpressionStatement
- isFunctionExpression
- ExpressionStatement
- ImportNamespaceSpecifier
- ReturnStatement
- JSXNamespacedName
- JSX
- LogicalExpression
- AssignmentPattern
- objectProperty
- objectExpression
- arrayExpression
- objectPattern
- nullLiteral
- numericLiteral
- isAssignmentPattern
- isRestElement
- importDeclaration
- importSpecifier
- isTemplateLiteral
- callExpression
- isImportSpecifier
- isArrowFunctionExpression
- isTSTypeReference
- isTypeAnnotation
- isObjectPattern
- BinaryExpression
- UnaryExpression
- ArrayPattern
- CatchClause
- DoWhileStatement
- ForInStatement
- ForOfStatement
- ForStatement
- NewExpression
- SwitchCase
- TemplateLiteral
- WhileStatement
- program
- isJSXIdentifier
- isJSXMemberExpression
- ClassDeclaration
- DebuggerStatement
- Declaration
- ExportDefaultDeclaration
- ExportNamedDeclaration
- ExportSpecifier
- NumericLiteral
- ObjectMethod
- Pattern
- TSDeclareFunction
- ExportDeclaration
- AssignmentExpression
- JSXEmptyExpression
- JSXSpreadAttribute
- isTSModuleDeclaration
- CommentBlock
- CommentLine
- InterpreterDirective
- addComments
- removeComments
Other Related APIs
@babel/types#isTemplateLiteral TypeScript Examples
The following examples show how to use
@babel/types#isTemplateLiteral.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: getMemberExpressionParams.ts From engine with MIT License | 5 votes |
getMemberExpressionParams = (node: Node): any[] => {
if (node.type === "MemberExpression") {
if (node.property.type === "MemberExpression") {
let result = getMemberExpressionParams(node.property.object);
if (node.property.property) {
const params = getMemberExpressionParams(node.property.property);
result = result.concat(params);
}
let pathArg;
if (result[0] === PathProps.EXTERNAL) {
result.shift();
pathArg = "@" + result.join(".");
} else if (result[0] === PathProps.INTERNAL) {
result.shift();
pathArg = "$" + result.join(".");
} else if (result[0] === PathProps.PARAM) {
result.shift();
pathArg = ":" + result.join(".");
} else {
pathArg = {
__node__: node.property,
};
}
return [...getMemberExpressionParams(node.object), pathArg];
} else {
let value;
if (isIdentifier(node.property) && node.computed) {
value = { __node__: node.property };
} else if (isTemplateLiteral(node.property)) {
value = { __node__: node.property };
} else {
value = (node.property as any).name || (node.property as any).value;
}
return [...getMemberExpressionParams(node.object), value];
}
} else if (node.hasOwnProperty("value")) {
return [(node as ValueNodes).value];
} else if (node.hasOwnProperty("name")) {
return [(node as Identifier).name];
} else {
return [];
}
}