object-to-formdata
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -1,2 +0,2 @@ | ||
var n=function(n){return void 0===n},e=function(n){return Array.isArray(n)},t=function(n){return n&&"number"==typeof n.size&&"string"==typeof n.type&&"function"==typeof n.slice},s=function(o,i,r,a){return(i=i||{}).indices=!n(i.indices)&&i.indices,i.booleansAsIntegers=!n(i.booleansAsIntegers)&&i.booleansAsIntegers,i.nullsAsUndefineds=!n(i.nullsAsUndefineds)&&i.nullsAsUndefineds,r=r||new FormData,n(o)?r:(null===o?i.nullsAsUndefineds||r.append(a,""):"boolean"==typeof o?r.append(a,i.booleansAsIntegers?o?1:0:o):e(o)?o.length?o.forEach(function(n,e){s(n,i,r,a+"["+(i.indices?e:"")+"]")}):r.append(a+"[]",""):o instanceof Date?r.append(a,o.toISOString()):o!==Object(o)||function(n){return t(n)&&"string"==typeof n.name&&("object"==typeof n.lastModifiedDate||"number"==typeof n.lastModified)}(o)||t(o)?r.append(a,o):Object.keys(o).forEach(function(n){var t=o[n];if(e(t))for(;n.length>2&&n.lastIndexOf("[]")===n.length-2;)n=n.substring(0,n.length-2);s(t,i,r,a?a+"["+n+"]":n)}),r)};exports.objectToFormData=s; | ||
var n=function(n){return void 0===n},e=function(n){return Array.isArray(n)},t=function(n){return n&&"number"==typeof n.size&&"string"==typeof n.type&&"function"==typeof n.slice},s=function(o,i,r,a){return(i=i||{}).indices=!n(i.indices)&&i.indices,i.nullsAsUndefineds=!n(i.nullsAsUndefineds)&&i.nullsAsUndefineds,i.booleansAsIntegers=!n(i.booleansAsIntegers)&&i.booleansAsIntegers,r=r||new FormData,n(o)?r:(null===o?i.nullsAsUndefineds||r.append(a,""):"boolean"==typeof o?r.append(a,i.booleansAsIntegers?o?1:0:o):e(o)?o.length?o.forEach(function(n,e){s(n,i,r,a+"["+(i.indices?e:"")+"]")}):r.append(a+"[]",""):o instanceof Date?r.append(a,o.toISOString()):o!==Object(o)||function(n){return t(n)&&"string"==typeof n.name&&("object"==typeof n.lastModifiedDate||"number"==typeof n.lastModified)}(o)||t(o)?r.append(a,o):Object.keys(o).forEach(function(n){var t=o[n];if(e(t))for(;n.length>2&&n.lastIndexOf("[]")===n.length-2;)n=n.substring(0,n.length-2);s(t,i,r,a?a+"["+n+"]":n)}),r)};exports.objectToFormData=s; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "object-to-formdata", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "form", |
@@ -36,12 +36,12 @@ # object-to-formdata | ||
/** | ||
* convert true or false to 1 or 0 respectively | ||
* treat null values like undefined values and ignore them | ||
* defaults to false | ||
*/ | ||
booleansAsIntegers: false, | ||
nullsAsUndefineds: false, | ||
/** | ||
* treat null values like undefined values and ignore them | ||
* convert true or false to 1 or 0 respectively | ||
* defaults to false | ||
*/ | ||
nullsAsUndefineds: false, | ||
booleansAsIntegers: false, | ||
}; | ||
@@ -48,0 +48,0 @@ |
@@ -30,2 +30,6 @@ const isUndefined = value => value === undefined; | ||
cfg.nullsAsUndefineds = isUndefined(cfg.nullsAsUndefineds) | ||
? false | ||
: cfg.nullsAsUndefineds; | ||
cfg.booleansAsIntegers = isUndefined(cfg.booleansAsIntegers) | ||
@@ -35,6 +39,2 @@ ? false | ||
cfg.nullsAsUndefineds = isUndefined(cfg.nullsAsUndefineds) | ||
? false | ||
: cfg.nullsAsUndefineds; | ||
fd = fd || new FormData(); | ||
@@ -41,0 +41,0 @@ |
@@ -1,2 +0,2 @@ | ||
export const useHovering: ( | ||
export const objectToFormData: ( | ||
obj: any, | ||
@@ -6,2 +6,3 @@ cfg?: { | ||
nullsAsUndefineds?: boolean; | ||
booleansAsIntegers?: boolean; | ||
}, | ||
@@ -8,0 +9,0 @@ fd?: FormData, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
21880
307