String Utilities
These are a collection of simple string manipulation utilities commonly used when working with data from the CEM.
Installation
npm install -D @wc-toolkit/cem-utilitiesRemove Quotes
The removeQuotes function removes quotes from a string.
import { removeQuotes } from '@wc-toolkit/cem-utilities';
const noQuotes = removeQuotes(`"my-component"`); // my-componentconst noQuotes = removeQuotes(`'my-component'`); // my-componentKebab Case
The kebabCase function converts a string to kebab-case.
import { toKebabCase } from '@wc-toolkit/cem-utilities';
const kebab = toKebabCase('myComponent'); // my-componentSentence Case
The toSentenceCase function converts a string to sentence case.
import { toSentenceCase } from '@wc-toolkit/cem-utilities';
const sentence = toSentenceCase('myComponent'); // My componentPascal Case
The toPascalCase function converts a string to PascalCase.
import { toPascalCase } from '@wc-toolkit/cem-utilities';
const pascal = toPascalCase('my-component'); // MyComponentCamel Case
The toCamelCase function converts a string to camelCase.
import { toCamelCase } from '@wc-toolkit/cem-utilities';
const camel = toCamelCase('my-component'); // myComponent