Package Exports
- object-to-formdata
- object-to-formdata/dist/umd.js
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 (object-to-formdata) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
object-to-formdata
object-to-formdata
is a convenient JavaScript function that converts an object to a FormData instance.
import objectToFormData from 'object-to-formdata';
const object = {
/**
* key-value mapping
* values can be primitives or objects
*/
};
const options = {
/**
* include array indices in FormData keys
* defaults to false
*/
indices: false,
/**
* convert true or false to 1 or 0 respectively
* defaults to false
*/
booleansAsIntegers: false,
/**
* treat null values like undefined values and ignore them
* defaults to false
*/
nullsAsUndefineds: false,
};
const formData = objectToFormData(
object,
options, // optional
existingFormData, // optional
keyPrefix, // optional
);
console.log(formData);