mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
7c34addf57
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with functions which aren't. Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
12 lines
317 B
TypeScript
12 lines
317 B
TypeScript
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;
|
|
}, {});
|
|
}
|