data-provider-temporary
Version:
Library that helps with server-to-client synchronization of data
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';
}