This bundle contains some useful form utilities to use in your (web)app.
..
1. | Installation |
2. | Features |
Simply execute the following:
npm i @ambitiondev/form-utils --save
or:
yarn add @ambitiondev/form-utils
This function converts your formdata entries to a JSON-object. Useful for endpoints that require JSON in stead of form data.
import { formDataToJSON } from '@ambitiondev/form-utils'
const form = document.querySelector('form');
const data = new FormData(form);
...
const processedData = formDataToJSON(data);
This should return your form data as an object, like so:
{
"name": "developer@testdata.dev",
"address": "Ambition street 4",
...
}