Socket
Socket
Sign inDemoInstall

path2d-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path2d-polyfill - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

10

dist/index.esm.js

@@ -609,11 +609,11 @@ var ARG_LENGTH = {

var path2dPolyfill_1 = path2dPolyfill;
var parsePath_1 = parsePath;
var src = {
path2dPolyfill: path2dPolyfill_1,
parsePath: parsePath_1
path2dPolyfill: path2dPolyfill,
parsePath: parsePath
};
var src_1 = src.path2dPolyfill;
var src_2 = src.parsePath;
export default src;
export { parsePath_1 as parsePath, path2dPolyfill_1 as path2dPolyfill };
export { src_2 as parsePath, src_1 as path2dPolyfill };
//# sourceMappingURL=index.esm.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).path2dPolyfill={})}(this,function(e){"use strict";var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi,c=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var a=function(e){var o=[],t=String(e).trim();return"M"!==t[0]&&"m"!==t[0]||t.replace(n,function(e,t,n){var a=t.toLowerCase(),r=function(e){var t=e.match(c);return t?t.map(Number):[]}(n),s=t;if("m"===a&&2<r.length&&(o.push([s].concat(r.splice(0,2))),a="l",s="m"===s?"l":"L"),r.length<i[a])return"";for(o.push([s].concat(r.splice(0,i[a])));r.length>=i[a]&&r.length&&i[a];)o.push([s].concat(r.splice(0,i[a])));return""}),o};function o(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function l(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function L(e,t){var n=e.x*Math.cos(t)-e.y*Math.sin(t),a=e.y*Math.cos(t)+e.x*Math.sin(t);e.x=n,e.y=a}function O(e,t){e.x*=t,e.y*=t}var t=function(e){if(void 0!==e&&e.CanvasRenderingContext2D&&(!e.Path2D||!function(e){var t=e.document.createElement("canvas").getContext("2d"),n=new e.Path2D("M0 0 L1 1");return t.strokeStyle="red",t.lineWidth=1,t.stroke(n),255===t.getImageData(0,0,1,1).data[0]}(e))){var t=function(){function n(e){var t;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,n),this.segments=[],e&&e instanceof n?(t=this.segments).push.apply(t,l(e.segments)):e&&(this.segments=a(e))}return function(e,t,n){t&&o(e.prototype,t),n&&o(e,n)}(n,[{key:"addPath",value:function(e){var t;e&&e instanceof n&&(t=this.segments).push.apply(t,l(e.segments))}},{key:"moveTo",value:function(e,t){this.segments.push(["M",e,t])}},{key:"lineTo",value:function(e,t){this.segments.push(["L",e,t])}},{key:"arc",value:function(e,t,n,a,r,s){this.segments.push(["AC",e,t,n,a,r,!!s])}},{key:"arcTo",value:function(e,t,n,a,r){this.segments.push(["AT",e,t,n,a,r])}},{key:"ellipse",value:function(e,t,n,a,r,s,o,i){this.segments.push(["E",e,t,n,a,r,s,o,!!i])}},{key:"closePath",value:function(){this.segments.push(["Z"])}},{key:"bezierCurveTo",value:function(e,t,n,a,r,s){this.segments.push(["C",e,t,n,a,r,s])}},{key:"quadraticCurveTo",value:function(e,t,n,a){this.segments.push(["Q",e,t,n,a])}},{key:"rect",value:function(e,t,n,a){this.segments.push(["R",e,t,n,a])}}]),n}(),r=e.CanvasRenderingContext2D.prototype.fill,n=e.CanvasRenderingContext2D.prototype.stroke;e.CanvasRenderingContext2D.prototype.fill=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a="nonzero";0===t.length||1===t.length&&"string"==typeof t[0]?r.apply(this,t):(2===arguments.length&&(a=t[1]),s(this,t[0].segments),r.call(this,a))},e.CanvasRenderingContext2D.prototype.stroke=function(e){e&&s(this,e.segments),n.call(this)},e.Path2D=t}function s(e,t){var n,a,r,s,o,i,c,l,u,h,f,y,v,p,g,m,d,b,x,k,C,T,M,P,w,q,A,z,D,R={x:0,y:0},j={x:0,y:0};e.beginPath();for(var S=0;S<t.length;++S){var E=t[S];switch("S"!==(k=E[0])&&"s"!==k&&"C"!==k&&"c"!==k&&(M=T=null),"T"!==k&&"t"!==k&&"Q"!==k&&"q"!==k&&(w=P=null),k){case"m":case"M":"m"===k?(f+=E[1],v+=E[2]):(f=E[1],v=E[2]),"M"!==k&&R||(R={x:f,y:v}),e.moveTo(f,v);break;case"l":f+=E[1],v+=E[2],e.lineTo(f,v);break;case"L":f=E[1],v=E[2],e.lineTo(f,v);break;case"H":f=E[1],e.lineTo(f,v);break;case"h":f+=E[1],e.lineTo(f,v);break;case"V":v=E[1],e.lineTo(f,v);break;case"v":v+=E[1],e.lineTo(f,v);break;case"a":case"A":"a"===k?(f+=E[6],v+=E[7]):(f=E[6],v=E[7]),m=E[1],d=E[2],c=E[3]*Math.PI/180,r=!!E[4],s=!!E[5],o={x:f,y:v},L(i={x:(j.x-o.x)/2,y:(j.y-o.y)/2},-c),1<(l=i.x*i.x/(m*m)+i.y*i.y/(d*d))&&(m*=l=Math.sqrt(l),d*=l),u=m*m*d*d,h=m*m*i.y*i.y+d*d*i.x*i.x,O(C={x:m*i.y/d,y:-d*i.x/m},s!=r?Math.sqrt((u-h)/h)||0:-Math.sqrt((u-h)/h)||0),a=Math.atan2((i.y-C.y)/d,(i.x-C.x)/m),n=Math.atan2(-(i.y+C.y)/d,-(i.x+C.x)/m),L(C,c),A=C,z=(o.x+j.x)/2,D=(o.y+j.y)/2,A.x+=z,A.y+=D,e.save(),e.translate(C.x,C.y),e.rotate(c),e.scale(m,d),e.arc(0,0,1,a,n,!s),e.restore();break;case"C":T=E[3],M=E[4],f=E[5],v=E[6],e.bezierCurveTo(E[1],E[2],T,M,f,v);break;case"c":e.bezierCurveTo(E[1]+f,E[2]+v,E[3]+f,E[4]+v,E[5]+f,E[6]+v),T=E[3]+f,M=E[4]+v,f+=E[5],v+=E[6];break;case"S":null!==T&&null!==T||(T=f,M=v),e.bezierCurveTo(2*f-T,2*v-M,E[1],E[2],E[3],E[4]),T=E[1],M=E[2],f=E[3],v=E[4];break;case"s":null!==T&&null!==T||(T=f,M=v),e.bezierCurveTo(2*f-T,2*v-M,E[1]+f,E[2]+v,E[3]+f,E[4]+v),T=E[1]+f,M=E[2]+v,f+=E[3],v+=E[4];break;case"Q":P=E[1],w=E[2],f=E[3],v=E[4],e.quadraticCurveTo(P,w,f,v);break;case"q":P=E[1]+f,w=E[2]+v,f+=E[3],v+=E[4],e.quadraticCurveTo(P,w,f,v);break;case"T":null!==P&&null!==P||(P=f,w=v),P=2*f-P,w=2*v-w,f=E[1],v=E[2],e.quadraticCurveTo(P,w,f,v);break;case"t":null!==P&&null!==P||(P=f,w=v),P=2*f-P,w=2*v-w,f+=E[1],v+=E[2],e.quadraticCurveTo(P,w,f,v);break;case"z":case"Z":f=R.x,v=R.y,R=void 0,e.closePath();break;case"AC":f=E[1],v=E[2],g=E[3],a=E[4],n=E[5],q=E[6],e.arc(f,v,g,a,n,q);break;case"AT":y=E[1],p=E[2],f=E[3],v=E[4],g=E[5],e.arcTo(y,p,f,v,g);break;case"E":f=E[1],v=E[2],m=E[3],d=E[4],c=E[5],a=E[6],n=E[7],q=E[8],e.save(),e.translate(f,v),e.rotate(c),e.scale(m,d),e.arc(0,0,1,a,n,q),e.restore();break;case"R":f=E[1],v=E[2],b=E[3],x=E[4],R={x:f,y:v},e.rect(f,v,b,x)}j.x=f,j.y=v}}};"undefined"!=typeof window&&t(window);var r=t,s=a,u={path2dPolyfill:r,parsePath:s};e.default=u,e.parsePath=s,e.path2dPolyfill=r,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).path2dPolyfill={})}(this,function(e){"use strict";var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},a=/([astvzqmhlc])([^astvzqmhlc]*)/gi,c=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var n=function(e){var o=[],t=String(e).trim();return"M"!==t[0]&&"m"!==t[0]||t.replace(a,function(e,t,a){var n=t.toLowerCase(),r=function(e){var t=e.match(c);return t?t.map(Number):[]}(a),s=t;if("m"===n&&2<r.length&&(o.push([s].concat(r.splice(0,2))),n="l",s="m"===s?"l":"L"),r.length<i[n])return"";for(o.push([s].concat(r.splice(0,i[n])));r.length>=i[n]&&r.length&&i[n];)o.push([s].concat(r.splice(0,i[n])));return""}),o};function o(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e){return function(e){if(Array.isArray(e)){for(var t=0,a=new Array(e.length);t<e.length;t++)a[t]=e[t];return a}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function L(e,t){var a=e.x*Math.cos(t)-e.y*Math.sin(t),n=e.y*Math.cos(t)+e.x*Math.sin(t);e.x=a,e.y=n}function O(e,t){e.x*=t,e.y*=t}var t=function(e){if(void 0!==e&&e.CanvasRenderingContext2D&&(!e.Path2D||!function(e){var t=e.document.createElement("canvas").getContext("2d"),a=new e.Path2D("M0 0 L1 1");return t.strokeStyle="red",t.lineWidth=1,t.stroke(a),255===t.getImageData(0,0,1,1).data[0]}(e))){var t=function(){function a(e){var t;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,a),this.segments=[],e&&e instanceof a?(t=this.segments).push.apply(t,l(e.segments)):e&&(this.segments=n(e))}return function(e,t,a){t&&o(e.prototype,t),a&&o(e,a)}(a,[{key:"addPath",value:function(e){var t;e&&e instanceof a&&(t=this.segments).push.apply(t,l(e.segments))}},{key:"moveTo",value:function(e,t){this.segments.push(["M",e,t])}},{key:"lineTo",value:function(e,t){this.segments.push(["L",e,t])}},{key:"arc",value:function(e,t,a,n,r,s){this.segments.push(["AC",e,t,a,n,r,!!s])}},{key:"arcTo",value:function(e,t,a,n,r){this.segments.push(["AT",e,t,a,n,r])}},{key:"ellipse",value:function(e,t,a,n,r,s,o,i){this.segments.push(["E",e,t,a,n,r,s,o,!!i])}},{key:"closePath",value:function(){this.segments.push(["Z"])}},{key:"bezierCurveTo",value:function(e,t,a,n,r,s){this.segments.push(["C",e,t,a,n,r,s])}},{key:"quadraticCurveTo",value:function(e,t,a,n){this.segments.push(["Q",e,t,a,n])}},{key:"rect",value:function(e,t,a,n){this.segments.push(["R",e,t,a,n])}}]),a}(),r=e.CanvasRenderingContext2D.prototype.fill,a=e.CanvasRenderingContext2D.prototype.stroke;e.CanvasRenderingContext2D.prototype.fill=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];var n="nonzero";0===t.length||1===t.length&&"string"==typeof t[0]?r.apply(this,t):(2===arguments.length&&(n=t[1]),s(this,t[0].segments),r.call(this,n))},e.CanvasRenderingContext2D.prototype.stroke=function(e){e&&s(this,e.segments),a.call(this)},e.Path2D=t}function s(e,t){var a,n,r,s,o,i,c,l,u,h,f,y,p,v,g,m,d,b,x,k,C,T,P,M,w,q,A,z,D,R={x:0,y:0},j={x:0,y:0};e.beginPath();for(var S=0;S<t.length;++S){var E=t[S];switch("S"!==(k=E[0])&&"s"!==k&&"C"!==k&&"c"!==k&&(P=T=null),"T"!==k&&"t"!==k&&"Q"!==k&&"q"!==k&&(w=M=null),k){case"m":case"M":"m"===k?(f+=E[1],p+=E[2]):(f=E[1],p=E[2]),"M"!==k&&R||(R={x:f,y:p}),e.moveTo(f,p);break;case"l":f+=E[1],p+=E[2],e.lineTo(f,p);break;case"L":f=E[1],p=E[2],e.lineTo(f,p);break;case"H":f=E[1],e.lineTo(f,p);break;case"h":f+=E[1],e.lineTo(f,p);break;case"V":p=E[1],e.lineTo(f,p);break;case"v":p+=E[1],e.lineTo(f,p);break;case"a":case"A":"a"===k?(f+=E[6],p+=E[7]):(f=E[6],p=E[7]),m=E[1],d=E[2],c=E[3]*Math.PI/180,r=!!E[4],s=!!E[5],o={x:f,y:p},L(i={x:(j.x-o.x)/2,y:(j.y-o.y)/2},-c),1<(l=i.x*i.x/(m*m)+i.y*i.y/(d*d))&&(m*=l=Math.sqrt(l),d*=l),u=m*m*d*d,h=m*m*i.y*i.y+d*d*i.x*i.x,O(C={x:m*i.y/d,y:-d*i.x/m},s!=r?Math.sqrt((u-h)/h)||0:-Math.sqrt((u-h)/h)||0),n=Math.atan2((i.y-C.y)/d,(i.x-C.x)/m),a=Math.atan2(-(i.y+C.y)/d,-(i.x+C.x)/m),L(C,c),A=C,z=(o.x+j.x)/2,D=(o.y+j.y)/2,A.x+=z,A.y+=D,e.save(),e.translate(C.x,C.y),e.rotate(c),e.scale(m,d),e.arc(0,0,1,n,a,!s),e.restore();break;case"C":T=E[3],P=E[4],f=E[5],p=E[6],e.bezierCurveTo(E[1],E[2],T,P,f,p);break;case"c":e.bezierCurveTo(E[1]+f,E[2]+p,E[3]+f,E[4]+p,E[5]+f,E[6]+p),T=E[3]+f,P=E[4]+p,f+=E[5],p+=E[6];break;case"S":null!==T&&null!==T||(T=f,P=p),e.bezierCurveTo(2*f-T,2*p-P,E[1],E[2],E[3],E[4]),T=E[1],P=E[2],f=E[3],p=E[4];break;case"s":null!==T&&null!==T||(T=f,P=p),e.bezierCurveTo(2*f-T,2*p-P,E[1]+f,E[2]+p,E[3]+f,E[4]+p),T=E[1]+f,P=E[2]+p,f+=E[3],p+=E[4];break;case"Q":M=E[1],w=E[2],f=E[3],p=E[4],e.quadraticCurveTo(M,w,f,p);break;case"q":M=E[1]+f,w=E[2]+p,f+=E[3],p+=E[4],e.quadraticCurveTo(M,w,f,p);break;case"T":null!==M&&null!==M||(M=f,w=p),M=2*f-M,w=2*p-w,f=E[1],p=E[2],e.quadraticCurveTo(M,w,f,p);break;case"t":null!==M&&null!==M||(M=f,w=p),M=2*f-M,w=2*p-w,f+=E[1],p+=E[2],e.quadraticCurveTo(M,w,f,p);break;case"z":case"Z":f=R.x,p=R.y,R=void 0,e.closePath();break;case"AC":f=E[1],p=E[2],g=E[3],n=E[4],a=E[5],q=E[6],e.arc(f,p,g,n,a,q);break;case"AT":y=E[1],v=E[2],f=E[3],p=E[4],g=E[5],e.arcTo(y,v,f,p,g);break;case"E":f=E[1],p=E[2],m=E[3],d=E[4],c=E[5],n=E[6],a=E[7],q=E[8],e.save(),e.translate(f,p),e.rotate(c),e.scale(m,d),e.arc(0,0,1,n,a,q),e.restore();break;case"R":f=E[1],p=E[2],b=E[3],x=E[4],R={x:f,y:p},e.rect(f,p,b,x)}j.x=f,j.y=p}}};"undefined"!=typeof window&&t(window);var r={path2dPolyfill:t,parsePath:n},s=r.path2dPolyfill,u=r.parsePath;e.default=r,e.parsePath=u,e.path2dPolyfill=s,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=index.js.map
{
"name": "path2d-polyfill",
"version": "0.4.1",
"version": "0.4.2",
"description": "Polyfills Path2D api for canvas rendering",

@@ -33,16 +33,16 @@ "scripts": {

"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"chai": "^4.2.0",
"eslint": "^5.16.0",
"mocha": "^6.1.3",
"nyc": "^13.3.0",
"rollup": "^1.10.0",
"rollup-plugin-babel": "^4.3.2",
"mocha": "^6.2.0",
"nyc": "^14.1.1",
"rollup": "^1.20.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-live-server": "^1.0.3",
"rollup-plugin-uglify": "^6.0.2",
"rollup-plugin-live-server": "^1.0.3",
"sinon": "^7.3.1",
"sinon": "^7.4.1",
"sinon-chai": "^3.3.0"
}
}

@@ -8,3 +8,5 @@ const parsePath = require('./parse-path');

exports.path2dPolyfill = path2dPolyfill;
exports.parsePath = parsePath;
module.exports = {
path2dPolyfill,
parsePath,
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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