eslint-plugin-exception-handling
Version:
💣 Lints unhandled functions that might throw errors. For JavaScript/TypeScript eslint.
16 lines (15 loc) • 580 B
JavaScript
import { isIdentifier, isMemberExpression, isPrivateIdentifier, } from "../../src/utils/ast-guards.js";
export function getCallExprId(called) {
if (isIdentifier(called.callee)) {
return called.callee;
}
else if (isMemberExpression(called.callee)) {
if (isIdentifier(called.callee.property) ||
isPrivateIdentifier(called.callee.property)) {
return called.callee.property;
}
else {
throw new Error(`Cannot handle non-identifier member expression property ${called.callee.property}`);
}
}
}