UI for Zipcoin Blue

switch.js 817B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. var util = require('./_util');
  3. module.exports = function defFunc(ajv) {
  4. if (ajv.RULES.keywords.switch && ajv.RULES.keywords.if) return;
  5. var metaSchemaRef = util.metaSchemaRef(ajv);
  6. defFunc.definition = {
  7. inline: require('./dotjs/switch'),
  8. statements: true,
  9. errors: 'full',
  10. metaSchema: {
  11. type: 'array',
  12. items: {
  13. required: [ 'then' ],
  14. properties: {
  15. 'if': metaSchemaRef,
  16. 'then': {
  17. anyOf: [
  18. { type: 'boolean' },
  19. metaSchemaRef
  20. ]
  21. },
  22. 'continue': { type: 'boolean' }
  23. },
  24. additionalProperties: false,
  25. dependencies: {
  26. 'continue': [ 'if' ]
  27. }
  28. }
  29. }
  30. };
  31. ajv.addKeyword('switch', defFunc.definition);
  32. return ajv;
  33. };