You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
428 B
17 lines
428 B
2 years ago
|
'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;
|