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

ansis

Package Overview
Dependencies
Maintainers
0
Versions
63
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.5.2 to 3.6.0

2

index.js

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

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

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

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