libj-formdata-extension
v1.3.0
Published
Part of libj tools
Downloads
3
Readme
libj-formdata-extension
Part of libj tools
Adds a put
function to browser's FormData
which supports a function with 'one-level' nesting of properties: String, Number, Array of Primitive values
Also adds a print
function to browser's FormData
which prints its keys and values in just "modern browsers"
Usage (npm)
npm install libj-formdata-extension
Example
import { formDataExtensions } from 'libj-formdata-extension'
var formData = new FormData();
formDataExtensions.put(formData, {
api_param_1: 'example value',
api_param_2: ['value1', 'value2', ...]
})
formDataExtensions.print(formData) //This is not supported in some browsers, anyway you won't need it much
Test
- Run this in a separate command line to start node server
node server.js
- Run one of the following to re-create bundles
npm run dev
npm run dev:watch
- Navigate to http://localhost:3000
Build
npm run build
npm run build:watch