summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2018-06-22 23:05:00 -0400
committercjihrig <cjihrig@gmail.com>2018-06-24 12:43:54 -0400
commit7a3bbbf41be64d04058a158f6986ec5641885f42 (patch)
tree086e84227091cfc5dfa9eb729f007424cf51feb8 /tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js
parentd5316bc27df87b62675adec517e5dd3108efd1c2 (diff)
downloadandroid-node-v8-7a3bbbf41be64d04058a158f6986ec5641885f42.tar.gz
android-node-v8-7a3bbbf41be64d04058a158f6986ec5641885f42.tar.bz2
android-node-v8-7a3bbbf41be64d04058a158f6986ec5641885f42.zip
tools: update ESLint to 5.0.0
This is a new major release of ESLint. PR-URL: https://github.com/nodejs/node/pull/20855 Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js')
-rw-r--r--tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js
index b4cd46065b..b6be640923 100644
--- a/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js
+++ b/tools/node_modules/eslint/node_modules/ajv/lib/dotjs/oneOf.js
@@ -14,8 +14,10 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
var $closingBraces = '';
$it.level++;
var $nextValid = 'valid' + $it.level;
- out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;';
- var $currentBaseId = $it.baseId;
+ var $currentBaseId = $it.baseId,
+ $prevValid = 'prevValid' + $lvl,
+ $passingSchemas = 'passingSchemas' + $lvl;
+ out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';
var $wasComposite = it.compositeRule;
it.compositeRule = $it.compositeRule = true;
var arr1 = $schema;
@@ -34,16 +36,16 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
out += ' var ' + ($nextValid) + ' = true; ';
}
if ($i) {
- out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { ';
+ out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';
$closingBraces += '}';
}
- out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;';
+ out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';
}
}
it.compositeRule = $it.compositeRule = $wasComposite;
out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
if (it.createErrors !== false) {
- out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
+ out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should match exactly one schema in oneOf\' ';
}