1.2.0 • Published 2 years ago

@ankit_brahmbhatt/toformdata v1.2.0

Weekly downloads
7
License
MIT
Repository
github
Last release
2 years ago

toFormData

A small javascript utility for converting to form data

npm

Install

npm install @ankit_brahmbhatt/toFormData

Usage

import { toFormData } from "@ankit_brahmbhatt/toformdata";

const object = {
  /**
   * key-value mapping
   */
};

const options = {
  /**
   * Remove null and undefined values from formData object
   */
  removeNullAndUndefined: false,

  /**
   * Use bracket format instead of dot format for js objects . Defaults to false
   */
  useBracketsForObjects: false,
};

const formData = toFormData(
  object,
  options // optional
);

// log formdata to the console
for (let value of formData.entries()) {
  console.log(value[0] + ", " + value[1]);
}
1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago