Socket
Book a DemoInstallSign in
Socket

formdata-to-object

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formdata-to-object

Convert a formData object or form DOM node to a KV object

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

formdata-to-object stability

npm version build status downloads js-standard-style

Convert a formData object or form DOM node to a KV object.

Generally you don't want to use this method, but attach a onchange listener to each input element instead. Useful in certain situations tho.

Usage

var toObject = require('formdata-to-object')
var html = require('bel')

document.body.appendChild(html`
  <form>
    <input type="text" name="name">
    <input type="password" name="password">
    <input type="submit" value="Login">
  </form>
`)

var form = document.querySelector('form')
var data = toObject(form)
console.log(data)

API

data = toObject(FormData|formElement)

Convert a window.FormData object or form element to an object.

License

MIT

Keywords

form

FAQs

Package last updated on 24 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts