diff options
Diffstat (limited to 'app/node_modules/okschema/index.js')
| -rw-r--r-- | app/node_modules/okschema/index.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js index 0829807..4e8ea73 100644 --- a/app/node_modules/okschema/index.js +++ b/app/node_modules/okschema/index.js @@ -24,8 +24,14 @@ var types = { 'enum': { parent: {type: 'string'}, assertValid: function(spec, value) { - if (~spec.options.indexOf(value)) { - throw [] + value = value || ''; + if (spec.options.indexOf(value.trim()) === -1) { + throw [{ + constraint: 'enum', + actual: value, + expected: JSON.stringify(spec.options), + message: 'Invalid value' + }]; } } } |
