From 946e846fcfa192094d2f72f4d561a9cec60c6c39 Mon Sep 17 00:00:00 2001 From: "Meena.Hoda" Date: Mon, 27 Jan 2020 16:33:30 +0000 Subject: [PATCH] refactor: use default options --- lib/validate-form/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/validate-form/index.js b/lib/validate-form/index.js index 7af5643..9db5e4b 100644 --- a/lib/validate-form/index.js +++ b/lib/validate-form/index.js @@ -2,12 +2,9 @@ const schema = require('../schema.json') const validator = require('jsonschema').validate const formatters = require('./formatters') -module.exports = function validateForm (formDefinition, options) { +module.exports = function validateForm (formDefinition, options = {}) { const result = validator(formDefinition, schema) - // TODO: Make this more robust! - if (options === undefined) options = {} - const formatter = options.format ? formatters[options.format] : formatters.simple if (!formatter) throw new Error(`Unknown format '${options.format}'`)