Parse-Form
Utility convert a form to a javascript object in the way that a browser might. Supports files, and every type of native input.
Installation
npm install parse-form
Example
Submit
; const form = document;;/** * { * body: { a: { b: { c: "hello world" } } }, * files: { myFile: [...] } * } */
API
parse(form: HTMLFormElement, shallow: boolean): { body: object, files: object }
- Parses a form into a javascript object.
- If
shallow
is true then nested keys such as a[b][c] won't be expanded.
Contributions
- Use
npm test
to build and run tests.
Please feel free to create a PR!