Socket
Socket
Sign inDemoInstall

form-data-entries

Package Overview
Dependencies
0
Maintainers
15
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    form-data-entries

FormData.entries ponyfill


Version published
Weekly downloads
1K
decreased by-1.66%
Maintainers
15
Install size
7.01 kB
Created
Weekly downloads
 

Readme

Source

FormData.entries ponyfill

This ponyfill implements the FormData serialization algorithm. It aims to be compatible with calling the native new FormData(form).entries(). jQuery's serializeArray is another implementation example.

Usage

import formDataEntries from 'form-data-entries'

for (const [name, value] of formDataEntries(myForm)) {
  console.log(`${name}=${value}`)
}

Why ponyfill?

This package implements FormData.entries as a module ponyfill rather than a polyfill. FormData.entries was a later addition to the FormData specification. Therefore browsers may support FormData but not the entries method. It would be dangerous to attempt to fill just this additional entries method in browsers that have partial support. This module only implements entries as a standalone function which will even work in browsers with no FormData support.

However, once FormData.entries is widely supported this package should be considered obsolete.

Undefined Behavior

This module makes a best effort to match the behavior of native FormData.entries. It should be possible in the future to replace calls to formDataEntries(form) with new FormData(form).entries(). However, there are some cases where this module can not fully match the native behavior. If the form contains any <input type=file> elements, the behavior is considered undefined and should not be relied upon.

Test Suite

FAQs

Last updated on 23 Aug 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc