UNPKG

lucide-solid

Version:

A Lucide icon library package for Solid applications

52 lines (45 loc) 1.38 kB
/** * @license lucide-solid v0.487.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ 'use strict'; /** * Converts string to kebab case * * @param {string} string * @returns {string} A kebabized string */ const toKebabCase = string => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase(); /** * Converts string to camel case * * @param {string} string * @returns {string} A camelized string */ const toCamelCase = string => string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()); /** * Converts string to pascal case * * @param {string} string * @returns {string} A pascalized string */ const toPascalCase = string => { const camelCase = toCamelCase(string); return camelCase.charAt(0).toUpperCase() + camelCase.slice(1); }; /** * Merges classes into a single string * * @param {array} classes * @returns {string} A string of classes */ const mergeClasses = (...classes) => classes.filter((className, index, array) => { return Boolean(className) && className.trim() !== '' && array.indexOf(className) === index; }).join(' ').trim(); exports.mergeClasses = mergeClasses; exports.toCamelCase = toCamelCase; exports.toKebabCase = toKebabCase; exports.toPascalCase = toPascalCase; //# sourceMappingURL=utils.js.map