npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@polyfiller/form-data

v0.0.40

Published

A robust polyfill for the 'FormData' interface

Downloads

5

Readme

A robust polyfill for the 'FormData' interface

Description

This is a robust, feature complete polyfill for the FormData Web API that is accessible in Window or Worker contexts. It differs from existing implementations in that by default, it won't replace the existing FormData constructor in browsers that support a subset of the API, such as IE 10 and IE 11. This avoids having to patch other APIs such as fetch or XmlHttpRequest and makes it a seamless drop-in replacement.

Features

  • A seamless drop-in replacement.
  • Only patches whatever holes are missing if FormData is already supported.
  • Doesn't patch any other APIs.

Backers

| | | | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | | BubblesTwitter: @usebubbles | Christopher Blanchard | Ideal Postcodes | Xerox |

Patreon

Table of Contents

Install

npm

$ npm install @polyfiller/form-data

Yarn

$ yarn add @polyfiller/form-data

pnpm

$ pnpm add @polyfiller/form-data

Applying the polyfill

The polyfill will check if the browser already supports FormData and will only be applied if the runtime doesn't already support it.

To include it, add this somewhere in either a Window or Worker context:

import "@polyfiller/form-data/polyfill";

However, it is generally a good idea that you only include the polyfill for runtimes that don't already support FormData. One way to do so is with an async import:

if (typeof FormData === "undefined") {
	await import("@polyfiller/form-data/polyfill");
}

Alternatively, you can use Polyfill.app which uses this polyfill and takes care of only loading the polyfill if needed as well as adding the language features that the polyfill depends on (See dependencies).

Usage

This polyfill is a drop-in replacement, so you shouldn't have to update your code by any means.

Dependencies & Browser support

This polyfill is distributed in ES5-compatible syntax, and will add features such as Symbol.toStringTag and Symbol.iterator depending on the availability in the runtime. There are no hard dependencies below ES5.

Generally, I would highly recommend using something like Polyfill.app which takes care of this stuff automatically.

Maintainers

| | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Frederik WessbergTwitter: @FredWessbergGithub: @wessbergLead Developer |

FAQ

Are there any known quirks?

If you load this polyfill In IE <=9 where there is no FormData constructor, and you add one or more File objects as FormData, you will have to add some special handling for passing them as body to the request options when using XmlHttpRequest or a polyfilled version of the fetch Api, as these do not natively support FormData in these browsers.

License

MIT © Frederik Wessberg (@FredWessberg) (Website)