Skip to content

Commit 9b39d61

Browse files
committed
upgrade npm dependencies
1 parent e342bd9 commit 9b39d61

15 files changed

+3317
-1949
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"presets": [
3-
["env", {
3+
["@babel/preset-env", {
44
"targets": {
55
"browsers": ["last 2 versions", "safari >= 7"]
66
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
language: node_js
22
node_js:
3-
- "7"
3+
- "10"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Donald Chan
3+
Copyright (c) 2019 Donald Chan
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

dist/browser-image-compression.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser-image-compression.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser-image-compression.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
function getDataUrlFromFile(t){return new Promise(function(e,n){var r=new FileReader;r.readAsDataURL(t),r.onload=function(){e(r.result)},r.onerror=n})}function getFilefromDataUrl(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();return new Promise(function(r){for(var i=t.split(","),a=i[0].match(/:(.*?);/)[1],o=atob(i[1]),h=o.length,l=new Uint8Array(h);h--;)l[h]=o.charCodeAt(h);var u=void 0;try{u=new File([l],e,{type:a})}catch(t){(u=new Blob([l],{type:a})).name=e,u.lastModified=n}r(u)})}function loadImage(t){return new Promise(function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=n,r.src=t})}function drawImageInCanvas(t,e){var n=document.createElement("canvas"),r=n.getContext("2d");return Number.isInteger(e)&&(t.width>e||t.height>e)?t.width>t.height?(n.width=e,n.height=t.height/t.width*e):(n.width=t.width/t.height*e,n.height=e):(n.width=t.width,n.height=t.height),r.drawImage(t,0,0,n.width,n.height),n}function imageCompression(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.POSITIVE_INFINITY,n=arguments[2];return new Promise(function(r,i){var a,o,h,l,u,d=void 0,c=void 0,s=void 0;return t instanceof Blob||t instanceof File?/^image/.test(t.type)?(d=5,a=1024*e*1024,getDataUrlFromFile(t).then(function(e){try{return o=e,loadImage(o).then(function(e){try{return h=e,l=drawImageInCanvas(h,n),c=.9,getFilefromDataUrl(l.toDataURL(t.type,c),t.name,t.lastModified).then(function(e){try{var n=function(){return r(s)};if(s=e,"image/png"===t.type){var o,g=function e(){if(d--&&s.size>a){var n=void 0;return l.width*=.9,l.height*=.9,(u=l.getContext("2d")).drawImage(h,0,0,l.width,l.height),n=l.toDataURL(t.type,c),getFilefromDataUrl(n,t.name,t.lastModified).then(function(t){try{return s=t,e}catch(t){return i(t)}}.bind(this),i)}return[1]},f=function(){return n.call(this)};return(o=function(t){for(;t;){if(t.then)return void t.then(o,i);try{if(t.pop){if(t.length)return t.pop()?f.call(this):t;t=g}else t=t.call(this)}catch(t){return i(t)}}}.bind(this))(g)}var m,v=function e(){if(d--&&s.size>a){var n=void 0;return c*=.9,n=l.toDataURL(t.type,c),getFilefromDataUrl(n,t.name,t.lastModified).then(function(t){try{return s=t,e}catch(t){return i(t)}}.bind(this),i)}return[1]},w=function(){return n.call(this)};return(m=function(t){for(;t;){if(t.then)return void t.then(m,i);try{if(t.pop){if(t.length)return t.pop()?w.call(this):t;t=v}else t=t.call(this)}catch(t){return i(t)}}}.bind(this))(v)}catch(t){return i(t)}}.bind(this),i)}catch(t){return i(t)}}.bind(this),i)}catch(t){return i(t)}}.bind(this),i)):i(new Error("The file given is not an image")):i(new Error("The file given is not an instance of Blob or File"))}.bind(this))}imageCompression.drawImageInCanvas=drawImageInCanvas,imageCompression.getDataUrlFromFile=getDataUrlFromFile,imageCompression.getFilefromDataUrl=getFilefromDataUrl,imageCompression.loadImage=loadImage;export default imageCompression;
1+
function t(t){return new Promise(function(e,n){var r=new FileReader;r.readAsDataURL(t),r.onload=function(){e(r.result)},r.onerror=n})}function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();return new Promise(function(r){for(var i,a=t.split(","),h=a[0].match(/:(.*?);/)[1],o=atob(a[1]),u=o.length,c=new Uint8Array(u);u--;)c[u]=o.charCodeAt(u);try{i=new File([c],e,{type:h})}catch(t){(i=new Blob([c],{type:h})).name=e,i.lastModified=n}r(i)})}function n(t){return new Promise(function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=n,r.src=t})}function r(t,e){var n=document.createElement("canvas"),r=n.getContext("2d");return Number.isInteger(e)&&(t.width>e||t.height>e)?t.width>t.height?(n.width=e,n.height=t.height/t.width*e):(n.width=t.width/t.height*e,n.height=e):(n.width=t.width,n.height=t.height),r.drawImage(t,0,0,n.width,n.height),n}function i(i){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.POSITIVE_INFINITY,h=arguments.length>2?arguments[2]:void 0;return new Promise(function(o,u){var c,d,f,l,g,s;return i instanceof Blob||i instanceof File?/^image/.test(i.type)?(c=5,d=1024*a*1024,t(i).then(function(t){try{return n(t).then(function(t){try{return l=r(f=t,h),g=1,e(l.toDataURL(i.type,g),i.name,i.lastModified).then(function(t){try{var n=function(){return o(s)};if(s=t,"image/png"===i.type){var r,a=function t(){return c--&&s.size>d?(l.width*=.9,l.height*=.9,l.getContext("2d").drawImage(f,0,0,l.width,l.height),e(l.toDataURL(i.type,g),i.name,i.lastModified).then(function(e){try{return s=e,t}catch(t){return u(t)}},u)):[1]},h=function(){return n.call(this)};return(r=function(t){for(;t;){if(t.then)return void t.then(r,u);try{if(t.pop){if(t.length)return t.pop()?h.call(this):t;t=a}else t=t.call(this)}catch(t){return u(t)}}}.bind(this))(a)}var w,m=function t(){return c--&&s.size>d?(l.width*=.9,l.height*=.9,l.getContext("2d").drawImage(f,0,0,l.width,l.height),g*=.9,e(l.toDataURL(i.type,g),i.name,i.lastModified).then(function(e){try{return s=e,t}catch(t){return u(t)}},u)):[1]},v=function(){return n.call(this)};return(w=function(t){for(;t;){if(t.then)return void t.then(w,u);try{if(t.pop){if(t.length)return t.pop()?v.call(this):t;t=m}else t=t.call(this)}catch(t){return u(t)}}}.bind(this))(m)}catch(t){return u(t)}}.bind(this),u)}catch(t){return u(t)}}.bind(this),u)}catch(t){return u(t)}}.bind(this),u)):u(new Error("The file given is not an image")):u(new Error("The file given is not an instance of Blob or File"))})}i.drawImageInCanvas=r,i.getDataUrlFromFile=t,i.getFilefromDataUrl=e,i.loadImage=n;export default i;
22
//# sourceMappingURL=browser-image-compression.mjs.map

0 commit comments

Comments
 (0)