rittenhop-dev/versions/5.94.2/node_modules/@stdlib/string-base-format-interpolate/dist/index.js

18 lines
4.4 KiB
JavaScript
Raw Normal View History

2024-09-23 19:40:12 -04:00
"use strict";var c=function(e,a){return function(){return a||e((a={exports:{}}).exports,a),a.exports}};var g=c(function(fr,v){
function $(e){return typeof e=="number"}v.exports=$
});var d=c(function(or,w){
function C(e){return e[0]==="-"}function h(e){var a="",i;for(i=0;i<e;i++)a+="0";return a}function D(e,a,i){var r=!1,t=a-e.length;return t<0||(C(e)&&(r=!0,e=e.substr(1)),e=i?e+h(t):h(t)+e,r&&(e="-"+e)),e}w.exports=D
});var x=c(function(pr,m){
var G=g(),E=d(),V=String.prototype.toLowerCase,b=String.prototype.toUpperCase;function X(e){var a,i,r;switch(e.specifier){case"b":a=2;break;case"o":a=8;break;case"x":case"X":a=16;break;case"d":case"i":case"u":default:a=10;break}if(i=e.arg,r=parseInt(i,10),!isFinite(r)){if(!G(i))throw new Error("invalid integer. Value: "+i);r=0}return r<0&&(e.specifier==="u"||a!==10)&&(r=4294967295+r+1),r<0?(i=(-r).toString(a),e.precision&&(i=E(i,e.precision,e.padRight)),i="-"+i):(i=r.toString(a),!r&&!e.precision?i="":e.precision&&(i=E(i,e.precision,e.padRight)),e.sign&&(i=e.sign+i)),a===16&&(e.alternate&&(i="0x"+i),i=e.specifier===b.call(e.specifier)?b.call(i):V.call(i)),a===8&&e.alternate&&i.charAt(0)!=="0"&&(i="0"+i),i}m.exports=X
});var I=c(function(ur,R){
function Z(e){return typeof e=="string"}R.exports=Z
});var y=c(function(lr,S){
var A=g(),N=Math.abs,z=String.prototype.toLowerCase,_=String.prototype.toUpperCase,n=String.prototype.replace,W=/e\+(\d)$/,L=/e-(\d)$/,B=/^(\d+)$/,M=/^(\d+)e/,U=/\.0$/,j=/\.0*e/,Y=/(\..*[^0])0*e/;function H(e){var a,i,r=parseFloat(e.arg);if(!isFinite(r)){if(!A(e.arg))throw new Error("invalid floating-point number. Value: "+i);r=e.arg}switch(e.specifier){case"e":case"E":i=r.toExponential(e.precision);break;case"f":case"F":i=r.toFixed(e.precision);break;case"g":case"G":N(r)<1e-4?(a=e.precision,a>0&&(a-=1),i=r.toExponential(a)):i=r.toPrecision(e.precision),e.alternate||(i=n.call(i,Y,"$1e"),i=n.call(i,j,"e"),i=n.call(i,U,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return i=n.call(i,W,"e+0$1"),i=n.call(i,L,"e-0$1"),e.alternate&&(i=n.call(i,B,"$1."),i=n.call(i,M,"$1.e")),r>=0&&e.sign&&(i=e.sign+i),i=e.specifier===_.call(e.specifier)?_.call(i):z.call(i),i}S.exports=H
});var T=c(function(gr,O){
function P(e){var a="",i;for(i=0;i<e;i++)a+=" ";return a}function J(e,a,i){var r=a-e.length;return r<0||(e=i?e+P(r):P(r)+e),e}O.exports=J
});var F=c(function(dr,q){
var K=x(),Q=I(),k=y(),rr=T(),er=d(),ir=String.fromCharCode,ar=Array.isArray;function l(e){return e!==e}function sr(e){var a={};return a.specifier=e.specifier,a.precision=e.precision===void 0?1:e.precision,a.width=e.width,a.flags=e.flags||"",a.mapping=e.mapping,a}function tr(e){var a,i,r,t,f,p,s,o,u;if(!ar(e))throw new TypeError("invalid argument. First argument must be an array. Value: `"+e+"`.");for(p="",s=1,o=0;o<e.length;o++)if(r=e[o],Q(r))p+=r;else{if(a=r.precision!==void 0,r=sr(r),!r.specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+o+"`. Value: `"+r+"`.");for(r.mapping&&(s=r.mapping),i=r.flags,u=0;u<i.length;u++)switch(t=i.charAt(u),t){case" ":r.sign=" ";break;case"+":r.sign="+";break;case"-":r.padRight=!0,r.padZeros=!1;break;case"0":r.padZeros=i.indexOf("-")<0;break;case"#":r.alternate=!0;break;default:throw new Error("invalid flag: "+t)}if(r.width==="*"){if(r.width=parseInt(arguments[s],10),s+=1,l(r.width))throw new TypeError("the argument for * width at position "+s+" is not a number. Value: `"+r.width+"`.");r.width<0&&(r.padRight=!0,r.width=-r.width)}if(a&&r.precision==="*"){if(r.precision=parseInt(arguments[s],10),s+=1,l(r.precision))throw new TypeError("the argument for * precision at position "+s+" is not a number. Value: `"+r.precision+"`.");r.precision<0&&(r.precision=1,a=!1)}switch(r.arg=arguments[s],r.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":a&&(r.padZeros=!1),r.arg=K(r);break;case"s":r.maxWidth=a?r.precision:-1,r.arg=String(r.arg);break;case"c":if(!l(r.arg)){if(f=parseInt(r.arg,10),f<0||f>127)throw new Error("invalid character code. Value: "+r.arg);r.arg=l(f)?String(r.arg):ir(f)}break;case"e":case"E":case"f":case"F":case"g":case"G":a||(r.precision=6),r.arg=k(r);break;default:throw new Error("invalid specifier: "+r.specifier)}r.maxWidth>=0&&r.arg.length>r.maxWidth&&(r.arg=r.arg.substring(0,r.maxWidth)),r.padZeros?r.arg=er(r.arg,r.width||r.precision,r.padRight):r.width&&(r.arg=rr(r.arg,r.width,r.padRight)),p+=r.arg||"",s+=1}return p}q.exports=tr
});var cr=F();module.exports=cr;
/** @license Apache-2.0 */
//# sourceMappingURL=index.js.map