UNPKG

@bearz/strings

Version:

A collection of string utilities to avoid extra allocations and enable case insensitivity comparisons.

21 lines (20 loc) 730 B
/** * The dasherize function converts a string to kebab case by replacing * spaces, dashes, and underscores with dashes. It also converts * pascal case to kebab case. This is primarily used for converting * code to kebab case. * @module */ import { dasherize as og } from "@bearz/slices/dasherize"; /** * Dasherizes the string by replacing ' ', '-' and '_' with '-' and converting * pascal case to kebab case. This is primarily for converting code to * kebab case. * @param value The string to dasherize. * @param options The options for dasherizing the string * @returns The dasherized string. */ export function dasherize(value, options) { const r = og(value, options); return String.fromCodePoint(...r); }