BVB Source Codes

reactide Show v5.js Source code

Return Download reactide: download v5.js Source code - Download reactide Source code - Type:.js
  1. 'use strict';
  2.  
  3. var META_SCHEMA_ID = 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json';
  4.  
  5. module.exports = {
  6.   enable: enableV5,
  7.   META_SCHEMA_ID: META_SCHEMA_ID
  8. };
  9.  
  10.  
  11. function enableV5(ajv) {
  12.   var inlineFunctions = {
  13.     'switch': require('./dotjs/switch'),
  14.     'constant': require('./dotjs/constant'),
  15.     '_formatLimit': require('./dotjs/_formatLimit'),
  16.     'patternRequired': require('./dotjs/patternRequired')
  17.   };
  18.  
  19.   if (ajv._opts.meta !== false) {
  20.     var metaSchema = require('./refs/json-schema-v5.json');
  21.     ajv.addMetaSchema(metaSchema, META_SCHEMA_ID);
  22.   }
  23.   _addKeyword('constant');
  24.   ajv.addKeyword('contains', { type: 'array', macro: containsMacro });
  25.  
  26.   _addKeyword('formatMaximum', 'string', inlineFunctions._formatLimit);
  27.   _addKeyword('formatMinimum', 'string', inlineFunctions._formatLimit);
  28.   ajv.addKeyword('formatExclusiveMaximum');
  29.   ajv.addKeyword('formatExclusiveMinimum');
  30.  
  31.   ajv.addKeyword('patternGroups'); // implemented in properties.jst
  32.   _addKeyword('patternRequired', 'object');
  33.   _addKeyword('switch');
  34.  
  35.  
  36.   function _addKeyword(keyword, types, inlineFunc) {
  37.     var definition = {
  38.       inline: inlineFunc || inlineFunctions[keyword],
  39.       statements: true,
  40.       errors: 'full'
  41.     };
  42.     if (types) definition.type = types;
  43.     ajv.addKeyword(keyword, definition);
  44.   }
  45. }
  46.  
  47.  
  48. function containsMacro(schema) {
  49.   return {
  50.     not: { items: { not: schema } }
  51.   };
  52. }
  53.  
downloadv5.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top