check-toolkit
v0.0.3
Published
A TypeScript utility library for type checking and validation.
Readme
check-toolkit
A TypeScript utility library for type checking and validation.
Installation
npm install check-toolkitUsage
import { isString } from "check-toolkit";
import { isNumber } from "check-toolkit";
import { isArray } from "check-toolkit";
// ... import other functions as needed
// Type checking examples
console.log(isString("test")); // true
console.log(isNumber(42)); // true
console.log(isArray([1, 2, 3])); // true
console.log(isObject({})); // true
console.log(isFunction(() => {})); // trueAvailable 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 stringisUndefined- 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
Array Operations
difference- 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
escape- Escapes HTML special charactersunescape- Unescapes HTML special charactersescapeRegExp- Escapes RegExp special characters
Function Utilities
debounce- Creates a debounced functionthrottle- Creates a throttled function
Testing
To run the test suite:
npm run testTo build the project:
npm run buildTo start development server:
npm run devDocumentation
For detailed documentation and examples, please visit our documentation.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Originally created by Volodymyr Cherevchuk
