wix-style-react
Version:
wix-style-react
15 lines • 594 B
JavaScript
import { filterObject } from './filterObject';
/**
* a generic utility to get a subset of the received props object according to the prefix of the prop name
* @param props
* @param prefix
* @return {any}
*/
export const extractAttributes = (props, prefix = '') => filterObject(props, key => key.length >= prefix.length && key.indexOf(prefix) === 0);
/**
* Returns a subset of the received props object that starts with "data-"
* @param props
* @return {*}
*/
export const extractDataAttributes = props => extractAttributes(props, 'data-');
//# sourceMappingURL=extractAttributes.js.map