@extendscript/aes.patch.json.validate
v1.0.1
Published
Adds `validate()` to JSON. Validate a JSON objects to Schema.
Downloads
7
Readme
json.validate
Extension
Adds validate()
to JSON. Validate a JSON objects to Schema.
Source: iclanzan/jassi
Install
npm install @extendscript/aes.patch.json.validate
Include
#include 'node_modules/@extendscript/aes.patch.json.validate/validate.js'
Use
errors = JSON.validate('apple', {type: 'string', maxLength: 5});
if (0 === errors.length) {
// validation passed, do something here
}
else {
// validation failed, print the errors
errors.forEach(function(error) {
console.log(error.property + ': ' + error.message);
});
}
Test
You can test the code against a range of targets:
npm run test target-1 target-2
We keep a log of test results