UNPKG

eslint-codemod-utils

Version:

A collection of AST helper functions for more complex ESLint rule fixes.

14 lines (13 loc) 334 B
/** * Given a valid node return true if the node is of the specified type. * * This function uses the `is` assertion to resolve the correct TS type for the consumer. * * @return boolean */ export function isNodeOfType(node, type) { if (!(node && node['type'])) { return false; } return node.type === type; }