diff --git a/lib/utils.js b/lib/utils.js index f6e8c705..b1bce5f5 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -454,7 +454,7 @@ var merge = function merge(schema, form, ignore, options, readonly) { var stdForm = getDefaults(schema, ignore, options); // simple case, we have a "*", just put the stdForm there - var idx = form.indexOf("*"); + var idx = form.indexOf && form.indexOf("*") || -1; if (idx !== -1) { form = form.slice(0, idx).concat(stdForm.form).concat(form.slice(idx + 1)); } diff --git a/src/utils.js b/src/utils.js index 08907253..542b96a6 100644 --- a/src/utils.js +++ b/src/utils.js @@ -457,7 +457,7 @@ const merge = (schema, form, ignore, options, readonly) => { const stdForm = getDefaults(schema, ignore, options); // simple case, we have a "*", just put the stdForm there - const idx = form.indexOf("*"); + const idx = form.indexOf && form.indexOf("*") || -1; if (idx !== -1) { form = form .slice(0, idx)