We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0fc8ea commit aaa4fa8Copy full SHA for aaa4fa8
src/utils/get-form-value.js
@@ -1,4 +1,5 @@
1
import mapValues from './map-values';
2
+import toArray from './to-array';
3
4
export default function getFormValue(form) {
5
if (form && !form.$form) {
@@ -15,7 +16,7 @@ export default function getFormValue(form) {
15
16
17
delete result.$form;
18
- const isArray = Array.isArray(form.$form.value);
19
+ const isArray = form && form.$form && Array.isArray(form.$form.value);
20
- return isArray ? Object.values(result) : result;
21
+ return isArray ? toArray(result) : result;
22
}
src/utils/to-array.js
@@ -0,0 +1,9 @@
+export default function toArray(object) {
+ const result = [];
+ Object.keys(object).forEach(key => {
+ if (object.hasOwnProperty(key)) {
+ result.push(object[key]);
6
+ }
7
+ });
8
+ return result;
9
+}
0 commit comments