From 3f5735299d057db4f92b39d532d7d9177c266731 Mon Sep 17 00:00:00 2001 From: Zaytsev Kirill Date: Mon, 26 Oct 2020 00:07:23 +0300 Subject: [PATCH] refactor: Moved utils to separated files, code cleanup --- src/Formulario.ts | 2 +- src/FormularioForm.vue | 43 +++--- src/FormularioInput.vue | 2 +- src/form/registry.ts | 16 +- src/libs/utils.ts | 203 ------------------------- src/shims-ext.d.ts | 6 - src/utils/arrayify.ts | 20 +++ src/utils/clone.ts | 22 +++ src/utils/has.ts | 6 + src/utils/index.ts | 67 ++++++++ src/utils/isScalar.ts | 12 ++ src/utils/merge.ts | 2 +- src/utils/regexForFormat.ts | 25 +++ src/utils/shallowEqualObjects.ts | 34 +++++ src/utils/snakeToCamel.ts | 11 ++ src/validation/ErrorObserver.ts | 2 +- src/validation/rules.ts | 2 +- src/validation/validator.ts | 20 +-- test/unit/utils.test.js | 116 -------------- test/unit/utils/clone.test.js | 28 ++++ test/unit/utils/isScalar.test.js | 17 +++ test/unit/{ => utils}/merge.test.js | 0 test/unit/utils/regexForFormat.test.js | 79 ++++++++++ test/unit/utils/snakeToCamel.test.js | 27 ++++ test/unit/validation/rules.test.js | 1 - 25 files changed, 380 insertions(+), 383 deletions(-) delete mode 100644 src/libs/utils.ts create mode 100644 src/utils/arrayify.ts create mode 100644 src/utils/clone.ts create mode 100644 src/utils/has.ts create mode 100644 src/utils/index.ts create mode 100644 src/utils/isScalar.ts create mode 100644 src/utils/regexForFormat.ts create mode 100644 src/utils/shallowEqualObjects.ts create mode 100644 src/utils/snakeToCamel.ts delete mode 100644 test/unit/utils.test.js create mode 100644 test/unit/utils/clone.test.js create mode 100644 test/unit/utils/isScalar.test.js rename test/unit/{ => utils}/merge.test.js (100%) create mode 100644 test/unit/utils/regexForFormat.test.js create mode 100644 test/unit/utils/snakeToCamel.test.js diff --git a/src/Formulario.ts b/src/Formulario.ts index 0ba3718..c4879f5 100644 --- a/src/Formulario.ts +++ b/src/Formulario.ts @@ -5,8 +5,8 @@ import messages from '@/validation/messages' import merge from '@/utils/merge' import FormularioForm from '@/FormularioForm.vue' -import FormularioInput from '@/FormularioInput.vue' import FormularioGrouping from '@/FormularioGrouping.vue' +import FormularioInput from '@/FormularioInput.vue' import { ValidationContext, diff --git a/src/FormularioForm.vue b/src/FormularioForm.vue index c61fe46..eea8872 100644 --- a/src/FormularioForm.vue +++ b/src/FormularioForm.vue @@ -6,15 +6,8 @@