UNPKG

eslint-plugin-mocha

Version:

Eslint rules for mocha.

64 lines 1.94 kB
export function isMemberExpression(node) { return node.type === 'MemberExpression'; } export function expectMemberExpression(node) { if (isMemberExpression(node)) { return node; } throw new TypeError(`Expected MemberExpression node, got ${node.type}.`); } export function isCallExpression(node) { return node.type === 'CallExpression'; } export function expectCallExpression(node) { if (isCallExpression(node)) { return node; } throw new TypeError(`Expected CallExpression node, got ${node.type}.`); } export function isBlockStatement(node) { return node.type === 'BlockStatement'; } export function isReturnStatement(node) { return node.type === 'ReturnStatement'; } export function isIdentifier(node) { return node.type === 'Identifier'; } export function isVariableDeclarator(node) { return node.type === 'VariableDeclarator'; } export function isObjectPattern(pattern) { return pattern.type === 'ObjectPattern'; } export function isIdentifierPattern(pattern) { return pattern.type === 'Identifier'; } export function isAssignmentProperty(property) { return property.type === 'Property'; } export function isArrowFunctionExpression(node) { return node.type === 'ArrowFunctionExpression'; } function isFunctionExpression(node) { return node.type === 'FunctionExpression'; } function isFunctionDeclaration(node) { return node.type === 'FunctionDeclaration'; } export function isFunction(node) { return isFunctionExpression(node) || isArrowFunctionExpression(node) || isFunctionDeclaration(node); } export function isLiteral(node) { return node.type === 'Literal'; } export function isProgram(node) { return node.type === 'Program'; } export function getParentNode(node) { if (node.parent === null) { throw new Error('Expected node to have a parent.'); } return node.parent; } //# sourceMappingURL=node-types.js.map