@nodesecure/js-x-ray
Version:
JavaScript AST XRay analysis
29 lines • 820 B
JavaScript
export function isNode(value) {
return (value !== null &&
typeof value === "object" &&
"type" in value &&
typeof value.type === "string");
}
export function isLiteral(node) {
return isNode(node) &&
node.type === "Literal" &&
typeof node.value === "string";
}
export function isTemplateLiteral(node) {
if (!isNode(node) || node.type !== "TemplateLiteral") {
return false;
}
const firstQuasi = node.quasis.at(0);
if (!firstQuasi) {
return false;
}
return (firstQuasi.type === "TemplateElement" &&
typeof firstQuasi.value.raw === "string");
}
export function isCallExpression(node) {
return isNode(node) && node.type === "CallExpression";
}
export function noop(_name) {
return null;
}
//# sourceMappingURL=types.js.map