PHP 8.2.30
Preview: .tonic_example.js Size: 439 B
//usr/lib/node_modules/npm/node_modules/har-validator/node_modules/ajv/.tonic_example.js

var Ajv = require('ajv');
var ajv = new Ajv({allErrors: true});

var schema = {
  "properties": {
    "foo": { "type": "string" },
    "bar": { "type": "number", "maximum": 3 }
  }
};

var validate = ajv.compile(schema);

test({"foo": "abc", "bar": 2});
test({"foo": 2, "bar": 4});

function test(data) {
  var valid = validate(data);
  if (valid) console.log('Valid!');
  else console.log('Invalid: ' + ajv.errorsText(validate.errors));
}

Directory Contents

Dirs: 3 × Files: 4

Name Size Perms Modified Actions
dist DIR
- drwxr-xr-x 2024-03-03 22:36:29
Edit Download
lib DIR
- drwxr-xr-x 2024-03-03 22:36:29
Edit Download
scripts DIR
- drwxr-xr-x 2024-03-03 22:36:29
Edit Download
439 B lrw-r--r-- 2021-03-10 14:36:40
Edit Download
1.06 KB lrw-r--r-- 2021-03-10 14:36:40
Edit Download
3.84 KB lrw-r--r-- 2021-03-10 14:36:40
Edit Download
83.59 KB lrw-r--r-- 2021-03-10 14:36:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).