UNPKG

wix-style-react

Version:
24 lines (22 loc) 900 B
"use strict"; exports.__esModule = true; exports.extractDataAttributes = exports.extractAttributes = void 0; var _filterObject = require("./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} */ var extractAttributes = exports.extractAttributes = function extractAttributes(props) { var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; return (0, _filterObject.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 {*} */ var extractDataAttributes = props => extractAttributes(props, 'data-'); exports.extractDataAttributes = extractDataAttributes; //# sourceMappingURL=extractAttributes.js.map