type-validation-in-ts
v1.0.3
Published
A simple type validation library for TypeScript
Readme
Type Validation Library for TypeScript
A simple and lightweight library for validating data types in TypeScript.
Installation
You can install the package via npm:
npm install type-validationUsage
Import the desired validation functions from the package and use them in your TypeScript code:
import { isNumber, isString } from 'type-validation';
console.log(isNumber(42)); // true
console.log(isNumber('42')); // false
console.log(isString('Hello')); // true
console.log(isString(123)); // false
API
isNumber(value: any): value is number
Returns true if the value is a number, otherwise false.
isString(value: any): value is string
Returns true if the value is a string, otherwise false.
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request for any improvements or additional features you'd like to see.
