check-toolkit
v0.1.2
Published
Lightweight tree-shakeable TypeScript utilities and type guards with zero dependencies
Maintainers
Readme
check-toolkit
A lightweight TypeScript utility library: type guards plus small helpers for objects, arrays, strings, cloning, and functions. Zero runtime dependencies — import only what you need.
Why check-toolkit?
- Utilities + type guards —
pick/groupBy/debouncealongsideisNotNiland friends - Lightweight — focused helpers without a full lodash-sized surface
- Tree-shakeable — each function is imported separately
- Zero runtime dependencies — nothing extra in your bundle
- Typed — type guards like
isNotNilandisPlainObjectnarrow types in TypeScript - AI-friendly catalog — machine-readable API at
check-toolkit/catalogso agents use real exports, not invented ones
Use it when you want a small ESM toolkit with solid TypeScript narrowing, not a large utility framework.
Installation
npm install check-toolkitUsage
import { isString, isPlainObject, pick } from "check-toolkit";
console.log(isString("test")); // true
console.log(isPlainObject({ a: 1 })); // true
const payload = pick({ a: 1, b: 2, c: 3 }, ["a", "c"]);
// { a: 1, c: 3 }Available Functions
Type Checking
isSymbol- Check if value is a symbolisArray- Check if value is an arrayisArrayLike- Check if value is array-likeisNan- Check if value is NaNisObject- Check if value is an objectisNull- Check if value is nullisFunction- Check if value is a functionisNumber- Check if value is a numberisString- Check if value is a stringisBoolean- Check if value is a booleanisPlainObject- Check if value is a plain objectisUndefined- Check if value is undefinedisNotUndefined- Check if value is not undefinedisNil- Check if value is null or undefinedisNotNil- Check if value is not null and not undefinedisNotNaN- Check if value is not NaNisEmpty- Check if value is emptyisEqual- Check if two values are equalisMatch- Check if object matches source
Object Operations
pick- Creates a new object with only the specified keysomit- Creates a new object without the specified keyspickBy- Creates a new object with entries that satisfy a predicateomitBy- Creates a new object without entries that satisfy a predicate
Array Operations
compact- Removes falsy values from an arraycountBy- Counts elements grouped by iteratee resultuniq- Creates an array with unique valuesuniqBy- Like uniq but accepts an iterateegroupBy- Groups array elements by iteratee resultpartition- Splits an array into two groups by predicatesortBy- Creates a sorted copy by iteratee resultdifference- Create an array of unique values not included in other arraysdifferenceBy- Like difference but accepts iterateedifferenceWith- Like difference but accepts comparatorkeyBy- Creates an object composed of keys generated from array
String Operations
capitalize- Uppercases the first character only (not title case; usestoUpperCase)camelCase- Converts a string to camel casekebabCase- Converts a string to kebab casesnakeCase- Converts a string to snake casestartCase- Converts each word to start case (title-style)escape- Escapes HTML special charactersunescape- Unescapes HTML special charactersescapeRegExp- Escapes RegExp special characters
Clone Operations
clone- Creates a shallow clone of a valuecloneDeep- Creates a deep clone of a valuecloneWith- Creates a shallow clone with a customizercloneDeepWith- Creates a deep clone with a customizer
Function Utilities
debounce- Creates a debounced functionthrottle- Creates a throttled functionnoop- No-op default callbackidentity- Returns the first argument unchangedonce- Invokes a function at most once
Math
clamp- Clamps a number between min and max
Promise
delay- Resolves after the specified milliseconds
AI / Agent integration
check-toolkit ships a vendor-neutral machine-readable catalog (not an LLM runtime). Any tool that can read JSON or docs can use it.
Catalog (source of truth)
import catalog from "check-toolkit/catalog" with { type: "json" };
// or read node_modules/check-toolkit/ai/catalog.json / ai/catalog.json from the repoEach entry includes signature, intents, narrows, examples, and antiPatterns. The root also lists notIncluded APIs (for example get, merge, memoize) so agents do not hallucinate them.
llms.txt
A compact digest generated from the catalog:
- In the repo:
ai/llms.txt - On GitHub:
https://raw.githubusercontent.com/neturuDev/check-toolkit/main/ai/llms.txt
Regenerate / validate (also runs as part of npm run build):
npm run generate:aiAgent skill (optional)
For coding agents that support Agent Skills, see skills/check-toolkit/SKILL.md. Prefer the catalog as the API source of truth; the skill only encodes prefer/narrowing rules.
Testing
To run the test suite:
npm run testTo build the project:
npm run buildTo start development server:
npm run devContributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Originally created by Volodymyr Cherevchuk
