JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 693
  • Score
    100M100P100Q95199F
  • License MIT

Utility to easily parse a form in the browser.

Package Exports

  • parse-form

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-form) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Parse-Form

Utility convert a form to json in the way that a browser might. Supports files, and every type of native input.

Installation

Npm

npm install parse-form

Example

<form id="my-form">
    <input type="text" name="a[b][c]" value="hello world"/>
    <input type="file" name="myFyle" value=.../>
    <button type="submit">Submit</button>
</form>
var parse = require("parse-form");
var form = document.getElementById("my-form");

parse(form);
/**
 * {
 * 		body: { a: { b: { c: "hello world" } } },
 * 		files: { myFile: [...] }
 * }
 */

API

parse(

, flat: Boolean)

  • Parses a form into a javascript object.
  • If flat is true then nested keys such as a[b][c] won't be resolved.

Contributions

  • Use gulp to run tests.

Please feel free to create a PR!