UNPKG

@dunite/au-react-wrapper

Version:
12 lines (11 loc) 447 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.camelToKebab = void 0; function camelToKebab(str) { // Matches all places where a two upper case chars followed by a lower case char are and split them with an hyphen return str .replace(/([a-z0-9])([A-Z])/g, '$1-$2') .replace(/([A-Z])([A-Z])(?=[a-z])/g, '$1-$2') .toLowerCase(); } exports.camelToKebab = camelToKebab;