babel-preset-test-bundled-dependencies
Version:
Allow custom config for create-react-app without ejecting
15 lines (11 loc) • 317 B
JavaScript
import { getProp, getLiteralPropValue } from 'jsx-ast-utils';
/**
* Returns the implicit role for an img tag.
*/
export default function getImplicitRoleForImg(attributes) {
const alt = getProp(attributes, 'alt');
if (alt && getLiteralPropValue(alt) === '') {
return 'presentation';
}
return 'img';
}