Files
ETB/ETB-FrontEnd/node_modules/eslint-plugin-react/lib/util/getTokenBeforeClosingBracket.js
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

17 lines
428 B
JavaScript

'use strict';
/**
* Find the token before the closing bracket.
* @param {ASTNode} node - The JSX element node.
* @returns {Token} The token before the closing bracket.
*/
function getTokenBeforeClosingBracket(node) {
const attributes = node.attributes;
if (!attributes || attributes.length === 0) {
return node.name;
}
return attributes[attributes.length - 1];
}
module.exports = getTokenBeforeClosingBracket;