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

ansis

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansis - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

2

index.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const{round:e,floor:t,max:n}=Math,r=e=>{let[,t]=/([a-f\d]{3,6})/i.exec(e)||[],n=t?t.length:0;if(3===n)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(6!==n)return[0,0,0];let r=parseInt(t,16);return[r>>16&255,r>>8&255,255&r]},o=(t,n,r)=>t===n&&n===r?t<8?16:t>248?231:e((t-8)/247*24)+232:16+36*e(t/51)+6*e(n/51)+e(r/51),i=r=>{let o,i,l,s,c,u;return r<8?30+r:r<16?r-8+90:(r>=232?o=i=l=(10*(r-232)+8)/255:(u=(r-=16)%36,o=t(r/36)/5,i=t(u/6)/5,l=u%6/5),s=2*n(o,i,l),0===s?30:(c=30+(e(l)<<2|e(i)<<1|e(o)),2===s?c+60:c))},l=(e,t,n)=>i(o(e,t,n)),s=(e=>{const t=e=>!!c.find((t=>e.test(t))),n=globalThis,r=n.Deno,o=null!=r,i=n.process||r||{},l=i.stdout,s="win32"===(o?r.build.os:i.platform),c=i.argv||i.args||[];let u=i.env||{},a=-1;if(o)try{u=u.toObject()}catch(e){a=0}const p="FORCE_COLOR",g=u[p],f=parseInt(g),d="false"===g?0:isNaN(f)?3:f,b="NO_COLOR"in u||0===d||t(/^-{1,2}(no-color|color=(false|never))$/),_=p in u&&d||t(/^-{1,2}color=?(true|always)?$/),O=(u.NEXT_RUNTIME||"").indexOf("edge")>-1||"PM2_HOME"in u&&"pm_id"in u||(o?r.isatty(1):l&&"isTTY"in l);return b?0:(a<0&&(a=s?3:((e,t)=>{const{TERM:n,COLORTERM:r}=e;return"TF_BUILD"in e?1:"TEAMCITY_VERSION"in e?2:"CI"in e?["GITHUB_ACTIONS","GITEA_ACTIONS"].some((t=>t in e))?3:1:!t||/-mono|dumb/i.test(n)?0:"truecolor"===r||"24bit"===r||"xterm-kitty"===n?3:/-256(colou?r)?$/i.test(n)?2:/^screen|^tmux|^xterm|^vt[1-5][0-9]([0-9])?|^ansi|color|cygwin|linux|mintty|rxvt/i.test(n)?1:3})(u,O)),_&&0===a?3:a)})(),c=s>0,u={open:"",close:""},a=c?(e,t)=>({open:`[${e}m`,close:`[${t}m`}):()=>u,p=39,g=49;let f=e=>a(`38;5;${e}`,p),d=e=>a(`48;5;${e}`,g),b=(e,t,n)=>a(`38;2;${e};${t};${n}`,p),_=(e,t,n)=>a(`48;2;${e};${t};${n}`,g);const O=e=>(t,n,r)=>e(o(t,n,r)),m=e=>t=>{let[n,o,i]=r(t);return e(n,o,i)};1===s?(f=e=>a(i(e),p),d=e=>a(i(e)+10,g),b=(e,t,n)=>a(l(e,t,n),p),_=(e,t,n)=>a(l(e,t,n)+10,g)):2===s&&(b=O(f),_=O(d));const x={visible:u,reset:a(0,0),inverse:a(7,27),hidden:a(8,28),bold:a(1,22),dim:a(2,22),italic:a(3,23),underline:a(4,24),strikethrough:a(9,29),strike:a(9,29),grey:a(90,p),gray:a(90,p),bgGrey:a(100,g),bgGray:a(100,g)};let y,h,T=["black","red","green","yellow","blue","magenta","cyan","white"],$="Bright",I=30;for(y of T)h="bg"+y[0].toUpperCase()+y.slice(1),x[y]=a(I,p),x[y+$]=a(I+60,p),x[h]=a(I+10,g),x[h+$]=a(I+70,g),I++;const R={fg:f,bg:d,rgb:b,bgRgb:_,hex:m(b),bgHex:m(_)},v=b,{defineProperty:C,defineProperties:E,setPrototypeOf:w}=Object,M=/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,N=/(\r?\n)/g,A={},P=({_p:e},{open:t,close:n})=>{const r=(e,...t)=>{if(!e)return"";let n=r._p,{_a:o,_b:i}=n,l=null!=e.raw?String.raw(e,...t):""+e;if(l.includes(""))for(;null!=n;){let e=n.close,t=e.length;if(t){let r,o=0,i="";for(;~(r=l.indexOf(e,o));)i+=l.slice(o,r)+n.open,o=r+t;o&&(l=i+l.slice(o))}n=n._p}return l.includes("\n")&&(l=l.replace(N,i+"$1"+o)),o+l+i};let o=t,i=n;return null!=e&&(o=e._a+t,i=n+e._b),w(r,k),r._p={open:t,close:n,_a:o,_b:i,_p:e},r.open=o,r.close=i,r},S=function(){const e=e=>""+e;return e.isSupported=()=>c,e.strip=e=>e.replace(M,""),e.extend=t=>{for(let e in t){let n=t[e],o=null!=n.open?n:v(...r(n));A[e]={get(){const t=P(this,o);return C(this,e,{value:t}),t}}}k=E({},A),w(e,k)},e.extend(x),e};for(let e in R)A[e]={get(){return(...t)=>P(this,R[e](...t))}};let k;A.ansi256=A.fg,A.bgAnsi256=A.bg;const G=new S;module.exports=G,module.exports.Ansis=S;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const{round:e,floor:t,max:n}=Math,r=e=>{let[,t]=/([a-f\d]{3,6})/i.exec(e)||[],n=t?t.length:0;if(3===n)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(6!==n)return[0,0,0];let r=parseInt(t,16);return[r>>16&255,r>>8&255,255&r]},i=(t,n,r)=>t===n&&n===r?t<8?16:t>248?231:e((t-8)/247*24)+232:16+36*e(t/51)+6*e(n/51)+e(r/51),o=r=>{let i,o,l,s,c,u;return r<8?30+r:r<16?r-8+90:(r>=232?i=o=l=(10*(r-232)+8)/255:(u=(r-=16)%36,i=t(r/36)/5,o=t(u/6)/5,l=u%6/5),s=2*n(i,o,l),0===s?30:(c=30+(e(l)<<2|e(o)<<1|e(i)),2===s?c+60:c))},l=(e,t,n)=>o(i(e,t,n)),s=(e=>{const t=e=>!!c.find((t=>e.test(t))),n=globalThis,r=n.Deno,i=null!=r,o=n.process||r||{},l=o.stdout,s="win32"===(i?r.build.os:o.platform),c=o.argv||o.args||[];let u=o.env||{},a=-1;if(i)try{u=u.toObject()}catch(e){a=0}const p="FORCE_COLOR",g=u[p],f=parseInt(g),d="false"===g?0:isNaN(f)?3:f,b="NO_COLOR"in u||0===d||t(/^-{1,2}(no-color|color=(false|never))$/),_=p in u&&d||t(/^-{1,2}color=?(true|always)?$/),O=(u.NEXT_RUNTIME||"").indexOf("edge")>-1||"PM2_HOME"in u&&"pm_id"in u||(i?r.isatty(1):l&&"isTTY"in l);return b?0:(a<0&&(a=((e,t,n)=>{const{TERM:r,COLORTERM:i}=e;return"TF_BUILD"in e?1:"TEAMCITY_VERSION"in e?2:"CI"in e?["GITHUB_ACTIONS","GITEA_ACTIONS"].some((t=>t in e))?3:1:!t||/-mono|dumb/i.test(r)?0:n||"truecolor"===i||"24bit"===i||"xterm-kitty"===r?3:/-256(colou?r)?$/i.test(r)?2:/^screen|^tmux|^xterm|^vt[1-5][0-9]([0-9])?|^ansi|color|cygwin|linux|mintty|rxvt/i.test(r)?1:3})(u,O,s)),_&&0===a?3:a)})(),c=s>0,u={open:"",close:""},a=c?(e,t)=>({open:`[${e}m`,close:`[${t}m`}):()=>u,p=39,g=49,f=e=>(t,n,r)=>e(i(t,n,r)),d=e=>t=>{let[n,i,o]=r(t);return e(n,i,o)};let b=e=>a(`38;5;${e}`,p),_=e=>a(`48;5;${e}`,g),O=(e,t,n)=>a(`38;2;${e};${t};${n}`,p),y=(e,t,n)=>a(`48;2;${e};${t};${n}`,g);1===s?(b=e=>a(o(e),p),_=e=>a(o(e)+10,g),O=(e,t,n)=>a(l(e,t,n),p),y=(e,t,n)=>a(l(e,t,n)+10,g)):2===s&&(O=f(b),y=f(_));let m,x,h={ansi256:b,bgAnsi256:_,fg:b,bg:_,rgb:O,bgRgb:y,hex:d(O),bgHex:d(y),visible:u,reset:a(0,0),inverse:a(7,27),hidden:a(8,28),bold:a(1,22),dim:a(2,22),italic:a(3,23),underline:a(4,24),strikethrough:a(9,29),strike:a(9,29),grey:a(90,p),gray:a(90,p),bgGrey:a(100,g),bgGray:a(100,g)},T=["black","red","green","yellow","blue","magenta","cyan","white"],$="Bright",I=30;for(m of T)x="bg"+m[0].toUpperCase()+m.slice(1),h[m]=a(I,p),h[m+$]=a(I+60,p),h[x]=a(I+10,g),h[x+$]=a(I+70,g),I++;const{defineProperty:R,defineProperties:v,setPrototypeOf:C}=Object,E=/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,w=/(\r?\n)/g,M={},N=({_p:e},{open:t,close:n})=>{const r=(e,...t)=>{if(!e)return"";let n=r._p,{_a:i,_b:o}=n,l=null!=e.raw?String.raw(e,...t):""+e;if(l.includes(""))for(;null!=n;){let e=n.close,t=e.length;if(t){let r,i=0,o="";for(;~(r=l.indexOf(e,i));)o+=l.slice(i,r)+n.open,i=r+t;i&&(l=o+l.slice(i))}n=n._p}return l.includes("\n")&&(l=l.replace(w,o+"$1"+i)),i+l+o};let i=t,o=n;return null!=e&&(i=e._a+t,o=n+e._b),C(r,P),r._p={open:t,close:n,_a:i,_b:o,_p:e},r.open=i,r.close=o,r},A=function(){const e=e=>""+e;return e.isSupported=()=>c,e.strip=e=>e.replace(E,""),e.extend=t=>{for(let e in t){let n=t[e],i=typeof n,o="string"===i?O(...r(n)):n;M[e]="function"===i?{get(){return(...e)=>N(this,n(...e))}}:{get(){let t=N(this,o);return R(this,e,{value:t}),t}}}P=v({},M),C(e,P)},e.extend(h),e};let P;const S=new A;module.exports=S,module.exports.Ansis=A;
{
"name": "ansis",
"version": "3.3.1",
"version": "3.3.2",
"description": "Colorize terminal output with ANSI colors & styles",

@@ -5,0 +5,0 @@ "keywords": [

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