diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/ajv-keywords/keywords/switch.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) | |
download | wallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz |
node_modules
Diffstat (limited to 'node_modules/ajv-keywords/keywords/switch.js')
-rw-r--r-- | node_modules/ajv-keywords/keywords/switch.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/node_modules/ajv-keywords/keywords/switch.js b/node_modules/ajv-keywords/keywords/switch.js index 8c22bf8b9..5b0f3f830 100644 --- a/node_modules/ajv-keywords/keywords/switch.js +++ b/node_modules/ajv-keywords/keywords/switch.js @@ -1,12 +1,11 @@ 'use strict'; +var util = require('./_util'); + module.exports = function defFunc(ajv) { - if (ajv.RULES.keywords.switch) - return console.warn('Keyword switch is already defined'); + if (ajv.RULES.keywords.switch && ajv.RULES.keywords.if) return; - var metaSchemaUri = ajv._opts.v5 - ? 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#' - : 'http://json-schema.org/draft-04/schema#'; + var metaSchemaRef = util.metaSchemaRef(ajv); defFunc.definition = { inline: require('./dotjs/switch'), @@ -17,11 +16,11 @@ module.exports = function defFunc(ajv) { items: { required: [ 'then' ], properties: { - 'if': { $ref: metaSchemaUri }, + 'if': metaSchemaRef, 'then': { anyOf: [ { type: 'boolean' }, - { $ref: metaSchemaUri } + metaSchemaRef ] }, 'continue': { type: 'boolean' } |