UNPKG

eslint-plugin-jam3

Version:
22 lines (18 loc) 537 B
'use strict'; // ------------------------------------------------------------------------------ // function Definition // ------------------------------------------------------------------------------ /** * Get name of node if available * @param {ASTNode} node The AST node being checked. * @return {String} The name of the node */ function getNodeName(node) { if (node.id) { return node.id.name; } else if (node.parent && node.parent.id) { return node.parent.id.name; } return ''; } module.exports = getNodeName;