A @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:
npm install @qavajs/validationThis 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.
- case 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
You can use standalone extendable expect with many assertions out of the box
import { expect } from '@qavajs/validation'; expect(1).toEqual(1);To run the test suite for this package, use the following command:
npm run testThis project is licensed under the MIT License.