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

formdata-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formdata-polyfill - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

22

FormData.js

@@ -125,15 +125,15 @@ // ==ClosureCompiler==

for (let {name, type, value, files, checked, selectedOptions} of arrayFrom(form.elements)) {
if (!name) continue
for (let elm of arrayFrom(form.elements)) {
if (!elm.name || elm.disabled) continue
if (type === 'file')
for (let file of files)
this.append(name, file)
else if (type === 'select-multiple' || type === 'select-one')
for (let elm of arrayFrom(selectedOptions))
this.append(name, elm.value)
else if (type === 'checkbox' || type === 'radio') {
if (checked) this.append(name, value)
if (elm.type === 'file')
for (let file of elm.files)
this.append(elm.name, file)
else if (elm.type === 'select-multiple' || elm.type === 'select-one')
for (let opt of arrayFrom(elm.selectedOptions))
this.append(opt.name, opt.value)
else if (elm.type === 'checkbox' || elm.type === 'radio') {
if (elm.checked) this.append(elm.name, elm.value)
} else
this.append(name, value)
this.append(elm.name, elm.value)
}

@@ -140,0 +140,0 @@ }

@@ -1,16 +0,16 @@

var g,l="function"==typeof Object.defineProperties?Object.defineProperty:function(b,a,d){b!=Array.prototype&&b!=Object.prototype&&(b[a]=d.value)},m="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function n(){n=function(){};m.Symbol||(m.Symbol=p)}var p=function(){var b=0;return function(a){return"jscomp_symbol_"+(a||"")+b++}}();
var g,l="function"==typeof Object.defineProperties?Object.defineProperty:function(b,a,c){b!=Array.prototype&&b!=Object.prototype&&(b[a]=c.value)},m="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function n(){n=function(){};m.Symbol||(m.Symbol=p)}var p=function(){var b=0;return function(a){return"jscomp_symbol_"+(a||"")+b++}}();
function r(){n();var b=m.Symbol.iterator;b||(b=m.Symbol.iterator=m.Symbol("iterator"));"function"!=typeof Array.prototype[b]&&l(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return t(this)}});r=function(){}}function t(b){var a=0;return v(function(){return a<b.length?{done:!1,value:b[a++]}:{done:!0}})}function v(b){r();b={next:b};b[m.Symbol.iterator]=function(){return this};return b}function w(b){r();n();r();var a=b[Symbol.iterator];return a?a.call(b):t(b)}
function x(b){for(var a,d=[];!(a=b.next()).done;)d.push(a.value);return d}function z(b,a){return Object.prototype.hasOwnProperty.call(b,a)}function A(b,a){if(a){var d=m;b=b.split(".");for(var c=0;c<b.length-1;c++){var e=b[c];e in d||(d[e]={});d=d[e]}b=b[b.length-1];c=d[b];a=a(c);a!=c&&null!=a&&l(d,b,{configurable:!0,writable:!0,value:a})}}
A("WeakMap",function(b){function a(a){this.a=(f+=Math.random()+1).toString();if(a){n();r();a=w(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}}function d(a){z(a,e)||l(a,e,{value:{}})}function c(a){var b=Object[a];b&&(Object[a]=function(a){d(a);return b(a)})}if(function(){if(!b||!Object.seal)return!1;try{var a=Object.seal({}),d=Object.seal({}),c=new b([[a,2],[d,3]]);if(2!=c.get(a)||3!=c.get(d))return!1;c.delete(a);c.set(d,4);return!c.has(a)&&4==c.get(d)}catch(y){return!1}}())return b;
var e="$jscomp_hidden_"+Math.random().toString().substring(2);c("freeze");c("preventExtensions");c("seal");var f=0;a.prototype.set=function(a,b){d(a);if(!z(a,e))throw Error("WeakMap key fail: "+a);a[e][this.a]=b;return this};a.prototype.get=function(a){return z(a,e)?a[e][this.a]:void 0};a.prototype.has=function(a){return z(a,e)&&z(a[e],this.a)};a.prototype.delete=function(a){return z(a,e)&&z(a[e],this.a)?delete a[e][this.a]:!1};return a});
A("Array.from",function(b){return b?b:function(a,b,c){r();b=null!=b?b:function(a){return a};var d=[],f=a[Symbol.iterator];if("function"==typeof f)for(a=f.call(a);!(f=a.next()).done;)d.push(b.call(c,f.value));else{f=a.length;for(var h=0;h<f;h++)d.push(b.call(c,a[h]))}return d}});
if(!window.FormData||!window.FormData.prototype.keys){var B=function(b,a,d){if(2>arguments.length)throw new TypeError("2 arguments required, but only "+arguments.length+" present.");return a instanceof Blob?[b+"",a,void 0!==d?d+"":"File"===Object.prototype.toString.call(a).slice(8,-1)?a.name:"Blob"]:[b+"",a+""]},C=function(b){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");return[b+""]},D=function(b){var a=w(b);b=a.next().value;a=a.next().value;b instanceof Blob&&
(b=new File([b],a,{type:b.type,lastModified:b.lastModified}));return b},E=window.FormData,F=window.XMLHttpRequest.prototype.send,G=window.Request&&window.fetch;n();var H=window.Symbol&&Symbol.toStringTag,I=new WeakMap,J=Array.from||function(b){return[].slice.call(b)};H&&(Blob.prototype[H]||(Blob.prototype[H]="Blob"),"File"in window&&!File.prototype[H]&&(File.prototype[H]="File"));try{new File([],"")}catch(b){window.File=function(a,d,c){a=new Blob(a,c);c=c&&void 0!==c.lastModified?new Date(c.lastModified):
new Date;Object.defineProperties(a,{name:{value:d},lastModifiedDate:{value:c},lastModified:{value:+c},toString:{value:function(){return"[object File]"}}});H&&Object.defineProperty(a,H,{value:"File"});return a}}var K=function(b){I.set(this,Object.create(null));if(!b)return this;b=w(J(b.elements));for(var a=b.next();!a.done;a=b.next()){var d=a.value;a=d.name;var c=d.type,e=d.value,f=d.files,h=d.checked;d=d.selectedOptions;if(a)if("file"===c)for(c=w(f),e=c.next();!e.done;e=c.next())this.b(a,e.value);
else if("select-multiple"===c||"select-one"===c)for(c=w(J(d)),e=c.next();!e.done;e=c.next())this.b(a,e.value.value);else"checkbox"===c||"radio"===c?h&&this.b(a,e):this.b(a,e)}};g=K.prototype;g.b=function(b,a){var d=I.get(this);d[b]||(d[b]=[]);d[b].push([a,void 0])};g.entries=function(){function b(b,u,Q){for(;;)switch(a){case 0:y=I.get(R);k=[];h=y;for(f in h)k.push(f);q=0;case 1:if(!(q<k.length)){a=3;break}f=k[q];if(f in h){a=4;break}a=2;break;case 4:e=w(y[f]),c=e.next();case 5:if(c.done){a=7;break}d=
c.value;a=8;return{value:[f,D(d)],done:!1};case 8:if(1!=b){a=9;break}a=-1;throw Q;case 9:case 6:c=e.next();a=5;break;case 7:case 2:q++;a=1;break;case 3:a=-1;default:return{value:void 0,done:!0}}}var a=0,d,c,e,f,h,q,k,y,R=this,u={next:function(a){return b(0,a,void 0)},throw:function(a){return b(1,void 0,a)},return:function(){throw Error("Not yet implemented");}};r();u[Symbol.iterator]=function(){return this};return u};g.get=function(b){var a=I.get(this);return a[b]?D(a[b][0]):null};g.has=function(b){return b in
I.get(this)};g.keys=function(){function b(b,k,u){for(;;)switch(a){case 0:h=w(q),f=h.next();case 1:if(f.done){a=3;break}e=f.value;c=w(e);d=c.next().value;a=4;return{value:d,done:!1};case 4:if(1!=b){a=5;break}a=-1;throw u;case 5:case 2:f=h.next();a=1;break;case 3:a=-1;default:return{value:void 0,done:!0}}}var a=0,d,c,e,f,h,q=this,k={next:function(a){return b(0,a,void 0)},throw:function(a){return b(1,void 0,a)},return:function(){throw Error("Not yet implemented");}};r();k[Symbol.iterator]=function(){return this};
return k};g.set=function(b,a,d){I.get(this)[b]=[[a,d]]};g.values=function(){function b(b,k,u){for(;;)switch(a){case 0:h=w(q),f=h.next();case 1:if(f.done){a=3;break}e=f.value;c=w(e);c.next();d=c.next().value;a=4;return{value:d,done:!1};case 4:if(1!=b){a=5;break}a=-1;throw u;case 5:case 2:f=h.next();a=1;break;case 3:a=-1;default:return{value:void 0,done:!0}}}var a=0,d,c,e,f,h,q=this,k={next:function(a){return b(0,a,void 0)},throw:function(a){return b(1,void 0,a)},return:function(){throw Error("Not yet implemented");
}};r();k[Symbol.iterator]=function(){return this};return k};K.prototype._asNative=function(){for(var b=new E,a=w(this),d=a.next();!d.done;d=a.next()){var c=w(d.value);d=c.next().value;c=c.next().value;b.append(d,c)}return b};K.prototype._blob=function(){for(var b="----formdata-polyfill-"+Math.random(),a=[],d=w(this),c=d.next();!c.done;c=d.next()){var e=w(c.value);c=e.next().value;e=e.next().value;a.push("--"+b+"\r\n");e instanceof Blob?a.push('Content-Disposition: form-data; name="'+c+'"; filename="'+
e.name+'"\r\n',"Content-Type: "+(e.type||"application/octet-stream")+"\r\n\r\n",e,"\r\n"):a.push('Content-Disposition: form-data; name="'+c+'"\r\n\r\n'+e+"\r\n")}a.push("--"+b+"--");return new Blob(a,{type:"multipart/form-data; boundary="+b})};n();r();K.prototype[Symbol.iterator]=function(){return this.entries()};K.prototype.toString=function(){return"[object FormData]"};H&&(K.prototype[H]="FormData");for(var L={},M=w([["append",B],["delete",C],["get",C],["getAll",C],["has",C],["set",B]]),N=M.next();!N.done;L=
function x(b){for(var a,c=[];!(a=b.next()).done;)c.push(a.value);return c}function z(b,a){return Object.prototype.hasOwnProperty.call(b,a)}function A(b,a){if(a){var c=m;b=b.split(".");for(var d=0;d<b.length-1;d++){var e=b[d];e in c||(c[e]={});c=c[e]}b=b[b.length-1];d=c[b];a=a(d);a!=d&&null!=a&&l(c,b,{configurable:!0,writable:!0,value:a})}}
A("WeakMap",function(b){function a(a){this.a=(f+=Math.random()+1).toString();if(a){n();r();a=w(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}}function c(a){z(a,e)||l(a,e,{value:{}})}function d(a){var b=Object[a];b&&(Object[a]=function(a){c(a);return b(a)})}if(function(){if(!b||!Object.seal)return!1;try{var a=Object.seal({}),c=Object.seal({}),d=new b([[a,2],[c,3]]);if(2!=d.get(a)||3!=d.get(c))return!1;d.delete(a);d.set(c,4);return!d.has(a)&&4==d.get(c)}catch(y){return!1}}())return b;
var e="$jscomp_hidden_"+Math.random().toString().substring(2);d("freeze");d("preventExtensions");d("seal");var f=0;a.prototype.set=function(a,b){c(a);if(!z(a,e))throw Error("WeakMap key fail: "+a);a[e][this.a]=b;return this};a.prototype.get=function(a){return z(a,e)?a[e][this.a]:void 0};a.prototype.has=function(a){return z(a,e)&&z(a[e],this.a)};a.prototype.delete=function(a){return z(a,e)&&z(a[e],this.a)?delete a[e][this.a]:!1};return a});
A("Array.from",function(b){return b?b:function(a,b,d){r();b=null!=b?b:function(a){return a};var c=[],f=a[Symbol.iterator];if("function"==typeof f)for(a=f.call(a);!(f=a.next()).done;)c.push(b.call(d,f.value));else{f=a.length;for(var h=0;h<f;h++)c.push(b.call(d,a[h]))}return c}});
if(!window.FormData||!window.FormData.prototype.keys){var B=function(b,a,c){if(2>arguments.length)throw new TypeError("2 arguments required, but only "+arguments.length+" present.");return a instanceof Blob?[b+"",a,void 0!==c?c+"":"File"===Object.prototype.toString.call(a).slice(8,-1)?a.name:"Blob"]:[b+"",a+""]},C=function(b){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");return[b+""]},D=function(b){var a=w(b);b=a.next().value;a=a.next().value;b instanceof Blob&&
(b=new File([b],a,{type:b.type,lastModified:b.lastModified}));return b},E=window.FormData,F=window.XMLHttpRequest.prototype.send,G=window.Request&&window.fetch;n();var H=window.Symbol&&Symbol.toStringTag,I=new WeakMap,J=Array.from||function(b){return[].slice.call(b)};H&&(Blob.prototype[H]||(Blob.prototype[H]="Blob"),"File"in window&&!File.prototype[H]&&(File.prototype[H]="File"));try{new File([],"")}catch(b){window.File=function(a,c,d){a=new Blob(a,d);d=d&&void 0!==d.lastModified?new Date(d.lastModified):
new Date;Object.defineProperties(a,{name:{value:c},lastModifiedDate:{value:d},lastModified:{value:+d},toString:{value:function(){return"[object File]"}}});H&&Object.defineProperty(a,H,{value:"File"});return a}}var K=function(b){I.set(this,Object.create(null));if(!b)return this;b=w(J(b.elements));for(var a=b.next();!a.done;a=b.next())if(a=a.value,a.name&&!a.disabled)if("file"===a.type)for(var c=w(a.files),d=c.next();!d.done;d=c.next())this.b(a.name,d.value);else if("select-multiple"===a.type||"select-one"===
a.type)for(a=w(J(a.selectedOptions)),c=a.next();!c.done;c=a.next())c=c.value,this.b(c.name,c.value);else"checkbox"===a.type||"radio"===a.type?a.checked&&this.b(a.name,a.value):this.b(a.name,a.value)};g=K.prototype;g.b=function(b,a){var c=I.get(this);c[b]||(c[b]=[]);c[b].push([a,void 0])};g.entries=function(){function b(b,u,Q){for(;;)switch(a){case 0:y=I.get(R);k=[];h=y;for(f in h)k.push(f);q=0;case 1:if(!(q<k.length)){a=3;break}f=k[q];if(f in h){a=4;break}a=2;break;case 4:e=w(y[f]),d=e.next();case 5:if(d.done){a=
7;break}c=d.value;a=8;return{value:[f,D(c)],done:!1};case 8:if(1!=b){a=9;break}a=-1;throw Q;case 9:case 6:d=e.next();a=5;break;case 7:case 2:q++;a=1;break;case 3:a=-1;default:return{value:void 0,done:!0}}}var a=0,c,d,e,f,h,q,k,y,R=this,u={next:function(a){return b(0,a,void 0)},throw:function(a){return b(1,void 0,a)},return:function(){throw Error("Not yet implemented");}};r();u[Symbol.iterator]=function(){return this};return u};g.get=function(b){var a=I.get(this);return a[b]?D(a[b][0]):null};g.has=
function(b){return b in I.get(this)};g.keys=function(){function b(b,k,u){for(;;)switch(a){case 0:h=w(q),f=h.next();case 1:if(f.done){a=3;break}e=f.value;d=w(e);c=d.next().value;a=4;return{value:c,done:!1};case 4:if(1!=b){a=5;break}a=-1;throw u;case 5:case 2:f=h.next();a=1;break;case 3:a=-1;default:return{value:void 0,done:!0}}}var a=0,c,d,e,f,h,q=this,k={next:function(a){return b(0,a,void 0)},throw:function(a){return b(1,void 0,a)},return:function(){throw Error("Not yet implemented");}};r();k[Symbol.iterator]=
function(){return this};return k};g.set=function(b,a,c){I.get(this)[b]=[[a,c]]};g.values=function(){function b(b,k,u){for(;;)switch(a){case 0:h=w(q),f=h.next();case 1:if(f.done){a=3;break}e=f.value;d=w(e);d.next();c=d.next().value;a=4;return{value:c,done:!1};case 4:if(1!=b){a=5;break}a=-1;throw u;case 5:case 2:f=h.next();a=1;break;case 3:a=-1;default:return{value:void 0,done:!0}}}var a=0,c,d,e,f,h,q=this,k={next:function(a){return b(0,a,void 0)},throw:function(a){return b(1,void 0,a)},return:function(){throw Error("Not yet implemented");
}};r();k[Symbol.iterator]=function(){return this};return k};K.prototype._asNative=function(){for(var b=new E,a=w(this),c=a.next();!c.done;c=a.next()){var d=w(c.value);c=d.next().value;d=d.next().value;b.append(c,d)}return b};K.prototype._blob=function(){for(var b="----formdata-polyfill-"+Math.random(),a=[],c=w(this),d=c.next();!d.done;d=c.next()){var e=w(d.value);d=e.next().value;e=e.next().value;a.push("--"+b+"\r\n");e instanceof Blob?a.push('Content-Disposition: form-data; name="'+d+'"; filename="'+
e.name+'"\r\n',"Content-Type: "+(e.type||"application/octet-stream")+"\r\n\r\n",e,"\r\n"):a.push('Content-Disposition: form-data; name="'+d+'"\r\n\r\n'+e+"\r\n")}a.push("--"+b+"--");return new Blob(a,{type:"multipart/form-data; boundary="+b})};n();r();K.prototype[Symbol.iterator]=function(){return this.entries()};K.prototype.toString=function(){return"[object FormData]"};H&&(K.prototype[H]="FormData");for(var L={},M=w([["append",B],["delete",C],["get",C],["getAll",C],["has",C],["set",B]]),N=M.next();!N.done;L=
{f:L.f,c:L.c},N=M.next()){var O=w(N.value),P=O.next().value;L.c=O.next().value;L.f=K.prototype[P];K.prototype[P]=function(b){return function(){return b.f.apply(this,b.c.apply(null,[].concat(arguments instanceof Array?arguments:x(w(arguments)))))}}(L)}XMLHttpRequest.prototype.send=function(b){F.call(this,b instanceof K?b._blob():b)};if(G){var S=window.fetch;window.fetch=function(b,a){a&&a.body&&a.body instanceof K&&(a.body=a.body._blob());return S(b,a)}}window.FormData=K};
{
"name": "formdata-polyfill",
"version": "3.0.0",
"version": "3.0.1",
"description": "HTML5 `FormData` polyfill for Browsers.",

@@ -5,0 +5,0 @@ "main": "formdata.min.js",

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