UNPKG

2.48 kBJavaScriptView Raw
1"use strict";
2// The source code is kindly borrowed from `ts-is-kind` npm module.
3// Original repo: https://github.com/mohsen1/ts-is-kind by @mohsen1
4Object.defineProperty(exports, "__esModule", { value: true });
5exports.isNoSubstitutionTemplateLiteral = exports.isTemplateExpression = exports.isTaggedTemplateExpression = exports.isExportAssignment = exports.isVariableDeclaration = exports.isIdentifier = exports.isCallExpression = exports.isPropertyAccessExpression = void 0;
6const ts = require("typescript");
7/**
8 * Return true if node is `PropertyAccessExpression`
9 * @param node A TypeScript node
10 */
11function isPropertyAccessExpression(node) {
12 return node.kind === ts.SyntaxKind.PropertyAccessExpression;
13}
14exports.isPropertyAccessExpression = isPropertyAccessExpression;
15/**
16 * Return true if node is `CallExpression`
17 * @param node A TypeScript node
18 */
19function isCallExpression(node) {
20 return node.kind === ts.SyntaxKind.CallExpression;
21}
22exports.isCallExpression = isCallExpression;
23/**
24 * Return true if node is `Identifier`
25 * @param node A TypeScript node
26 */
27function isIdentifier(node) {
28 return node.kind === ts.SyntaxKind.Identifier;
29}
30exports.isIdentifier = isIdentifier;
31/**
32 * Return true if node is `VariableDeclaration`
33 * @param node A TypeScript node
34 */
35function isVariableDeclaration(node) {
36 return node.kind === ts.SyntaxKind.VariableDeclaration;
37}
38exports.isVariableDeclaration = isVariableDeclaration;
39/**
40 * Return true if node is `ExportAssignment`
41 * @param node A TypeScript node
42 */
43function isExportAssignment(node) {
44 return node.kind === ts.SyntaxKind.ExportAssignment;
45}
46exports.isExportAssignment = isExportAssignment;
47/**
48 * Return true if node is `TaggedTemplateExpression`
49 * @param node A TypeScript node
50 */
51function isTaggedTemplateExpression(node) {
52 return node.kind === ts.SyntaxKind.TaggedTemplateExpression;
53}
54exports.isTaggedTemplateExpression = isTaggedTemplateExpression;
55/**
56 * Return true if node is `TemplateExpression`
57 * @param node A TypeScript node
58 */
59function isTemplateExpression(node) {
60 return node.kind === ts.SyntaxKind.TemplateExpression;
61}
62exports.isTemplateExpression = isTemplateExpression;
63/**
64 * Return true if node is `NoSubstitutionTemplateLiteral`
65 * @param node A TypeScript node
66 */
67function isNoSubstitutionTemplateLiteral(node) {
68 return node.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral;
69}
70exports.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;