mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-07-15 20:53:20 +09:00
remove timer and simon
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
if (!ajv.RULES.keywords.switch) require('./switch')(ajv);
|
||||
|
||||
defFunc.definition = {
|
||||
macro: function (schema, parentSchema) {
|
||||
if (parentSchema.then === undefined)
|
||||
throw new Error('keyword "then" is absent');
|
||||
var cases = [ { 'if': schema, 'then': parentSchema.then } ];
|
||||
if (parentSchema.else !== undefined)
|
||||
cases[1] = { 'then': parentSchema.else };
|
||||
return { switch: cases };
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('if', defFunc.definition);
|
||||
ajv.addKeyword('then');
|
||||
ajv.addKeyword('else');
|
||||
return ajv;
|
||||
};
|
||||
Reference in New Issue
Block a user