From 073b2af3e21edccb35dad6b5bfdda2772f164abf Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 24 Oct 2016 17:27:36 -0400 Subject: fix issue with empty schemas --- app/node_modules/okschema/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js index 0048fc5..39845ea 100644 --- a/app/node_modules/okschema/index.js +++ b/app/node_modules/okschema/index.js @@ -30,7 +30,8 @@ var types = { parent: {type: 'string'}, assertValid: function(spec, value) { value = value || ''; - if (spec.options.indexOf(value.trim()) === -1) { + if ( (spec.options.length && spec.options.indexOf(value.trim()) === -1) || + (! spec.options.length && Object.keys(spec.options).indexOf(value.trim()) === -1)) { throw [{ constraint: 'enum', actual: value, -- cgit v1.2.3-70-g09d2