strkit-lib
v1.1.1
Published
A small, zero-dependency TypeScript string utilities library. `strkit` provides common string transformations and helpers (camelCase, snake_case, kebab-case, deburring, escaping, padding, etc.) with full TypeScript types and declarations.
Maintainers
Readme
strkit
A small, zero-dependency TypeScript string utilities library. strkit provides
common string transformations and helpers (camelCase, snake_case, kebab-case,
deburring, escaping, padding, etc.) with full TypeScript types and declarations.
Features
- Well-typed TypeScript API with declaration files
- Common string case converters:
camelCase,pascalCase,snakeCase,kebabCase,constantCase - Utility helpers:
deburr,escape,pad,trim,upperCase,lowerCase,reverseString, and more - Unicode-aware splitting and handling (emoji and extended scripts supported)
Install
From npm (recommended):
npm install strkitWhen working from this repository (development):
# install dependencies
npm install
# build
npm run build
# run the package (after build)
npm start
# run directly in TS for development
npm run devNote: this project compiles TypeScript to
dist/and emits declaration files (dist/index.d.ts).
Quick usage
Importing in TypeScript / ESM:
import { camelCase, snakeCase, deburr } from "strkit";
console.log(camelCase("Hello WORLD")); // "helloWorld"
console.log(snakeCase("Hello World")); // "hello_world"
console.log(deburr("déjà vu")); // "deja vu"Using CommonJS (Node):
const { kebabCase, escape } = require("strkit");
console.log(kebabCase("Hello World")); // "hello-world"
console.log(escape("<div>&</div>")); // "<div>&</div>"API (high level)
Main exports live in src/index.ts and include (but are not limited to):
camelCase(str: string): stringpascalCase(str: string): stringsnakeCase(str: string): stringkebabCase(str: string): stringconstantCase(str: string): stringdeburr(str: string): stringescape(str: string): stringpad(str: string, length: number, chars?: string): string
See the source for full JSDoc and examples: src/index.ts.
Development
- Build:
npm run build(runstscand emitsdist/) - Clean:
npm run clean(removesdist/) - Dev (fast-run):
npm run dev(runsts-node --transpile-only src/index.ts)
If you don't have ts-node or other dev tools installed globally, npm install will add them as devDependencies.
Testing
There are no tests yet. A recommended minimal next step is to add a test runner (Jest / Vitest) and include a couple of unit tests for core functions like camelCase and deburr.
Contributing
Contributions are welcome. A small suggested workflow:
- Fork the repository
- Create a feature branch
- Add tests for any new behavior
- Open a pull request with a clear description
Please run npm run build and ensure TypeScript compilation passes before submitting a PR.
License
This project uses the ISC license (see package.json).
Contact
If you have questions or ideas, open an issue on the repository.
