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.1 to 1.1.2

119

karma.conf.js

@@ -0,19 +1,126 @@

const includePolyfills = function(files) {
files.unshift({
pattern: __dirname + '/node_modules/weakmap-polyfill/weakmap-polyfill.js',
included: true,
served: true,
watched: false
});
};
includePolyfills.$inject = ['config.files'];
module.exports = function(config) {
var localReporters = [
'mocha'
];
var ciReporters = [
'mocha',
'BrowserStack'
];
var localBrowsers = [
'ChromeHeadless'
];
var ciBrowsers = [
'chrome_latest_mac',
'firefox_latest_mac',
'safari_latest_mac',
'edge_16_windows_10',
'edge_15_windows_10',
'edge_14_windows_10',
'ie_11_windows_10',
'ie_10_windows_10'
];
config.set({
frameworks: ['mocha', 'chai'],
frameworks: ['mocha', 'chai', 'include-polyfills'],
files: ['tests/**/*.js'],
reporters: ['mocha'],
reporters: process.env.CI === 'true' ? ciReporters : localReporters,
browsers: process.env.CI === 'true' ? ciBrowsers : localBrowsers,
port: 9876,
colors: true,
logLevel: config.LOG_ERROR,
browsers: ['ChromeHeadless'],
autoWatch: true,
singleRun: false,
autoWatch: false,
singleRun: true,
concurrency: Infinity,
client: {
mocha: {
require: [require.resolve('./src/jsonToFormData')]
require: [
require.resolve('formdata-polyfill'),
require.resolve('./src/jsonToFormData')
]
}
},
plugins: [
'karma-*',
{
'framework:include-polyfills': ['factory', includePolyfills]
}
],
browserStack: {
project: 'json-form-data'
},
customLaunchers: {
chrome_latest_mac: {
base: 'BrowserStack',
browser: 'chrome',
browser_version: '65.0',
os: 'OS X',
os_version: 'High Sierra'
},
firefox_latest_mac: {
base: 'BrowserStack',
browser: 'Firefox',
browser_version: '60.0 beta',
os: 'OS X',
os_version: 'High Sierra'
},
safari_latest_mac: {
base: 'BrowserStack',
browser: 'Safari',
browser_version: '11.0',
os: 'OS X',
os_version: 'High Sierra'
},
edge_16_windows_10: {
base: 'BrowserStack',
browser: 'Edge',
browser_version: '16.0',
os: 'Windows',
os_version: '10'
},
edge_15_windows_10: {
base: 'BrowserStack',
browser: 'Edge',
browser_version: '15.0',
os: 'Windows',
os_version: '10'
},
edge_14_windows_10: {
base: 'BrowserStack',
browser: 'Edge',
browser_version: '14.0',
os: 'Windows',
os_version: '10'
},
ie_11_windows_10: {
base: 'BrowserStack',
browser: 'IE',
browser_version: '11.0',
os: 'Windows',
os_version: '10'
},
ie_10_windows_10: {
base: 'BrowserStack',
browser: 'IE',
browser_version: '10.0',
os: 'Windows',
os_version: '8'
}
}
})
};

10

package.json
{
"name": "json-form-data",
"version": "1.1.1",
"version": "1.1.2",
"description": "A library to convert javascript objects into form data.",
"main": "index.js",
"scripts": {
"test": "karma start"
"test": "karma start",
"test:watch": "karma start --single-run=false --auto-watch=true"
},

@@ -28,3 +29,5 @@ "repository": {

"chai": "^4.1.2",
"formdata-polyfill": "^3.0.9",
"karma": "^2.0.0",
"karma-browserstack-launcher": "^1.3.0",
"karma-chai": "^0.1.0",

@@ -34,4 +37,5 @@ "karma-chrome-launcher": "^2.2.0",

"karma-mocha-reporter": "^2.2.5",
"mocha": "^5.0.4"
"mocha": "^5.0.4",
"weakmap-polyfill": "^2.0.0"
}
}

@@ -5,2 +5,3 @@ # json-form-data

[![Build Status](https://travis-ci.org/hyperatom/json-form-data.svg?branch=master)](https://travis-ci.org/hyperatom/json-form-data)
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=YlVjYXpTc0RuR3BVUE5mTEdPWG9GZz09LS05cVlMTUIwSVRJUlkxd1EzbWZRR1hBPT0=--61c69b57f61170df75fcd4bc038eaa4f84425c4e)](https://www.browserstack.com/automate/public-build/YlVjYXpTc0RuR3BVUE5mTEdPWG9GZz09LS05cVlMTUIwSVRJUlkxd1EzbWZRR1hBPT0=--61c69b57f61170df75fcd4bc038eaa4f84425c4e)

@@ -11,3 +12,3 @@ ## Features

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

@@ -25,3 +26,4 @@ * Good unit test coverage

prop6: false,
prop7: {
prop7: new File(['file content'], 'my_file.txt'),
prop8: {
prop1: 'test',

@@ -40,3 +42,3 @@ prop2: 2,

false
]
]
}

@@ -46,2 +48,16 @@ };

var formData = window.jsonToFormData(testObject);
```
```
## Browser Support
| <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/edge.png" alt="IE / Edge" width="16px" height="16px" /></br>IE / Edge | <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/firefox.png" alt="Firefox" width="16px" height="16px" /></br>Firefox | <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/chrome.png" alt="Chrome" width="16px" height="16px" /></br>Chrome | <img src="https://raw.githubusercontent.com/godban/browsers-support-badges/master/src/images/safari.png" alt="Safari" width="16px" height="16px" /></br>Safari |
| :---------: | :---------: | :---------: | :---------: |
| IE10, IE11, Edge | latest | latest | latest
## Sponsors
<a href="http://browserstack.com/">
<img alt="BrowserStack Logo" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png" width="200" />
</a>
We use BrowserStack to automate our regression tests to ensure compatibility with supported browsers.

@@ -20,6 +20,6 @@ (function (root, factory) {

console.log(arguments);
function isArray(val) {
var toString = ({}).toString;
return toString.call(val) === '[object Array]';

@@ -57,4 +57,8 @@ }

if (isArray(jsonObject[key]) || isObject(jsonObject[key])) {
if (jsonObject[key] instanceof File) {
formData.append(propName, jsonObject[key]);
} else if (isArray(jsonObject[key]) || isObject(jsonObject[key])) {
window.jsonToFormData(jsonObject[key], propName, formData);

@@ -61,0 +65,0 @@

@@ -26,2 +26,15 @@ 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() {

@@ -28,0 +41,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