Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-form-data

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-form-data - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

package.json
{
"name": "json-form-data",
"version": "1.1.2",
"version": "1.1.3",
"description": "A library to convert javascript objects into form data.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,3 +11,4 @@ # json-form-data

* Compatible with legacy web browsers
* Works with primitive data types and File blobs
* Supports all primitive data types
* Supports File and FileList data types
* Skips null and undefined values

@@ -14,0 +15,0 @@ * Good unit test coverage

@@ -32,3 +32,3 @@ (function (root, factory) {

return function(jsonObject, parentKey, carryFormData) {
function convert(jsonObject, parentKey, carryFormData) {

@@ -61,5 +61,12 @@ var formData = carryFormData || new FormData();

} else if (jsonObject[key] instanceof FileList) {
for (var j = 0; j < jsonObject[key].length; j++) {
formData.append(propName + '[' + j + ']', jsonObject[key].item(j));
}
} else if (isArray(jsonObject[key]) || isObject(jsonObject[key])) {
window.jsonToFormData(jsonObject[key], propName, formData);
convert(jsonObject[key], propName, formData);

@@ -81,3 +88,5 @@ } else if (typeof jsonObject[key] === 'boolean') {

return formData;
};
}
return convert;
}));

@@ -26,15 +26,2 @@ describe('jsonToFormData', function() {

xit('should append File objects', function() {
var testObject = {
prop1: new File(['some file content'], 'my_file.txt')
};
var formDataResult = window.jsonToFormData(testObject);
var formDataFile = formDataResult.get('prop1');
expect(formDataFile instanceof File).to.equal(true);
});
it('should convert true to 1 and false to 0', function() {

@@ -41,0 +28,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc