@grafana/faro-web-sdk
Version:
Faro instrumentations, metas, transports for web.
17 lines • 874 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertDataAttributeName = void 0;
/**
* Parses the action attribute name by removing the 'data-' prefix and converting
* the remaining string to camelCase.
*
* This is needed because the browser will remove the 'data-' prefix and the dashes from
* data attributes and make then camelCase.
*/
function convertDataAttributeName(userActionDataAttribute) {
var withoutData = userActionDataAttribute.split('data-')[1];
var withUpperCase = withoutData === null || withoutData === void 0 ? void 0 : withoutData.replace(/-(.)/g, function (_, char) { return char.toUpperCase(); });
return withUpperCase === null || withUpperCase === void 0 ? void 0 : withUpperCase.replace(/-/g, '');
}
exports.convertDataAttributeName = convertDataAttributeName;
//# sourceMappingURL=util.js.map