BVB Source Codes

reactide Show rules.js Source code

Return Download reactide: download rules.js Source code - Download reactide Source code - Type:.js
  1. 'use strict';
  2.  
  3. var ruleModules = require('./_rules')
  4.   , toHash = require('./util').toHash;
  5.  
  6. module.exports = function rules() {
  7.   var RULES = [
  8.     { type: 'number',
  9.       rules: [ 'maximum', 'minimum', 'multipleOf'] },
  10.     { type: 'string',
  11.       rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
  12.     { type: 'array',
  13.       rules: [ 'maxItems', 'minItems', 'uniqueItems', 'items' ] },
  14.     { type: 'object',
  15.       rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'properties' ] },
  16.     { rules: [ '$ref', 'enum', 'not', 'anyOf', 'oneOf', 'allOf' ] }
  17.   ];
  18.  
  19.   var ALL = [ 'type', 'additionalProperties', 'patternProperties' ];
  20.   var KEYWORDS = [ 'additionalItems', '$schema', 'id', 'title', 'description', 'default' ];
  21.   var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
  22.   RULES.all = toHash(ALL);
  23.  
  24.   RULES.forEach(function (group) {
  25.     group.rules = group.rules.map(function (keyword) {
  26.       ALL.push(keyword);
  27.       var rule = RULES.all[keyword] = {
  28.         keyword: keyword,
  29.         code: ruleModules[keyword]
  30.       };
  31.       return rule;
  32.     });
  33.   });
  34.  
  35.   RULES.keywords = toHash(ALL.concat(KEYWORDS));
  36.   RULES.types = toHash(TYPES);
  37.   RULES.custom = {};
  38.  
  39.   return RULES;
  40. };
  41.  
downloadrules.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