Socket
Socket
Sign inDemoInstall

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 4.0.5 to 4.0.6

4

esm.min.js

@@ -9,3 +9,3 @@ /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */

f=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b?.[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c):b]:[a,b+'']),
e=c=>c.replace(/\n/g,'%0A').replace(/\r/g,'%0D').replace(/"/g,'%22')
e=(c,f)=>(f?c:c.replace(/\r?\n|\r/g,'\r\n')).replace(/\n/g,'%0A').replace(/\r/g,'%0D').replace(/"/g,'%22')

@@ -33,4 +33,4 @@ export const File = F

?c.push(p+e(n)+`"\r\n\r\n${v.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n')}\r\n`)
:c.push(p+e(n)+`"; filename="${e(v.name)}"\r\nContent-Type: ${v.type||"application/octet-stream"}\r\n\r\n`, v, '\r\n'))
:c.push(p+e(n)+`"; filename="${e(v.name, 1)}"\r\nContent-Type: ${v.type||"application/octet-stream"}\r\n\r\n`, v, '\r\n'))
c.push(`--${b}--`)
return new B(c,{type:"multipart/form-data; boundary="+b})}
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
const escape = str => str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22')
const escape = (str, filename) =>
(filename ? str : str.replace(/\r?\n|\r/g, '\r\n'))
.replace(/\n/g, '%0A')
.replace(/\r/g, '%0D')
.replace(/"/g, '%22')

@@ -22,3 +26,3 @@ /**

chunks.push(
prefix + escape(name) + `"; filename="${escape(value.name)}"\r\n` +
prefix + escape(name) + `"; filename="${escape(value.name, 1)}"\r\n` +
`Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`,

@@ -25,0 +29,0 @@ value,

@@ -97,3 +97,3 @@ /* formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */

function normalizeLinefeeds (value) {
return value.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n')
return value.replace(/\r?\n|\r/g, '\r\n')
}

@@ -339,4 +339,4 @@

this.forEach((value, name) => typeof value == 'string'
? chunks.push(p + escape(name) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
: chunks.push(p + escape(name) + `"; filename="${escape(value.name)}"\r\nContent-Type: ${value.type||"application/octet-stream"}\r\n\r\n`, value, `\r\n`))
? chunks.push(p + escape(normalizeLinefeeds(name)) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
: chunks.push(p + escape(normalizeLinefeeds(name)) + `"; filename="${escape(value.name)}"\r\nContent-Type: ${value.type||"application/octet-stream"}\r\n\r\n`, value, `\r\n`))
chunks.push(`--${boundary}--`)

@@ -343,0 +343,0 @@ return new Blob(chunks, {

/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
;(function(){Error(23): java.lang.RuntimeException: java.lang.InterruptedException
at com.google.javascript.jscomp.NodeTraversal.initTraversal(NodeTraversal.java:1305)
at com.google.javascript.jscomp.NodeTraversal.traverseRoots(NodeTraversal.java:476)
at com.google.javascript.jscomp.NodeTraversal.access$400(NodeTraversal.java:38)
at com.google.javascript.jscomp.NodeTraversal$Builder.traverseRoots(NodeTraversal.java:406)
at com.google.javascript.jscomp.NodeTraversal.traverseRoots(NodeTraversal.java:492)
at com.google.javascript.jscomp.MethodCompilerPass.process(MethodCompilerPass.java:75)
at com.google.javascript.jscomp.InlineSimpleMethods.process(InlineSimpleMethods.java:71)
at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:317)
at com.google.javascript.jscomp.PhaseOptimizer$Loop.process(PhaseOptimizer.java:462)
at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:232)
at com.google.javascript.jscomp.Compiler.performOptimizations(Compiler.java:2494)
at com.google.javascript.jscomp.Compiler.lambda$stage2Passes$5(Compiler.java:824)
at com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread(CompilerExecutor.java:127)
at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:849)
at com.google.javascript.jscomp.Compiler.stage2Passes(Compiler.java:821)
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:710)
at com.google.javascript.jscomp.webservice.backend.CompilerInvokerImpl.compile(CompilerInvokerImpl.java:44)
at com.google.javascript.jscomp.webservice.backend.ServerController.executeRequest(ServerController.java:178)
at com.google.javascript.jscomp.webservice.backend.CompilationRequestHandler.serviceParsedRequest(CompilationRequestHandler.java:178)
at com.google.javascript.jscomp.webservice.backend.CompilationRequestHandler.service(CompilationRequestHandler.java:160)
at com.google.javascript.jscomp.webservice.frontend.CompilationServlet.doPost(CompilationServlet.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1780)
at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:62)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at com.google.apphosting.runtime.jetty9.ParseBlobUploadHandler.handle(ParseBlobUploadHandler.java:111)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1182)
at com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.doHandle(AppEngineWebAppContext.java:187)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:513)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:293)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:539)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
at com.google.apphosting.runtime.jetty9.RpcConnection.handle(RpcConnection.java:216)
at com.google.apphosting.runtime.jetty9.RpcConnector.serviceRequest(RpcConnector.java:81)
at com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:134)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:794)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:757)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:727)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:261)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.InterruptedException
... 52 more
;(function(){var h;function l(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}}var m="function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){if(a==Array.prototype||a==Object.prototype)return a;a[c]=b.value;return a};
function n(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var c=0;c<a.length;++c){var b=a[c];if(b&&b.Math==Math)return b}throw Error("Cannot find global object");}var q=n(this);function r(a,c){if(c)a:{for(var b=q,d=a.split("."),e=0;e<d.length-1;e++){var f=d[e];if(!(f in b))break a;b=b[f]}d=d[d.length-1];e=b[d];f=c(e);f!=e&&null!=f&&m(b,d,{configurable:!0,writable:!0,value:f})}}
r("Symbol",function(a){function c(f){if(this instanceof c)throw new TypeError("Symbol is not a constructor");return new b(d+(f||"")+"_"+e++,f)}function b(f,g){this.A=f;m(this,"description",{configurable:!0,writable:!0,value:g})}if(a)return a;b.prototype.toString=function(){return this.A};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return c});
r("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var c="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),b=0;b<c.length;b++){var d=q[c[b]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&m(d.prototype,a,{configurable:!0,writable:!0,value:function(){return u(l(this))}})}return a});function u(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}
function v(a){var c="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return c?c.call(a):{next:l(a)}}var w;if("function"==typeof Object.setPrototypeOf)w=Object.setPrototypeOf;else{var y;a:{var z={a:!0},A={};try{A.__proto__=z;y=A.a;break a}catch(a){}y=!1}w=y?function(a,c){a.__proto__=c;if(a.__proto__!==c)throw new TypeError(a+" is not extensible");return a}:null}var B=w;function C(){this.m=!1;this.j=null;this.v=void 0;this.h=1;this.u=this.C=0;this.l=null}
function D(a){if(a.m)throw new TypeError("Generator is already running");a.m=!0}C.prototype.o=function(a){this.v=a};C.prototype.s=function(a){this.l={D:a,F:!0};this.h=this.C||this.u};C.prototype["return"]=function(a){this.l={"return":a};this.h=this.u};function E(a,c){a.h=3;return{value:c}}function F(a){this.g=new C;this.G=a}F.prototype.o=function(a){D(this.g);if(this.g.j)return G(this,this.g.j.next,a,this.g.o);this.g.o(a);return H(this)};
function I(a,c){D(a.g);var b=a.g.j;if(b)return G(a,"return"in b?b["return"]:function(d){return{value:d,done:!0}},c,a.g["return"]);a.g["return"](c);return H(a)}F.prototype.s=function(a){D(this.g);if(this.g.j)return G(this,this.g.j["throw"],a,this.g.o);this.g.s(a);return H(this)};
function G(a,c,b,d){try{var e=c.call(a.g.j,b);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.g.m=!1,e;var f=e.value}catch(g){return a.g.j=null,a.g.s(g),H(a)}a.g.j=null;d.call(a.g,f);return H(a)}function H(a){for(;a.g.h;)try{var c=a.G(a.g);if(c)return a.g.m=!1,{value:c.value,done:!1}}catch(b){a.g.v=void 0,a.g.s(b)}a.g.m=!1;if(a.g.l){c=a.g.l;a.g.l=null;if(c.F)throw c.D;return{value:c["return"],done:!0}}return{value:void 0,done:!0}}
function J(a){this.next=function(c){return a.o(c)};this["throw"]=function(c){return a.s(c)};this["return"]=function(c){return I(a,c)};this[Symbol.iterator]=function(){return this}}function K(a,c){var b=new J(new F(c));B&&a.prototype&&B(b,a.prototype);return b}
if("undefined"!==typeof Blob&&("undefined"===typeof FormData||!FormData.prototype.keys)){var L=function(a,c){for(var b=0;b<a.length;b++)c(a[b])},M=function(a){return a.replace(/\r?\n|\r/g,"\r\n")},N=function(a,c,b){if(c instanceof Blob){b=void 0!==b?String(b+""):"string"===typeof c.name?c.name:"blob";if(c.name!==b||"[object Blob]"===Object.prototype.toString.call(c))c=new File([c],b);return[String(a),c]}return[String(a),String(c)]},O=function(a,c){if(a.length<c)throw new TypeError(c+" argument required, but only "+
a.length+" present.");},P="object"===typeof globalThis?globalThis:"object"===typeof window?window:"object"===typeof self?self:this,Q=P.FormData,R=P.XMLHttpRequest&&P.XMLHttpRequest.prototype.send,S=P.Request&&P.fetch,T=P.navigator&&P.navigator.sendBeacon,U=P.Element&&P.Element.prototype,V=P.Symbol&&Symbol.toStringTag;V&&(Blob.prototype[V]||(Blob.prototype[V]="Blob"),"File"in P&&!File.prototype[V]&&(File.prototype[V]="File"));try{new File([],"")}catch(a){P.File=function(c,b,d){c=new Blob(c,d||{});
Object.defineProperties(c,{name:{value:b},lastModified:{value:+(d&&void 0!==d.lastModified?new Date(d.lastModified):new Date)},toString:{value:function(){return"[object File]"}}});V&&Object.defineProperty(c,V,{value:"File"});return c}}var escape=function(a){return a.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},W=function(a){this.i=[];var c=this;a&&L(a.elements,function(b){if(b.name&&!b.disabled&&"submit"!==b.type&&"button"!==b.type&&!b.matches("form fieldset[disabled] *"))if("file"===
b.type){var d=b.files&&b.files.length?b.files:[new File([],"",{type:"application/octet-stream"})];L(d,function(e){c.append(b.name,e)})}else"select-multiple"===b.type||"select-one"===b.type?L(b.options,function(e){!e.disabled&&e.selected&&c.append(b.name,e.value)}):"checkbox"===b.type||"radio"===b.type?b.checked&&c.append(b.name,b.value):(d="textarea"===b.type?M(b.value):b.value,c.append(b.name,d))})};h=W.prototype;h.append=function(a,c,b){O(arguments,2);this.i.push(N(a,c,b))};h["delete"]=function(a){O(arguments,
1);var c=[];a=String(a);L(this.i,function(b){b[0]!==a&&c.push(b)});this.i=c};h.entries=function c(){var b,d=this;return K(c,function(e){1==e.h&&(b=0);if(3!=e.h)return b<d.i.length?e=E(e,d.i[b]):(e.h=0,e=void 0),e;b++;e.h=2})};h.forEach=function(c,b){O(arguments,1);for(var d=v(this),e=d.next();!e.done;e=d.next()){var f=v(e.value);e=f.next().value;f=f.next().value;c.call(b,f,e,this)}};h.get=function(c){O(arguments,1);var b=this.i;c=String(c);for(var d=0;d<b.length;d++)if(b[d][0]===c)return b[d][1];
return null};h.getAll=function(c){O(arguments,1);var b=[];c=String(c);L(this.i,function(d){d[0]===c&&b.push(d[1])});return b};h.has=function(c){O(arguments,1);c=String(c);for(var b=0;b<this.i.length;b++)if(this.i[b][0]===c)return!0;return!1};h.keys=function b(){var d=this,e,f,g,k,p;return K(b,function(t){1==t.h&&(e=v(d),f=e.next());if(3!=t.h){if(f.done){t.h=0;return}g=f.value;k=v(g);p=k.next().value;return E(t,p)}f=e.next();t.h=2})};h.set=function(b,d,e){O(arguments,2);b=String(b);var f=[],g=N(b,
d,e),k=!0;L(this.i,function(p){p[0]===b?k&&(k=!f.push(g)):f.push(p)});k&&f.push(g);this.i=f};h.values=function d(){var e=this,f,g,k,p,t;return K(d,function(x){1==x.h&&(f=v(e),g=f.next());if(3!=x.h){if(g.done){x.h=0;return}k=g.value;p=v(k);p.next();t=p.next().value;return E(x,t)}g=f.next();x.h=2})};W.prototype._asNative=function(){for(var d=new Q,e=v(this),f=e.next();!f.done;f=e.next()){var g=v(f.value);f=g.next().value;g=g.next().value;d.append(f,g)}return d};W.prototype._blob=function(){var d="----formdata-polyfill-"+
Math.random(),e=[],f="--"+d+'\r\nContent-Disposition: form-data; name="';this.forEach(function(g,k){return"string"==typeof g?e.push(f+escape(M(k))+('"\r\n\r\n'+M(g)+"\r\n")):e.push(f+escape(M(k))+('"; filename="'+escape(g.name)+'"\r\nContent-Type: '+(g.type||"application/octet-stream")+"\r\n\r\n"),g,"\r\n")});e.push("--"+d+"--");return new Blob(e,{type:"multipart/form-data; boundary="+d})};W.prototype[Symbol.iterator]=function(){return this.entries()};W.prototype.toString=function(){return"[object FormData]"};
U&&!U.matches&&(U.matches=U.matchesSelector||U.mozMatchesSelector||U.msMatchesSelector||U.oMatchesSelector||U.webkitMatchesSelector||function(d){d=(this.document||this.ownerDocument).querySelectorAll(d);for(var e=d.length;0<=--e&&d.item(e)!==this;);return-1<e});V&&(W.prototype[V]="FormData");if(R){var X=P.XMLHttpRequest.prototype.setRequestHeader;P.XMLHttpRequest.prototype.setRequestHeader=function(d,e){X.call(this,d,e);"content-type"===d.toLowerCase()&&(this.B=!0)};P.XMLHttpRequest.prototype.send=
function(d){d instanceof W?(d=d._blob(),this.B||this.setRequestHeader("Content-Type",d.type),R.call(this,d)):R.call(this,d)}}S&&(P.fetch=function(d,e){e&&e.body&&e.body instanceof W&&(e.body=e.body._blob());return S.call(this,d,e)});T&&(P.navigator.sendBeacon=function(d,e){e instanceof W&&(e=e._asNative());return T.call(this,d,e)});P.FormData=W};
})();
{
"name": "formdata-polyfill",
"version": "4.0.5",
"version": "4.0.6",
"description": "HTML5 `FormData` for Browsers and Node.",

@@ -5,0 +5,0 @@ "type": "module",

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