@qavajs library that transform plain english definition to validation functions
npm install @qavajs/validationA @qavajs library for validating data using plain English definitions. This package simplifies the process of creating validation functions by translating human-readable sentences into executable code.
You can install the library using npm:
``bash`
npm install @qavajs/validation
This library supports a variety of validation types, which can all be negated by adding the word not.
- equal: Checks for non-strict equality (==).strictly equal
- : Checks for strict equality (===).deeply equal
- : Performs a deep comparison of object properties or array elements.deeply strictly equal
- : Performs a deep comparison of object properties or array elements with nodejs util.isDeepStrictEqualcase insensitive equal
- : Compares two values for non-strict equality after converting them to lowercase.contain
- : Verifies if a string contains a specific substring.include members
- : Checks if an array or object includes a specific set of members.have members
- : Validates if an array or object has an exact match of a specified set of members.have property
- : Ensures an object has a particular property.above
- / greater than: Checks if a value is greater than another.below
- / less than: Checks if a value is less than another.match
- : Validates if a string matches a regular expression.have type
- : Checks the type of a variable (e.g., string, number, boolean).match schema
- : Validates data against an ajv schema, which is useful for complex object validation.satisfy
- : verify user-defined expectation provided as predicate
with many assertions out of the box`typescript
import { expect } from '@qavajs/validation';expect(1).toEqual(1);
`Test
To run the test suite for this package, use the following command:
`bash
npm run test
``This project is licensed under the MIT License.