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.
 
 

11 lines
317 B

export default function getDataOrAriaProps(props: any) {
return Object.keys(props).reduce((prev: any, key: string) => {
if (
(key.startsWith('data-') || key.startsWith('aria-') || key === 'role') &&
!key.startsWith('data-__')
) {
prev[key] = props[key];
}
return prev;
}, {});
}