a zip code crypto-currency system good for red ONLY

.tonic_example.js 439B

1234567891011121314151617181920
  1. var Ajv = require('ajv');
  2. var ajv = new Ajv({allErrors: true});
  3. var schema = {
  4. "properties": {
  5. "foo": { "type": "string" },
  6. "bar": { "type": "number", "maximum": 3 }
  7. }
  8. };
  9. var validate = ajv.compile(schema);
  10. test({"foo": "abc", "bar": 2});
  11. test({"foo": 2, "bar": 4});
  12. function test(data) {
  13. var valid = validate(data);
  14. if (valid) console.log('Valid!');
  15. else console.log('Invalid: ' + ajv.errorsText(validate.errors));
  16. }