- Zero runtime dependencies
- ESM + CJS + TypeScript typings
- Strict TypeScript config, framework agnostic
- Small, focused utilities (grows conservatively)
pnpm add @ulfsoft/ulfkit
# or
npm install @ulfsoft/ulfkit
# or
yarn add @ulfsoft/ulfkitimport { cc, combineClasses, math } from "@ulfsoft/ulfkit";
const classes = combineClasses(
"btn base",
{ "btn-primary": true, "btn-disabled": () => false },
" extra ",
{ hidden: false }
);
// => "btn base btn-primary extra"
const ratio = math.lerp(0, 100, 0.25); // 25
const clamped = math.clamp(150, 0, 100); // 100
// Shorthand alias
const moreClasses = cc("flex", { "flex-row": true, "flex-col": false });Builds a space‑separated class string from:
- Plain strings (empty / whitespace skipped)
- Object maps: key included if value is truthy or a function returning true
Namespace with numeric helpers:
clamp(num, min, max)– constrain a numberlerp(start, end, t)– linear interpolation (no clamping oft)
- Provide a minimal core of pragmatic utilities
- Preserve small surface area and high internal consistency
- Avoid premature abstraction & heavy dependencies
See CONTRIBUTING.md for full guidelines.
Quick dev loop:
pnpm install
pnpm build
pnpm testType checking only:
pnpm typecheckFormatting & lint:
pnpm lint
pnpm formatpnpm version patch # or minor / major
git push --follow-tags
pnpm publish --access publicSee more in docs/publishing.md.
Follows semantic versioning. Changes recorded in CHANGELOG.md.
Apache 2.0 © Ulfsoft / Contributors
PRs welcome. Keep it lean.