@switch-company/form-utils

1.0.0 • Public • Published

Switch - formUtils

Convenience methods for form datas


.toJSON( HTMLFormElement, Boolean )

Return a JSON object containing the name and values of each field element of the form. If the form contains fields with the same name, the values of those fields will be in an array.

Parameters

  • HTMLFormElement - the form element you want the data from
  • Boolean - Whether or not limit the object to string values. Filter out file inputs. Defaults to false.

.toQuery( HTMLFormElement )

Retrun a query string without the leading ?.

.hasFile( HTMLForElement )

Return true if the form has at least one file input that is not empty.

Readme

Keywords

none

Package Sidebar

Install

npm i @switch-company/form-utils

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

12.9 kB

Total Files

16

Last publish

Collaborators

  • dpetton
  • sdussaut
  • enwin