🧶 Ultra-minimal utilities for manipulating strings
Add the dependency from NPM:
npm install PROJECT-NAME
Import the utility you require and use it:
import { capitalize } from "PROJECT-NAME";
const title = capitalize("hello, world!");
console.log(title); // Hello, world!
The following utilities are available:
Utility | Source |
---|---|
slugify("Hello world") → hello-world |
utils/slugify.ts |
trim("-hello-", "-") → hello |
utils/trim.ts |
capitalize("hello") → Hello |
utils/case.ts |
camelCase("hello world") → helloWorld |
utils/case.ts |
kebabCase("hello world") → hello-world |
utils/case.ts |
snakeCase("hello world") → hello_world |
utils/case.ts |
Install dependencies:
yarn
Compile Typescript to ES6 before publishing to NPM:
yarn build