diff options
Diffstat (limited to 'src/lib/form_utils.ts')
-rw-r--r-- | src/lib/form_utils.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/form_utils.ts b/src/lib/form_utils.ts new file mode 100644 index 0000000..a4e7bff --- /dev/null +++ b/src/lib/form_utils.ts @@ -0,0 +1,10 @@ +export function deleteEmptyFields(form: FormData) { + const trimmed_form = form; + + for(const key of trimmed_form) { + if(trimmed_form.get(key[0]) == '') + trimmed_form.delete(key[0]); + } + + return trimmed_form; +}
\ No newline at end of file |