json-query-validation
v1.0.0
Published
Easy way to validate with a json
Downloads
5
Readme
json-query-validation
Easy way to validate with a json
How to use
1. Import Library
const { QueryValidationFactory } = require('json-query-validation');
const validationService = QueryValidationFactory.create();
2. Define a query
const query = {
"$or": [{
"model": {
"common": {
"$equal": "value"
}
}
},
{
"model": {
"common": {
"$equal": "value2"
}
}
}]
};
2. Execute your search
const searchFrom = {
model: {
common: "value2"
}
};
const searchFrom2 = {
model: {
common: "value3"
}
};
validationService.validate(searchFrom, query); // return true
validationService.validate(searchFrom2, query); // return false