Skip to content

Commit e069ac4

Browse files
Update README.md (#25)
1 parent 8a43317 commit e069ac4

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

README.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
11
# @qavajs/validation
22

3-
```
3+
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.
4+
5+
## Installation
6+
7+
You can install the library using `npm`:
8+
9+
```bash
410
npm install @qavajs/validation
511
```
612

7-
@qavajs library that transforms plain english definition to validation functions
8-
9-
Library supports following validations:
10-
* equal - not strict equal (==)
11-
* strictly equal - strict equal (===)
12-
* deeply equal - deep equal (chai eql)
13-
* contain - contain a substring
14-
* match - match a regular expression
15-
* above / greater than - greater than
16-
* below / less than - less than
17-
* have type - type validation
18-
* have members - validation if array/object have exact members
19-
* include members - validation if array/object includes members
20-
* have property - have property validation
21-
* match schema - match [ajv](https://www.npmjs.com/package/ajv) schema
22-
* case insensitive equal - not strict equal (==) with casting to lower case
23-
24-
All validations can be negated adding `not` word.
13+
## Supported Validations
14+
15+
This library supports a variety of validation types, which can all be negated by adding the word `not`.
16+
17+
### Equality & Comparison
18+
19+
- **`equal`**: Checks for non-strict equality (`==`).
20+
- **`strictly equal`**: Checks for strict equality (`===`).
21+
- **`deeply equal`**: Performs a deep comparison of object properties or array elements.
22+
- **`case insensitive equal`**: Compares two values for non-strict equality after converting them to lowercase.
23+
- **`contain`**: Verifies if a string contains a specific substring.
24+
- **`include members`**: Checks if an array or object includes a specific set of members.
25+
- **`have members`**: Validates if an array or object has an exact match of a specified set of members.
26+
- **`have property`**: Ensures an object has a particular property.
27+
- **`above`** / **`greater than`**: Checks if a value is greater than another.
28+
- **`below`** / **`less than`**: Checks if a value is less than another.
29+
- **`match`**: Validates if a string matches a regular expression.
30+
- **`have type`**: Checks the type of a variable (e.g., `string`, `number`, `boolean`).
31+
- **`match schema`**: Validates data against an [ajv](https://www.npmjs.com/package/ajv) schema, which is useful for complex object validation.
2532

2633
## Test
2734

28-
```
35+
To run the test suite for this package, use the following command:
36+
37+
```bash
2938
npm run test
3039
```
40+
41+
## License
42+
43+
This project is licensed under the MIT License.

0 commit comments

Comments
 (0)