mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 17:31:25 +08:00
12 lines
331 B
TypeScript
12 lines
331 B
TypeScript
|
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;
|
||
|
}, {});
|
||
|
}
|