typescript-plugin-styled-components
Version:
TypeScript transformer for improving the debugging experience of styled-components
71 lines (70 loc) • 2.48 kB
JavaScript
// The source code is kindly borrowed from `ts-is-kind` npm module.
// Original repo: https://github.com/mohsen1/ts-is-kind by @mohsen1
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNoSubstitutionTemplateLiteral = exports.isTemplateExpression = exports.isTaggedTemplateExpression = exports.isExportAssignment = exports.isVariableDeclaration = exports.isIdentifier = exports.isCallExpression = exports.isPropertyAccessExpression = void 0;
const ts = require("typescript");
/**
* Return true if node is `PropertyAccessExpression`
* @param node A TypeScript node
*/
function isPropertyAccessExpression(node) {
return node.kind === ts.SyntaxKind.PropertyAccessExpression;
}
exports.isPropertyAccessExpression = isPropertyAccessExpression;
/**
* Return true if node is `CallExpression`
* @param node A TypeScript node
*/
function isCallExpression(node) {
return node.kind === ts.SyntaxKind.CallExpression;
}
exports.isCallExpression = isCallExpression;
/**
* Return true if node is `Identifier`
* @param node A TypeScript node
*/
function isIdentifier(node) {
return node.kind === ts.SyntaxKind.Identifier;
}
exports.isIdentifier = isIdentifier;
/**
* Return true if node is `VariableDeclaration`
* @param node A TypeScript node
*/
function isVariableDeclaration(node) {
return node.kind === ts.SyntaxKind.VariableDeclaration;
}
exports.isVariableDeclaration = isVariableDeclaration;
/**
* Return true if node is `ExportAssignment`
* @param node A TypeScript node
*/
function isExportAssignment(node) {
return node.kind === ts.SyntaxKind.ExportAssignment;
}
exports.isExportAssignment = isExportAssignment;
/**
* Return true if node is `TaggedTemplateExpression`
* @param node A TypeScript node
*/
function isTaggedTemplateExpression(node) {
return node.kind === ts.SyntaxKind.TaggedTemplateExpression;
}
exports.isTaggedTemplateExpression = isTaggedTemplateExpression;
/**
* Return true if node is `TemplateExpression`
* @param node A TypeScript node
*/
function isTemplateExpression(node) {
return node.kind === ts.SyntaxKind.TemplateExpression;
}
exports.isTemplateExpression = isTemplateExpression;
/**
* Return true if node is `NoSubstitutionTemplateLiteral`
* @param node A TypeScript node
*/
function isNoSubstitutionTemplateLiteral(node) {
return node.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral;
}
exports.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;
;