diff --git a/src/internal/base-component/index.ts b/src/internal/base-component/index.ts index cf367b9269..f27440d798 100644 --- a/src/internal/base-component/index.ts +++ b/src/internal/base-component/index.ts @@ -31,11 +31,11 @@ export interface BaseComponentProps { export function getBaseProps(props: BaseComponentProps) { const baseProps: Record = {}; - Object.keys(props).forEach(prop => { - if (prop === 'id' || prop === 'className' || prop.match(/^data-/)) { + for (const prop in props) { + if (prop === 'id' || prop === 'className' || prop.startsWith('data-')) { baseProps[prop] = (props as Record)[prop]; } - }); + } return baseProps as BaseComponentProps; }