@infoservice/object-to-formdata
    TypeScript icon, indicating that this package has built-in type declarations

    1.6.5 • Public • Published

    object-to-formdata

    npm npm

    object-to-formdata is 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,
     
      /**
       * whether or not to include null values as empty strings in FormData instance
       * defaults to true
       */
      nulls: true
    };
     
    const formData = objectToFormData(
      object,
      options, // optional
      existingFormData, // optional
      keyPrefix // optional
    );
     
    console.log(formData);

    Install

    npm i @infoservice/object-to-formdata

    DownloadsWeekly Downloads

    2

    Version

    1.6.5

    License

    MIT

    Unpacked Size

    12.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar