@rpldy/sender
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -22,2 +22,25 @@ "use strict"; | ||
/** | ||
* mimics FormData.set() when its not available (react-native) | ||
* in case FormData.delete() isnt available, will append only (unlike set) | ||
*/ | ||
var addToFormData = function addToFormData(fd, name) { | ||
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
rest[_key - 2] = arguments[_key]; | ||
} | ||
//rest = [value, fileName = undefined] | ||
if (fd.set) { | ||
// $FlowFixMe - ignore flow for not allowing FileLike here | ||
fd.set.apply(fd, [name].concat(rest)); | ||
} else { | ||
if (fd["delete"]) { | ||
fd["delete"](name); | ||
} // $FlowFixMe - ignore flow for not allowing FileLike here | ||
fd.append.apply(fd, [name].concat(rest)); | ||
} | ||
}; | ||
var getFormFileField = function getFormFileField(fd, items, options) { | ||
@@ -29,6 +52,5 @@ var single = items.length === 1; | ||
if (item.file) { | ||
// $FlowFixMe - ignore flow for not allowing FileLike here | ||
fd.set(name, item.file, item.file.name); | ||
addToFormData(fd, name, item.file, item.file.name); | ||
} else if (item.url) { | ||
fd.set(name, item.url); | ||
addToFormData(fd, name, item.url); | ||
} | ||
@@ -48,3 +70,3 @@ }); | ||
return fd.set(key, val); | ||
return addToFormData(fd, key, val); | ||
}); | ||
@@ -51,0 +73,0 @@ } |
{ | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"name": "@rpldy/sender", | ||
@@ -16,10 +16,10 @@ "description": "react-uploady's default XHR sender", | ||
"scripts": { | ||
"build": "node ../../scripts/build.js", | ||
"build": "node ../../../scripts/build.js", | ||
"flow:copy": "flow-copy-source ./src ./lib --ignore **/*.test.js --ignore **/*.mock.js; cp src/types.js lib/types.js" | ||
}, | ||
"dependencies": { | ||
"@rpldy/shared": "^0.4.1" | ||
"@rpldy/shared": "^0.5.0" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.130.0" | ||
"flow-bin": "^0.133.0" | ||
}, | ||
@@ -29,3 +29,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "5978d6e0e9cf6257fdb0bce611742e2e7c95d215" | ||
"gitHead": "ccd432a0d36a69f08fa65494d0a63735767fb273" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22166
295
+ Added@rpldy/shared@0.5.0(transitive)
- Removed@rpldy/shared@0.4.1(transitive)
Updated@rpldy/shared@^0.5.0