Files
memecoin-botV2/.pnpm-store/v10/files/09/447e0f45b119c61f8d2f423db2c2aa7a9d05b34695b2326d835278c201b859509727c41c7884783efd5a5bd853485cd2a4bf3738f4d7f18d853ed970c6d00c

35 lines
1.3 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isConditionalTest = isConditionalTest;
const utils_1 = require("@typescript-eslint/utils");
function isConditionalTest(node) {
const parent = node.parent;
if (parent == null) {
return false;
}
if (parent.type === utils_1.AST_NODE_TYPES.LogicalExpression) {
return isConditionalTest(parent);
}
if (parent.type === utils_1.AST_NODE_TYPES.ConditionalExpression &&
(parent.consequent === node || parent.alternate === node)) {
return isConditionalTest(parent);
}
if (parent.type === utils_1.AST_NODE_TYPES.SequenceExpression &&
parent.expressions.at(-1) === node) {
return isConditionalTest(parent);
}
if (parent.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
parent.operator === '!') {
return isConditionalTest(parent);
}
if ((parent.type === utils_1.AST_NODE_TYPES.ConditionalExpression ||
parent.type === utils_1.AST_NODE_TYPES.DoWhileStatement ||
parent.type === utils_1.AST_NODE_TYPES.IfStatement ||
parent.type === utils_1.AST_NODE_TYPES.ForStatement ||
parent.type === utils_1.AST_NODE_TYPES.WhileStatement) &&
parent.test === node) {
return true;
}
return false;
}