Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
49 additions
and 11 deletions.
@@ -0,0 +1,11 @@ | ||
export default function getDataOrAriaProps(props: any) { | ||
return Object.keys(props).reduce((prev: any, key: string) => { | ||
if ( | ||
(key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') && | ||
key.substr(0, 7) !== 'data-__' | ||
) { | ||
prev[key] = props[key]; | ||
} | ||
return prev; | ||
}, {}); | ||
} |