UNPKG

@haxtheweb/haxcms-nodejs

Version:

HAXcms single and multisite nodejs server, api, and administration

1 lines 1.3 kB
export function absolutize(a){let e=0,s=0,k=0,t=0;const c=[];for(const{key:p,data:r}of a)switch(p){case"M":c.push({key:"M",data:[...r]}),[e,s]=r,[k,t]=r;break;case"m":e+=r[0],s+=r[1],c.push({key:"M",data:[e,s]}),k=e,t=s;break;case"L":c.push({key:"L",data:[...r]}),[e,s]=r;break;case"l":e+=r[0],s+=r[1],c.push({key:"L",data:[e,s]});break;case"C":c.push({key:"C",data:[...r]}),e=r[4],s=r[5];break;case"c":{const a=r.map(((a,k)=>k%2?a+s:a+e));c.push({key:"C",data:a}),e=a[4],s=a[5];break}case"Q":c.push({key:"Q",data:[...r]}),e=r[2],s=r[3];break;case"q":{const a=r.map(((a,k)=>k%2?a+s:a+e));c.push({key:"Q",data:a}),e=a[2],s=a[3];break}case"A":c.push({key:"A",data:[...r]}),e=r[5],s=r[6];break;case"a":e+=r[5],s+=r[6],c.push({key:"A",data:[r[0],r[1],r[2],r[3],r[4],e,s]});break;case"H":c.push({key:"H",data:[...r]}),e=r[0];break;case"h":e+=r[0],c.push({key:"H",data:[e]});break;case"V":c.push({key:"V",data:[...r]}),s=r[0];break;case"v":s+=r[0],c.push({key:"V",data:[s]});break;case"S":c.push({key:"S",data:[...r]}),e=r[2],s=r[3];break;case"s":{const a=r.map(((a,k)=>k%2?a+s:a+e));c.push({key:"S",data:a}),e=a[2],s=a[3];break}case"T":c.push({key:"T",data:[...r]}),e=r[0],s=r[1];break;case"t":e+=r[0],s+=r[1],c.push({key:"T",data:[e,s]});break;case"Z":case"z":c.push({key:"Z",data:[]}),e=k,s=t}return c}