Matt Lein
7 years ago
committed by
偏右
2 changed files with 10 additions and 0 deletions
@ -0,0 +1,8 @@ |
|||
export default function getDataAttributes(props: any) { |
|||
return Object.keys(props).reduce((prev: any, key: string) => { |
|||
if (key.substr(0, 5) === 'data-') { |
|||
prev[key] = props[key]; |
|||
} |
|||
return prev; |
|||
}, {}); |
|||
} |
Loading…
Reference in new issue