Skip to content

A convenient JavaScript function that converts an object to a FormData instance

License

Notifications You must be signed in to change notification settings

Pab89/object-to-formdata

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

object-to-formdata

A convenient JavaScript function that converts an object to a FormData instance

const objectToFormData = require('object-to-formdata')

const object = {
  /**
   * key-value mapping
   * values can be primitives or objects
   */
}

const options = {
  /**
   * whether or not to include array indices in FormData keys
   * defaults to false
   */
  indices: false
}

const formData = objectToFormData(
  object,
  options, // optional
  existingFormData, // optional
  keyPrefix // optional
)

console.log(formData)

About

A convenient JavaScript function that converts an object to a FormData instance

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%