29 lines
1 KiB
JavaScript
29 lines
1 KiB
JavaScript
/**
|
|
* @license lucide-react v0.507.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
const toCamelCase = (string) => string.replace(
|
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
);
|
|
const toPascalCase = (string) => {
|
|
const camelCase = toCamelCase(string);
|
|
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
};
|
|
const mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
}).join(" ").trim();
|
|
const hasA11yProp = (props) => {
|
|
for (const prop in props) {
|
|
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
return true;
|
|
}
|
|
}
|
|
};
|
|
|
|
export { hasA11yProp, mergeClasses, toCamelCase, toKebabCase, toPascalCase };
|
|
//# sourceMappingURL=utils.js.map
|