From 76f1f14253684324dff9f80a9f416db67d039930 Mon Sep 17 00:00:00 2001
From: Samim Pezeshki
Date: Mon, 15 Apr 2019 09:11:25 +0430
Subject: [PATCH] Check for function existence
---
lib/utils.js | 2 +-
src/utils.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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)