BVB Source Codes

reactide Show multipleOf.js Source code

Return Download reactide: download multipleOf.js Source code - Download reactide Source code - Type:.js
  1. 'use strict';
  2. module.exports = function generate_multipleOf(it, $keyword) {
  3.   var out = ' ';
  4.   var $lvl = it.level;
  5.   var $dataLvl = it.dataLevel;
  6.   var $schema = it.schema[$keyword];
  7.   var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
  8.   var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
  9.   var $breakOnError = !it.opts.allErrors;
  10.   var $errorKeyword;
  11.   var $data = 'data' + ($dataLvl || '');
  12.   var $isData = it.opts.v5 && $schema && $schema.$data,
  13.     $schemaValue;
  14.   if ($isData) {
  15.     out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
  16.     $schemaValue = 'schema' + $lvl;
  17.   } else {
  18.     $schemaValue = $schema;
  19.   }
  20.   out += 'var division' + ($lvl) + ';if (';
  21.   if ($isData) {
  22.     out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
  23.   }
  24.   out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';
  25.   if (it.opts.multipleOfPrecision) {
  26.     out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';
  27.   } else {
  28.     out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';
  29.   }
  30.   out += ' ) ';
  31.   if ($isData) {
  32.     out += '  )  ';
  33.   }
  34.   out += ' ) {   ';
  35.   var $$outStack = $$outStack || [];
  36.   $$outStack.push(out);
  37.   out = ''; /* istanbul ignore else */
  38.   if (it.createErrors !== false) {
  39.     out += ' { keyword: \'' + ($errorKeyword || 'multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';
  40.     if (it.opts.messages !== false) {
  41.       out += ' , message: \'should be multiple of ';
  42.       if ($isData) {
  43.         out += '\' + ' + ($schemaValue);
  44.       } else {
  45.         out += '' + ($schema) + '\'';
  46.       }
  47.     }
  48.     if (it.opts.verbose) {
  49.       out += ' , schema:  ';
  50.       if ($isData) {
  51.         out += 'validate.schema' + ($schemaPath);
  52.       } else {
  53.         out += '' + ($schema);
  54.       }
  55.       out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
  56.     }
  57.     out += ' } ';
  58.   } else {
  59.     out += ' {} ';
  60.   }
  61.   var __err = out;
  62.   out = $$outStack.pop();
  63.   if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
  64.     if (it.async) {
  65.       out += ' throw new ValidationError([' + (__err) + ']); ';
  66.     } else {
  67.       out += ' validate.errors = [' + (__err) + ']; return false; ';
  68.     }
  69.   } else {
  70.     out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
  71.   }
  72.   out += '} ';
  73.   if ($breakOnError) {
  74.     out += ' else { ';
  75.   }
  76.   return out;
  77. }
  78.  
downloadmultipleOf.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