UNPKG

@jsxtools/eslint-plugin-jsx-a11y

Version:

Static AST checker for accessibility rules on JSX elements for flat ESLint Config.

19 lines (16 loc) 545 B
import { propName, getLiteralPropValue } from './module/jsx-ast-utils.js'; function attributesComparator(baseAttributes = [], attributes = []) { return baseAttributes.every((baseAttr) => attributes.some((attribute) => { if (attribute.type !== "JSXAttribute") { return false; } if (baseAttr.name !== propName(attribute)) { return false; } if (baseAttr.value && baseAttr.value !== getLiteralPropValue(attribute)) { return false; } return true; })); } export { attributesComparator as default };