Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Convenient JavaScript function that serializes Objects to FormData instances.

License

NotificationsYou must be signed in to change notification settings

therealparmesh/object-to-formdata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convenient JavaScript function that serializes Objects to FormData instances.

npmnpm

Install

npm install object-to-formdata

Usage

NOTE: STARTING WITH VERSION 4.0.0, THE NAMED EXPORT HAS CHANGED!

NOTE: STARTING WITH VERSION 3.0.0, THERE IS NO DEFAULT EXPORT!

import{serialize}from'object-to-formdata';constobject={/**   * key-value mapping   * values can be primitives or objects   */};constoptions={/**   * include array indices in FormData keys   * defaults to false   */indices:false,/**   * treat null values like undefined values and ignore them   * defaults to false   */nullsAsUndefineds:false,/**   * convert true or false to 1 or 0 respectively   * defaults to false   */booleansAsIntegers:false,/**   * store arrays even if they're empty   * defaults to false   */allowEmptyArrays:false,/**   * don't include array notation in FormData keys for any attributes except Files in arrays   * defaults to false   */noAttributesWithArrayNotation:false,/**   * don't include array notation in FormData keys for Files in arrays   * defaults to false   */noFilesWithArrayNotation:false,/**   * use dots instead of brackets for object notation in FormData keys   * defaults to false   */dotsForObjectNotation:false,};constformData=serialize(object,options,// optionalexistingFormData,// optionalkeyPrefix,// optional);console.log(formData);

About

Convenient JavaScript function that serializes Objects to FormData instances.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors14


[8]ページ先頭

©2009-2025 Movatter.jp