@jonahsnider/util
Advanced tools
Comparing version 8.8.0 to 8.9.0
@@ -1,2 +0,2 @@ | ||
var e,t;e=this,t=function(e){"use strict";class t{constructor(e,t){if(this.lower=e,this.upper=t,e>t)throw new RangeError("lower must be less than upper")}static from(e){const[n,r]=e;return new t(n,r)}has(e){return e>=this.lower&&e<=this.upper}*[Symbol.iterator](){yield this.lower,yield this.upper}isSuperrange(e){return e===this||this.lower>=e.lower&&this.upper<=e.upper}isSubrange(e){return e===this||this.lower<=e.lower&&this.upper>=e.upper}equals(e){return e===this||this.lower===e.lower&&this.upper===e.upper}intersects(e){return e===this||this.lower<=e.upper&&this.upper>=e.lower}}const n=Object.freeze(new t(100,200)),r=Object.freeze(new t(200,300)),i=Object.freeze(new t(300,400)),o=Object.freeze(new t(400,500)),u=Object.freeze(new t(500,600));var a,s,c=Object.freeze({__proto__:null,informational:n,success:r,redirects:i,clientErrors:o,serverErrors:u});!function(e){e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired"}(a||(a={})),function(e){e.Get="GET",e.Head="HEAD",e.Post="POST",e.Put="PUT",e.Delete="DELETE",e.Connect="CONNECT",e.Options="OPTIONS",e.Trace="TRACE",e.Patch="PATCH"}(s||(s={}));var f,l,d=Object.freeze({__proto__:null,StatusRange:c,get Status(){return a},get Method(){return s}});function h(e,t){return Array.from({length:t},((t,n)=>e(n)))}function p(e,t){const n=[];for(let r=0;r<e.length;r++)e[r]===t&&n.push(r);return n}function S(e,t){let n;if("size"in e?n="size":"length"in e&&(n="length"),!n)throw new RangeError("Expected a to have a size property or a length property");return e[n]<t[n]?[t,e]:[e,t]}function*k(...e){for(const t of e)yield*t}function m(e){const t=new Map;for(const n of e){const e=(t.get(n)??0)+1;t.set(n,e)}return t}function*g(e,t){for(let n=0;n<t;n++)yield e}e.Rank=void 0,(f=e.Rank||(e.Rank={}))[f.Ace=1]="Ace",f[f.Two=2]="Two",f[f.Three=3]="Three",f[f.Four=4]="Four",f[f.Five=5]="Five",f[f.Six=6]="Six",f[f.Seven=7]="Seven",f[f.Eight=8]="Eight",f[f.Nine=9]="Nine",f[f.Ten=10]="Ten",f[f.Jack=11]="Jack",f[f.Queen=12]="Queen",f[f.King=13]="King",e.Suit=void 0,(l=e.Suit||(e.Suit={}))[l.Clubs=0]="Clubs",l[l.Diamonds=1]="Diamonds",l[l.Hearts=2]="Hearts",l[l.Spades=3]="Spades";const R=[{rank:e.Rank.Ace,suit:e.Suit.Clubs},{rank:e.Rank.Two,suit:e.Suit.Clubs},{rank:e.Rank.Three,suit:e.Suit.Clubs},{rank:e.Rank.Four,suit:e.Suit.Clubs},{rank:e.Rank.Five,suit:e.Suit.Clubs},{rank:e.Rank.Six,suit:e.Suit.Clubs},{rank:e.Rank.Seven,suit:e.Suit.Clubs},{rank:e.Rank.Eight,suit:e.Suit.Clubs},{rank:e.Rank.Nine,suit:e.Suit.Clubs},{rank:e.Rank.Ten,suit:e.Suit.Clubs},{rank:e.Rank.Jack,suit:e.Suit.Clubs},{rank:e.Rank.Queen,suit:e.Suit.Clubs},{rank:e.Rank.King,suit:e.Suit.Clubs},{rank:e.Rank.Ace,suit:e.Suit.Diamonds},{rank:e.Rank.Two,suit:e.Suit.Diamonds},{rank:e.Rank.Three,suit:e.Suit.Diamonds},{rank:e.Rank.Four,suit:e.Suit.Diamonds},{rank:e.Rank.Five,suit:e.Suit.Diamonds},{rank:e.Rank.Six,suit:e.Suit.Diamonds},{rank:e.Rank.Seven,suit:e.Suit.Diamonds},{rank:e.Rank.Eight,suit:e.Suit.Diamonds},{rank:e.Rank.Nine,suit:e.Suit.Diamonds},{rank:e.Rank.Ten,suit:e.Suit.Diamonds},{rank:e.Rank.Jack,suit:e.Suit.Diamonds},{rank:e.Rank.Queen,suit:e.Suit.Diamonds},{rank:e.Rank.King,suit:e.Suit.Diamonds},{rank:e.Rank.Ace,suit:e.Suit.Hearts},{rank:e.Rank.Two,suit:e.Suit.Hearts},{rank:e.Rank.Three,suit:e.Suit.Hearts},{rank:e.Rank.Four,suit:e.Suit.Hearts},{rank:e.Rank.Five,suit:e.Suit.Hearts},{rank:e.Rank.Six,suit:e.Suit.Hearts},{rank:e.Rank.Seven,suit:e.Suit.Hearts},{rank:e.Rank.Eight,suit:e.Suit.Hearts},{rank:e.Rank.Nine,suit:e.Suit.Hearts},{rank:e.Rank.Ten,suit:e.Suit.Hearts},{rank:e.Rank.Jack,suit:e.Suit.Hearts},{rank:e.Rank.Queen,suit:e.Suit.Hearts},{rank:e.Rank.King,suit:e.Suit.Hearts},{rank:e.Rank.Ace,suit:e.Suit.Spades},{rank:e.Rank.Two,suit:e.Suit.Spades},{rank:e.Rank.Three,suit:e.Suit.Spades},{rank:e.Rank.Four,suit:e.Suit.Spades},{rank:e.Rank.Five,suit:e.Suit.Spades},{rank:e.Rank.Six,suit:e.Suit.Spades},{rank:e.Rank.Seven,suit:e.Suit.Spades},{rank:e.Rank.Eight,suit:e.Suit.Spades},{rank:e.Rank.Nine,suit:e.Suit.Spades},{rank:e.Rank.Ten,suit:e.Suit.Spades},{rank:e.Rank.Jack,suit:e.Suit.Spades},{rank:e.Rank.Queen,suit:e.Suit.Spades},{rank:e.Rank.King,suit:e.Suit.Spades}];class w extends Map{constructor(e,t){super(t),this.defaultValueOrDefaultValueFn=e,this.defaultValueIsFunction="function"==typeof e}get(e){return this.has(e)?super.get(e):this.defaultValueIsFunction?this.defaultValueOrDefaultValueFn(e):this.defaultValueOrDefaultValueFn}}const y=new WeakMap;function b(e){const t=e[0].map((e=>e.length));for(const n of e)for(const[e,{length:r}]of n.entries())t[e]<r&&(t[e]=r);return t}function T(e,t){if(Array.isArray(e)&&Array.isArray(t))return function(e,t){return e===t||e.length===t.length&&e.every(((e,n)=>e===t[n]))}(e,t);if(e instanceof Set&&t instanceof Set)return function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(e,t);if(e instanceof Map&&t instanceof Map)return function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(!t.has(n)||t.get(n)!==r)return!1;return!0}(e,t);throw new RangeError("Expected both parameters to be an array, Set, or Map")}function v(e,t,n){if(t>n)throw new RangeError("min exceeded max");return e<t?t:e>n?n:e}function E(e,t){return e+t}function A(e){const t=e.reduce(E);return t/("bigint"==typeof t?BigInt(e.length):e.length)}function x(e,t,n){return 1/(2.5066282746310002*t)*Math.E**(-.5*(e-n/t)**2)}function C(e,t){if(e>t)throw new RangeError("min exceeded max");return Math.random()*(t-e)+e}function N(e,t=A(e)){return e.map((e=>(e-t)**2)).reduce(E)/(e.length-1)}function M(e,t=A(e)){return Math.sqrt(N(e,t))}const F=Symbol("delayResolvedValue");var P=Object.freeze({__proto__:null,and:function(e,t){return e&t},or:function(e,t){return e|t},xor:function(e,t){return e^t}});function O(e,t){return e<t?-1:e>t?1:0}function D(e,t){return e<t?1:e>t?-1:0}var H=Object.freeze({__proto__:null,ascending:function(e,t){return t===undefined&&"function"==typeof e?(t,n)=>O(e(t),e(n)):O(e,t)},descending:function(e,t){return t===undefined&&"function"==typeof e?(t,n)=>D(e(t),e(n)):D(e,t)}});const z=/\S/;e.AutoPercentage=class{constructor(){this._count=0}percentage(){return this._count++,{[Symbol.toPrimitive]:()=>1/this._count}}count(){return this._count++,{[Symbol.toPrimitive]:()=>this._count}}},e.Bitwise=P,e.DefaultMap=w,e.Http=d,e.Range=t,e.Sort=H,e.Stopwatch=class{static start(){const e=new this;return e.start(),e}get started(){return this.startTime!==undefined}start(){this.startTime=process.hrtime.bigint()}end(){if(this.startTime===undefined)throw Error("This timer was not started");return Number(process.hrtime.bigint()-this.startTime)/1e6}},e.allDuplicates=function(e){const t=new Set,n=[];for(const r of e)t.has(r)?n.push(r):t.add(r);return n},e.binarySearch=function(e,t){let n=0,r=e.length-1;for(;n<=r;){const i=Math.trunc((n+r)/2),o=t(e[i]);if(o<0)n=i+1;else{if(!(o>0))return e[i];r=i-1}}return undefined},e.capitalize=function(e){const t=e.charAt(0).toUpperCase();return`${t}${e.slice(t.length)}`},e.chunk=function(e,t){return e.length===t?e.map((e=>[e])):h((n=>e.slice(n*t,n*t+t)),Math.ceil(e.length/t))},e.clamp=v,e.combineIterables=k,e.count=function(e,t){let n=0;if(t)for(const r of e)t(r)&&n++;else for(const t of e)n++;return n},e.cycle=function*(e,t){for(let n=0;n<t;n++)yield*e},e.difference=function(e,t){if(e===t)return new Set;const n=new Set(e);for(const e of t)n["delete"](e);return n},e.duplicates=function(e){const t=new Set,n=new Set;for(const r of e)t.has(r)?n.add(r):t.add(r);return n},e.enumHas=function(e,t){return y.has(e)||y.set(e,new Set(Object.values(e))),y.get(e).has(t)},e.every=function(e,t){for(const n of e)if(!t(n))return!1;return!0},e.fill=function(e,t){return Array.from({length:t},(()=>e))},e.find=function(e,t){for(const n of e)if(t(n))return n;return undefined},e.findIndexAll=function(e,t){const n=[];for(let r=0;r<e.length;r++)t(e[r],r)&&n.push(r);return n},e.first=function(e,t){if(t===undefined){for(const t of e)return t;return undefined}return function*(e,t){for(const n of e){if(!t--)break;yield n}}(e,t)},e.formatTable=function(e,t=" "){const n=b(e);return e.map((e=>e.map(((e,t)=>e.padEnd(n[t]))).join(t))).join("\n")},e.frequencyTable=m,e.holes=function(e){const t=[];for(let n=0;n<e.length;n++)n in e||t.push(n);return t},e.identical=T,e.includes=function(e,t){for(const n of e)if(n===t)return!0;return!1},e.indexOfAll=p,e.intersection=function(e,t){if(e===t)return new Set(e);const n=new Set,[r,i]=S(e,t);for(const e of r)i.has(e)&&n.add(e);return n},e.invert=function(e){return(...t)=>-e(...t)},e.isAnagram=function(e,t){return e===t||e.length===t.length&&T(m(e),m(t))},e.isDisjoint=function(e,t){if(e===t)return!1;const n=e instanceof Set?e:new Set(e);for(const e of t)if(n.has(e))return!1;return!0},e.isEmpty=function(e){for(const t of e)return!1;return!0},e.isSorted=function(e,t){for(let n=0;n<e.length-1;n++)if(t(e[n],e[n+1])>0)return!1;return!0},e.isSubset=function(e,t){if(e===t)return!0;for(const n of e)if(!t.has(n))return!1;return!0},e.isSuperset=function(e,t){if(e===t)return!0;for(const n of t)if(!e.has(n))return!1;return!0},e.isWhitespace=function(e){return!z.test(e)},e.jaccardIndex=function(e,t){if(0===e.size&&0===t.size)return 1;let n=0;const[r,i]=S(e,t);for(const e of r)i.has(e)&&n++;return v(n/(e.size+t.size-n),0,1)},e.join=function(e,t=","){let n="";const r=e[Symbol.iterator]();let i=r.next();for(;;){const e=i;if(i=r.next(),n+=e.value,i.done)return n;n+=t}},e.largeToSmall=S,e.lines=function(e){return e.split("\n").map((e=>e.trim())).filter((e=>e.length>0))},e.mapFill=h,e.mapRepeat=function*(e,t){for(let n=0;n<t;n++)yield e(n)},e.max=function(e,t){return t>e?t:e},e.maxColumnLength=b,e.mean=A,e.median=function(e){const t=e.length%2==0,n=e.length/2;if(t){const t="bigint"==typeof e[0]?2n:2;return(e[n-1]+e[n])/t}return e[Math.floor(n)]},e.min=function(e,t){return t<e?t:e},e.mode=function(e){const t=new Map;let n=0,r=[];for(const i of e){const e=t.get(i),o=e===undefined?1:e+1;t.set(i,o),o>n?(n=o,r=[i]):o===n&&r.push(i)}return r},e.multiReplace=function(e,t){const n=Object.entries(t);let r="",i=0;for(;i<e.length;)e:{for(const[t,o]of n)if(e.slice(i).startsWith(t)){r+=o,i+=t.length;break e}r+=e[i++]}return r},e.name=function q(e,t){return t?`${q(e)}${t.name in e?".":"#"}${t.name}`:e.name},e.newDeck=function(){return[...R]},e.normaldist=x,e.not=function(e){return(...t)=>!e(...t)},e.nullish=function(e){return null===e||e===undefined},e.overwrite=function(e,t,n){return e.splice(t,t+n.length-1,...n)},e.padEnd=function(e,t,n){e.push(...g(n,t-e.length))},e.padStart=function(e,t,n){e.unshift(...g(n,t-e.length))},e.partition=function(e,t){const n=[],r=[];let i=0;for(const o of e)(t(o,i++)?n:r).push(o);return[n,r]},e.product=function(e,t){return e*t},e.pull=function(e,t){const n=e.indexOf(t);return-1===n?[]:e.splice(n,1)},e.pullAll=function(e,t){const n=p(e,t);n.reverse();const r=[];for(const t of n)r.push(e.splice(t,1)[0]);return r},e.random=C,e.randomInt=function(e,t){if(e>t)throw new RangeError("min exceeded max");return Math.floor(C(Math.ceil(e),Math.floor(t)))},e.regExpUnion=function(...e){return RegExp(e.map((e=>`(${e.source})`)).join("|"))},e.relativeStddev=function(e,t=A(e)){return M(e,t)/t},e.rename=function(e,t,n){if(t===n)return{...e};const{[t]:r,...i}={...e,[n]:e[t]};return i},e.repeat=g,e.replace=function(e,t,n){const r=e.indexOf(t);return-1!==r&&(e[r]=n),r},e.replaceAll=function(e,t,n){let r=0;for(let i=0;i<e.length;i++)e[i]===t&&(e[i]=n,r++);return r},e.same=function(...e){const t=e.map((e=>e[Symbol.iterator]()));for(;;){const e=t.map((e=>e.next())),[{done:n,value:r}]=e;for(const t of e){if(t.done)return e.every((e=>e.done===n));if(t.value!==r)return!1}}},e.sample=function(e){return e[Math.floor(Math.random()*e.length)]},e.settled=async function(e){try{return[await e,undefined]}catch(t){return[undefined,t]}},e.shuffle=function(e,t=!0){const n=t?e:[...e];for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[n[e],n[t]]=[n[t],n[e]]}if(!t)return n},e.some=function(e,t){for(const n of e)if(t(n))return!0;return!1},e.sortObject=function(e,t){return Object.entries(e).sort((([,e],[,n])=>t(e,n)))},e.standardNormaldist=function(e){return x(e,1,0)},e.stddev=M,e.sum=E,e.symmetricDifference=function(e,t){if(e===t)return new Set;const n=new Set(e);for(const e of t)n.has(e)?n["delete"](e):n.add(e);return n},e.thunkify=function(e){let t,n=!1;return(...r)=>(n||(n=!0,t=e(...r)),t)},e.timeout=async function(e,t){const[n,r]=function(e){let t;const n=new Promise((n=>{t=setTimeout((()=>{n(F)}),e)}));return[t,n]}(t),i=await Promise.race([e,r])["finally"]((()=>{clearTimeout(n)}));if(i===F)throw Error("Timed out");return i},e.toDigits=function(e,t){const n=10**t;return Math.round(e*n*(1+Number.EPSILON))/n},e.truncate=function(e,t,n=""){return e.length>t?`${e.slice(0,t)}${n}`:e},e.uncapitalize=function(e){const t=e.charAt(0).toLowerCase();return`${t}${e.slice(t.length)}`},e.union=function(e,t){return e===t?new Set(e):new Set(k(e,t))},e.variance=N,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jonahsniderUtil={}); | ||
var t,e;t=this,e=function(t){"use strict";class e{constructor(t,e){if(this.lower=t,this.upper=e,t>e)throw new RangeError("lower must be less than upper")}static from(t){const[n,r]=t;return new e(n,r)}has(t){return t>=this.lower&&t<=this.upper}*[Symbol.iterator](){yield this.lower,yield this.upper}isSuperrange(t){return t===this||this.lower>=t.lower&&this.upper<=t.upper}isSubrange(t){return t===this||this.lower<=t.lower&&this.upper>=t.upper}equals(t){return t===this||this.lower===t.lower&&this.upper===t.upper}intersects(t){return t===this||this.lower<=t.upper&&this.upper>=t.lower}}const n=Object.freeze(new e(100,200)),r=Object.freeze(new e(200,300)),i=Object.freeze(new e(300,400)),o=Object.freeze(new e(400,500)),u=Object.freeze(new e(500,600));var a,s,c=Object.freeze({__proto__:null,informational:n,success:r,redirects:i,clientErrors:o,serverErrors:u});!function(t){t[t.Continue=100]="Continue",t[t.SwitchingProtocols=101]="SwitchingProtocols",t[t.EarlyHints=103]="EarlyHints",t[t.Ok=200]="Ok",t[t.Created=201]="Created",t[t.Accepted=202]="Accepted",t[t.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",t[t.NoContent=204]="NoContent",t[t.ResetContent=205]="ResetContent",t[t.PartialContent=206]="PartialContent",t[t.MultipleChoices=300]="MultipleChoices",t[t.MovedPermanently=301]="MovedPermanently",t[t.Found=302]="Found",t[t.SeeOther=303]="SeeOther",t[t.NotModified=304]="NotModified",t[t.TemporaryRedirect=307]="TemporaryRedirect",t[t.PermanentRedirect=308]="PermanentRedirect",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.PaymentRequired=402]="PaymentRequired",t[t.Forbidden=403]="Forbidden",t[t.NotFound=404]="NotFound",t[t.MethodNotAllowed=405]="MethodNotAllowed",t[t.NotAcceptable=406]="NotAcceptable",t[t.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",t[t.RequestTimeout=408]="RequestTimeout",t[t.Conflict=409]="Conflict",t[t.Gone=410]="Gone",t[t.LengthRequired=411]="LengthRequired",t[t.PreconditionFailed=412]="PreconditionFailed",t[t.PayloadTooLarge=413]="PayloadTooLarge",t[t.UriTooLong=414]="UriTooLong",t[t.UnsupportedMediaType=415]="UnsupportedMediaType",t[t.RangeNotSatisfiable=416]="RangeNotSatisfiable",t[t.ExpectationFailed=417]="ExpectationFailed",t[t.ImATeapot=418]="ImATeapot",t[t.UnprocessableEntity=422]="UnprocessableEntity",t[t.TooEarly=425]="TooEarly",t[t.UpgradeRequired=426]="UpgradeRequired",t[t.PreconditionRequired=428]="PreconditionRequired",t[t.TooManyRequests=429]="TooManyRequests",t[t.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",t[t.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",t[t.InternalServerError=500]="InternalServerError",t[t.NotImplemented=501]="NotImplemented",t[t.BadGateway=502]="BadGateway",t[t.ServiceUnavailable=503]="ServiceUnavailable",t[t.GatewayTimeout=504]="GatewayTimeout",t[t.HttpVersionNotSupported=505]="HttpVersionNotSupported",t[t.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",t[t.InsufficientStorage=507]="InsufficientStorage",t[t.LoopDetected=508]="LoopDetected",t[t.NotExtended=510]="NotExtended",t[t.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired"}(a||(a={})),function(t){t.Get="GET",t.Head="HEAD",t.Post="POST",t.Put="PUT",t.Delete="DELETE",t.Connect="CONNECT",t.Options="OPTIONS",t.Trace="TRACE",t.Patch="PATCH"}(s||(s={}));var f,l,d=Object.freeze({__proto__:null,StatusRange:c,get Status(){return a},get Method(){return s}});function h(t,e){return Array.from({length:e},((e,n)=>t(n)))}function p(t,e){let n=-1;for(let r=t.length-1;r>=0&&t[r]===e;r--)n=r;return n}function S(t,e){const n=[];for(let r=0;r<t.length;r++)t[r]===e&&n.push(r);return n}function k(t,e){let n;if("size"in t?n="size":"length"in t&&(n="length"),!n)throw new RangeError("Expected a to have a size property or a length property");return t[n]<e[n]?[e,t]:[t,e]}function*m(...t){for(const e of t)yield*e}function g(t){const e=new Map;for(const n of t){const t=(e.get(n)??0)+1;e.set(n,t)}return e}function R(t,e){let n=-1;for(const r of t){if(r!==e)break;n++}return n}function*w(t,e){for(let n=0;n<e;n++)yield t}t.Rank=void 0,(f=t.Rank||(t.Rank={}))[f.Ace=1]="Ace",f[f.Two=2]="Two",f[f.Three=3]="Three",f[f.Four=4]="Four",f[f.Five=5]="Five",f[f.Six=6]="Six",f[f.Seven=7]="Seven",f[f.Eight=8]="Eight",f[f.Nine=9]="Nine",f[f.Ten=10]="Ten",f[f.Jack=11]="Jack",f[f.Queen=12]="Queen",f[f.King=13]="King",t.Suit=void 0,(l=t.Suit||(t.Suit={}))[l.Clubs=0]="Clubs",l[l.Diamonds=1]="Diamonds",l[l.Hearts=2]="Hearts",l[l.Spades=3]="Spades";const b=[{rank:t.Rank.Ace,suit:t.Suit.Clubs},{rank:t.Rank.Two,suit:t.Suit.Clubs},{rank:t.Rank.Three,suit:t.Suit.Clubs},{rank:t.Rank.Four,suit:t.Suit.Clubs},{rank:t.Rank.Five,suit:t.Suit.Clubs},{rank:t.Rank.Six,suit:t.Suit.Clubs},{rank:t.Rank.Seven,suit:t.Suit.Clubs},{rank:t.Rank.Eight,suit:t.Suit.Clubs},{rank:t.Rank.Nine,suit:t.Suit.Clubs},{rank:t.Rank.Ten,suit:t.Suit.Clubs},{rank:t.Rank.Jack,suit:t.Suit.Clubs},{rank:t.Rank.Queen,suit:t.Suit.Clubs},{rank:t.Rank.King,suit:t.Suit.Clubs},{rank:t.Rank.Ace,suit:t.Suit.Diamonds},{rank:t.Rank.Two,suit:t.Suit.Diamonds},{rank:t.Rank.Three,suit:t.Suit.Diamonds},{rank:t.Rank.Four,suit:t.Suit.Diamonds},{rank:t.Rank.Five,suit:t.Suit.Diamonds},{rank:t.Rank.Six,suit:t.Suit.Diamonds},{rank:t.Rank.Seven,suit:t.Suit.Diamonds},{rank:t.Rank.Eight,suit:t.Suit.Diamonds},{rank:t.Rank.Nine,suit:t.Suit.Diamonds},{rank:t.Rank.Ten,suit:t.Suit.Diamonds},{rank:t.Rank.Jack,suit:t.Suit.Diamonds},{rank:t.Rank.Queen,suit:t.Suit.Diamonds},{rank:t.Rank.King,suit:t.Suit.Diamonds},{rank:t.Rank.Ace,suit:t.Suit.Hearts},{rank:t.Rank.Two,suit:t.Suit.Hearts},{rank:t.Rank.Three,suit:t.Suit.Hearts},{rank:t.Rank.Four,suit:t.Suit.Hearts},{rank:t.Rank.Five,suit:t.Suit.Hearts},{rank:t.Rank.Six,suit:t.Suit.Hearts},{rank:t.Rank.Seven,suit:t.Suit.Hearts},{rank:t.Rank.Eight,suit:t.Suit.Hearts},{rank:t.Rank.Nine,suit:t.Suit.Hearts},{rank:t.Rank.Ten,suit:t.Suit.Hearts},{rank:t.Rank.Jack,suit:t.Suit.Hearts},{rank:t.Rank.Queen,suit:t.Suit.Hearts},{rank:t.Rank.King,suit:t.Suit.Hearts},{rank:t.Rank.Ace,suit:t.Suit.Spades},{rank:t.Rank.Two,suit:t.Suit.Spades},{rank:t.Rank.Three,suit:t.Suit.Spades},{rank:t.Rank.Four,suit:t.Suit.Spades},{rank:t.Rank.Five,suit:t.Suit.Spades},{rank:t.Rank.Six,suit:t.Suit.Spades},{rank:t.Rank.Seven,suit:t.Suit.Spades},{rank:t.Rank.Eight,suit:t.Suit.Spades},{rank:t.Rank.Nine,suit:t.Suit.Spades},{rank:t.Rank.Ten,suit:t.Suit.Spades},{rank:t.Rank.Jack,suit:t.Suit.Spades},{rank:t.Rank.Queen,suit:t.Suit.Spades},{rank:t.Rank.King,suit:t.Suit.Spades}],y=new WeakMap;function T(t){const e=t[0].map((t=>t.length));for(const n of t)for(const[t,{length:r}]of n.entries())e[t]<r&&(e[t]=r);return e}function v(t,e){if(Array.isArray(t)&&Array.isArray(e))return function(t,e){return t===e||t.length===e.length&&t.every(((t,n)=>t===e[n]))}(t,e);if(t instanceof Set&&e instanceof Set)return function(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}(t,e);if(t instanceof Map&&e instanceof Map)return function(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const[n,r]of t.entries())if(!e.has(n)||e.get(n)!==r)return!1;return!0}(t,e);throw new RangeError("Expected both parameters to be an array, Set, or Map")}class E extends Map{constructor(t,e){super(e),this.defaultValueOrDefaultValueFn=t,this.defaultValueIsFunction="function"==typeof t}get(t){return this.has(t)?super.get(t):this.defaultValueIsFunction?this.defaultValueOrDefaultValueFn(t):this.defaultValueOrDefaultValueFn}}function x(t,e,n){if(e>n)throw new RangeError("min exceeded max");return t<e?e:t>n?n:t}function A(t,e){return t+e}function M(t){const e=t.reduce(A);return e/("bigint"==typeof e?BigInt(t.length):t.length)}function N(t,e,n){return 1/(2.5066282746310002*e)*Math.E**(-.5*(t-n/e)**2)}function C(t,e){if(t>e)throw new RangeError("min exceeded max");return Math.random()*(e-t)+t}function F(t,e=M(t)){return t.map((t=>(t-e)**2)).reduce(A)/(t.length-1)}function O(t,e=M(t)){return Math.sqrt(F(t,e))}const P=Symbol("delayResolvedValue");var D=Object.freeze({__proto__:null,and:function(t,e){return t&e},or:function(t,e){return t|e},xor:function(t,e){return t^e}});function q(t,e){return t<e?-1:t>e?1:0}function H(t,e){return t<e?1:t>e?-1:0}var z=Object.freeze({__proto__:null,ascending:function(t,e){return e===undefined&&"function"==typeof t?(e,n)=>q(t(e),t(n)):q(t,e)},descending:function(t,e){return e===undefined&&"function"==typeof t?(e,n)=>H(t(e),t(n)):H(t,e)}});const _=/\S/;t.AutoPercentage=class{constructor(){this._count=0}percentage(){return this._count++,{[Symbol.toPrimitive]:()=>1/this._count}}count(){return this._count++,{[Symbol.toPrimitive]:()=>this._count}}},t.Bitwise=D,t.DefaultMap=E,t.Http=d,t.MathMap=class extends E{add(t,e){const n=this.get(t)+e;return this.set(t,n),n}subtract(t,e){return this.add(t,-e)}multiply(t,e){const n=this.get(t)*e;return this.set(t,n),n}divide(t,e){const n=this.get(t)/e;return this.set(t,n),n}pow(t,e){const n=this.get(t)**e;return this.set(t,n),n}sqrt(t){const e=Math.sqrt(this.get(t));return this.set(t,e),e}root(t,e){if(2===e)return this.sqrt(t);const n=this.get(t)**(1/e);return this.set(t,n),n}},t.Range=e,t.Sort=z,t.Stopwatch=class{static start(){const t=new this;return t.start(),t}get started(){return this.startTime!==undefined}start(){this.startTime=process.hrtime.bigint()}end(){if(this.startTime===undefined)throw Error("This timer was not started");return Number(process.hrtime.bigint()-this.startTime)/1e6}},t.allDuplicates=function(t){const e=new Set,n=[];for(const r of t)e.has(r)?n.push(r):e.add(r);return n},t.binarySearch=function(t,e){let n=0,r=t.length-1;for(;n<=r;){const i=Math.trunc((n+r)/2),o=e(t[i]);if(o<0)n=i+1;else{if(!(o>0))return t[i];r=i-1}}return undefined},t.capitalize=function(t){const e=t.charAt(0).toUpperCase();return`${e}${t.slice(e.length)}`},t.chunk=function(t,e){return t.length===e?t.map((t=>[t])):h((n=>t.slice(n*e,n*e+e)),Math.ceil(t.length/e))},t.clamp=x,t.combineIterables=m,t.count=function(t,e){let n=0;if(e)for(const r of t)e(r)&&n++;else for(const e of t)n++;return n},t.cycle=function*(t,e){for(let n=0;n<e;n++)yield*t},t.difference=function(t,e){if(t===e)return new Set;const n=new Set(t);for(const t of e)n["delete"](t);return n},t.duplicates=function(t){const e=new Set,n=new Set;for(const r of t)e.has(r)?n.add(r):e.add(r);return n},t.enumHas=function(t,e){return y.has(t)||y.set(t,new Set(Object.values(t))),y.get(t).has(e)},t.every=function(t,e){for(const n of t)if(!e(n))return!1;return!0},t.fill=function(t,e){return Array.from({length:e},(()=>t))},t.find=function(t,e){for(const n of t)if(e(n))return n;return undefined},t.findIndexAll=function(t,e){const n=[];for(let r=0;r<t.length;r++)e(t[r],r)&&n.push(r);return n},t.first=function(t,e){if(e===undefined){for(const e of t)return e;return undefined}return function*(t,e){for(const n of t){if(!e--)break;yield n}}(t,e)},t.firstIndexOfLastGroup=p,t.formatTable=function(t,e=" "){const n=T(t);return t.map((t=>t.map(((t,e)=>t.padEnd(n[e]))).join(e))).join("\n")},t.frequencyTable=g,t.holes=function(t){const e=[];for(let n=0;n<t.length;n++)n in t||e.push(n);return e},t.identical=v,t.includes=function(t,e){for(const n of t)if(n===e)return!0;return!1},t.indexOfAll=S,t.intersection=function(t,e){if(t===e)return new Set(t);const n=new Set,[r,i]=k(t,e);for(const t of r)i.has(t)&&n.add(t);return n},t.invert=function(t){return(...e)=>-t(...e)},t.isAnagram=function(t,e){return t===e||t.length===e.length&&v(g(t),g(e))},t.isDisjoint=function(t,e){if(t===e)return!1;const n=t instanceof Set?t:new Set(t);for(const t of e)if(n.has(t))return!1;return!0},t.isEmpty=function(t){for(const e of t)return!1;return!0},t.isSorted=function(t,e){for(let n=0;n<t.length-1;n++)if(e(t[n],t[n+1])>0)return!1;return!0},t.isSubset=function(t,e){if(t===e)return!0;for(const n of t)if(!e.has(n))return!1;return!0},t.isSuperset=function(t,e){if(t===e)return!0;for(const n of e)if(!t.has(n))return!1;return!0},t.isWhitespace=function(t){return!_.test(t)},t.iteratorToIterable=function(t){return{[Symbol.iterator]:()=>t}},t.jaccardIndex=function(t,e){if(0===t.size&&0===e.size)return 1;let n=0;const[r,i]=k(t,e);for(const t of r)i.has(t)&&n++;return x(n/(t.size+e.size-n),0,1)},t.join=function(t,e=","){let n="";const r=t[Symbol.iterator]();let i=r.next();for(;;){const t=i;if(i=r.next(),n+=t.value,i.done)return n;n+=e}},t.largeToSmall=k,t.lastIndexOfFirstGroup=R,t.lines=function(t){return t.split("\n").map((t=>t.trim())).filter((t=>t.length>0))},t.mapFill=h,t.mapRepeat=function*(t,e){for(let n=0;n<e;n++)yield t(n)},t.max=function(t,e){return e>t?e:t},t.maxColumnLength=T,t.mean=M,t.median=function(t){const e=t.length%2==0,n=t.length/2;if(e){const e="bigint"==typeof t[0]?2n:2;return(t[n-1]+t[n])/e}return t[Math.floor(n)]},t.min=function(t,e){return e<t?e:t},t.mode=function(t){const e=new Map;let n=0,r=[];for(const i of t){const t=e.get(i),o=t===undefined?1:t+1;e.set(i,o),o>n?(n=o,r=[i]):o===n&&r.push(i)}return r},t.multiReplace=function(t,e){const n=Object.entries(e);let r="",i=0;for(;i<t.length;)t:{for(const[e,o]of n)if(t.slice(i).startsWith(e)){r+=o,i+=e.length;break t}r+=t[i++]}return r},t.name=function j(t,e){return e?`${j(t)}${e.name in t?".":"#"}${e.name}`:t.name},t.newDeck=function(){return[...b]},t.normaldist=N,t.not=function(t){return(...e)=>!t(...e)},t.nullish=function(t){return null===t||t===undefined},t.overwrite=function(t,e,n){return t.splice(e,e+n.length-1,...n)},t.padEnd=function(t,e,n){t.push(...w(n,e-t.length))},t.padStart=function(t,e,n){t.unshift(...w(n,e-t.length))},t.partition=function(t,e){const n=[],r=[];let i=0;for(const o of t)(e(o,i++)?n:r).push(o);return[n,r]},t.product=function(t,e){return t*e},t.pull=function(t,e){const n=t.indexOf(e);return-1===n?[]:t.splice(n,1)},t.pullAll=function(t,e){const n=S(t,e);n.reverse();const r=[];for(const e of n)r.push(t.splice(e,1)[0]);return r},t.random=C,t.randomInt=function(t,e){if(t>e)throw new RangeError("min exceeded max");return Math.floor(C(Math.ceil(t),Math.floor(e)))},t.regExpUnion=function(...t){return RegExp(t.map((t=>`(${t.source})`)).join("|"))},t.relativeStddev=function(t,e=M(t)){return O(t,e)/e},t.rename=function(t,e,n){if(e===n)return{...t};const{[e]:r,...i}={...t,[n]:t[e]};return i},t.repeat=w,t.replace=function(t,e,n){const r=t.indexOf(e);return-1!==r&&(t[r]=n),r},t.replaceAll=function(t,e,n){let r=0;for(let i=0;i<t.length;i++)t[i]===e&&(t[i]=n,r++);return r},t.same=function(...t){const e=t.map((t=>t[Symbol.iterator]()));for(;;){const t=e.map((t=>t.next())),[{done:n,value:r}]=t;for(const e of t){if(e.done)return t.every((t=>t.done===n));if(e.value!==r)return!1}}},t.sample=function(t){return t[Math.floor(Math.random()*t.length)]},t.settled=async function(t){try{return[await t,undefined]}catch(e){return[undefined,e]}},t.shuffle=function(t,e=!0){const n=e?t:[...t];for(let t=n.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}if(!e)return n},t.skip=function(t,e){const n=t[Symbol.iterator]();for(let t=0;t<e&&!n.next().done;t++);return n},t.some=function(t,e){for(const n of t)if(e(n))return!0;return!1},t.sortObject=function(t,e){return Object.entries(t).sort((([,t],[,n])=>e(t,n)))},t.standardNormaldist=function(t){return N(t,1,0)},t.stddev=O,t.sum=A,t.symmetricDifference=function(t,e){if(t===e)return new Set;const n=new Set(t);for(const t of e)n.has(t)?n["delete"](t):n.add(t);return n},t.thunkify=function(t){let e,n=!1;return(...r)=>(n||(n=!0,e=t(...r)),e)},t.timeout=async function(t,e){const[n,r]=function(t){let e;const n=new Promise((n=>{e=setTimeout((()=>{n(P)}),t)}));return[e,n]}(e),i=await Promise.race([t,r])["finally"]((()=>{clearTimeout(n)}));if(i===P)throw Error("Timed out");return i},t.toDigits=function(t,e){const n=10**e;return Math.round(t*n*(1+Number.EPSILON))/n},t.triangularNumber=function(t){if(t<0)throw new RangeError("Value must be greater than or equal to 0");return"bigint"==typeof t?t*(t+1n)/2n:t*(t+1)/2},t.trimEnd=function(t,e){const n=p(t,e);return-1===n?"string"==typeof t?t:[...t]:t.slice(0,n)},t.trimStart=function(t,e){const n=R(t,e);return-1===n?"string"==typeof t?t:[...t]:t.slice(n+1)},t.truncate=function(t,e,n=""){return t.length>e?`${t.slice(0,e)}${n}`:t},t.uncapitalize=function(t){const e=t.charAt(0).toLowerCase();return`${e}${t.slice(e.length)}`},t.union=function(t,e){return t===e?new Set(t):new Set(m(t,e))},t.variance=F,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jonahsniderUtil={}); | ||
//# sourceMappingURL=index.dev.js.map |
@@ -1,2 +0,2 @@ | ||
var t,e;t=this,e=function(t){"use strict";class e{constructor(t,e){if(this.lower=t,this.upper=e,t>e)throw new RangeError("lower must be less than upper")}static from(t){const[n,r]=t;return new e(n,r)}has(t){return t>=this.lower&&t<=this.upper}*[Symbol.iterator](){yield this.lower,yield this.upper}isSuperrange(t){return t===this||this.lower>=t.lower&&this.upper<=t.upper}isSubrange(t){return t===this||this.lower<=t.lower&&this.upper>=t.upper}equals(t){return t===this||this.lower===t.lower&&this.upper===t.upper}intersects(t){return t===this||this.lower<=t.upper&&this.upper>=t.lower}}const n=Object.freeze(new e(100,200)),r=Object.freeze(new e(200,300)),i=Object.freeze(new e(300,400)),o=Object.freeze(new e(400,500)),u=Object.freeze(new e(500,600));var a,s,c=Object.freeze({__proto__:null,informational:n,success:r,redirects:i,clientErrors:o,serverErrors:u});!function(t){t[t.Continue=100]="Continue",t[t.SwitchingProtocols=101]="SwitchingProtocols",t[t.EarlyHints=103]="EarlyHints",t[t.Ok=200]="Ok",t[t.Created=201]="Created",t[t.Accepted=202]="Accepted",t[t.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",t[t.NoContent=204]="NoContent",t[t.ResetContent=205]="ResetContent",t[t.PartialContent=206]="PartialContent",t[t.MultipleChoices=300]="MultipleChoices",t[t.MovedPermanently=301]="MovedPermanently",t[t.Found=302]="Found",t[t.SeeOther=303]="SeeOther",t[t.NotModified=304]="NotModified",t[t.TemporaryRedirect=307]="TemporaryRedirect",t[t.PermanentRedirect=308]="PermanentRedirect",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.PaymentRequired=402]="PaymentRequired",t[t.Forbidden=403]="Forbidden",t[t.NotFound=404]="NotFound",t[t.MethodNotAllowed=405]="MethodNotAllowed",t[t.NotAcceptable=406]="NotAcceptable",t[t.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",t[t.RequestTimeout=408]="RequestTimeout",t[t.Conflict=409]="Conflict",t[t.Gone=410]="Gone",t[t.LengthRequired=411]="LengthRequired",t[t.PreconditionFailed=412]="PreconditionFailed",t[t.PayloadTooLarge=413]="PayloadTooLarge",t[t.UriTooLong=414]="UriTooLong",t[t.UnsupportedMediaType=415]="UnsupportedMediaType",t[t.RangeNotSatisfiable=416]="RangeNotSatisfiable",t[t.ExpectationFailed=417]="ExpectationFailed",t[t.ImATeapot=418]="ImATeapot",t[t.UnprocessableEntity=422]="UnprocessableEntity",t[t.TooEarly=425]="TooEarly",t[t.UpgradeRequired=426]="UpgradeRequired",t[t.PreconditionRequired=428]="PreconditionRequired",t[t.TooManyRequests=429]="TooManyRequests",t[t.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",t[t.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",t[t.InternalServerError=500]="InternalServerError",t[t.NotImplemented=501]="NotImplemented",t[t.BadGateway=502]="BadGateway",t[t.ServiceUnavailable=503]="ServiceUnavailable",t[t.GatewayTimeout=504]="GatewayTimeout",t[t.HttpVersionNotSupported=505]="HttpVersionNotSupported",t[t.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",t[t.InsufficientStorage=507]="InsufficientStorage",t[t.LoopDetected=508]="LoopDetected",t[t.NotExtended=510]="NotExtended",t[t.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired"}(a||(a={})),function(t){t.Get="GET",t.Head="HEAD",t.Post="POST",t.Put="PUT",t.Delete="DELETE",t.Connect="CONNECT",t.Options="OPTIONS",t.Trace="TRACE",t.Patch="PATCH"}(s||(s={}));var f,l,d=Object.freeze({__proto__:null,StatusRange:c,get Status(){return a},get Method(){return s}});function h(t,e){return Array.from({length:e},((e,n)=>t(n)))}function p(t,e){const n=[];for(let r=0;r<t.length;r++)t[r]===e&&n.push(r);return n}function S(t,e){let n;if("size"in t?n="size":"length"in t&&(n="length"),!n)throw new RangeError("Expected a to have a size property or a length property");return t[n]<e[n]?[e,t]:[t,e]}function*k(...t){for(const e of t)yield*e}function m(t){const e=new Map;for(const n of t){const t=(e.get(n)??0)+1;e.set(n,t)}return e}function*g(t,e){for(let n=0;n<e;n++)yield t}t.Rank=void 0,(f=t.Rank||(t.Rank={}))[f.Ace=1]="Ace",f[f.Two=2]="Two",f[f.Three=3]="Three",f[f.Four=4]="Four",f[f.Five=5]="Five",f[f.Six=6]="Six",f[f.Seven=7]="Seven",f[f.Eight=8]="Eight",f[f.Nine=9]="Nine",f[f.Ten=10]="Ten",f[f.Jack=11]="Jack",f[f.Queen=12]="Queen",f[f.King=13]="King",t.Suit=void 0,(l=t.Suit||(t.Suit={}))[l.Clubs=0]="Clubs",l[l.Diamonds=1]="Diamonds",l[l.Hearts=2]="Hearts",l[l.Spades=3]="Spades";const R=[{rank:t.Rank.Ace,suit:t.Suit.Clubs},{rank:t.Rank.Two,suit:t.Suit.Clubs},{rank:t.Rank.Three,suit:t.Suit.Clubs},{rank:t.Rank.Four,suit:t.Suit.Clubs},{rank:t.Rank.Five,suit:t.Suit.Clubs},{rank:t.Rank.Six,suit:t.Suit.Clubs},{rank:t.Rank.Seven,suit:t.Suit.Clubs},{rank:t.Rank.Eight,suit:t.Suit.Clubs},{rank:t.Rank.Nine,suit:t.Suit.Clubs},{rank:t.Rank.Ten,suit:t.Suit.Clubs},{rank:t.Rank.Jack,suit:t.Suit.Clubs},{rank:t.Rank.Queen,suit:t.Suit.Clubs},{rank:t.Rank.King,suit:t.Suit.Clubs},{rank:t.Rank.Ace,suit:t.Suit.Diamonds},{rank:t.Rank.Two,suit:t.Suit.Diamonds},{rank:t.Rank.Three,suit:t.Suit.Diamonds},{rank:t.Rank.Four,suit:t.Suit.Diamonds},{rank:t.Rank.Five,suit:t.Suit.Diamonds},{rank:t.Rank.Six,suit:t.Suit.Diamonds},{rank:t.Rank.Seven,suit:t.Suit.Diamonds},{rank:t.Rank.Eight,suit:t.Suit.Diamonds},{rank:t.Rank.Nine,suit:t.Suit.Diamonds},{rank:t.Rank.Ten,suit:t.Suit.Diamonds},{rank:t.Rank.Jack,suit:t.Suit.Diamonds},{rank:t.Rank.Queen,suit:t.Suit.Diamonds},{rank:t.Rank.King,suit:t.Suit.Diamonds},{rank:t.Rank.Ace,suit:t.Suit.Hearts},{rank:t.Rank.Two,suit:t.Suit.Hearts},{rank:t.Rank.Three,suit:t.Suit.Hearts},{rank:t.Rank.Four,suit:t.Suit.Hearts},{rank:t.Rank.Five,suit:t.Suit.Hearts},{rank:t.Rank.Six,suit:t.Suit.Hearts},{rank:t.Rank.Seven,suit:t.Suit.Hearts},{rank:t.Rank.Eight,suit:t.Suit.Hearts},{rank:t.Rank.Nine,suit:t.Suit.Hearts},{rank:t.Rank.Ten,suit:t.Suit.Hearts},{rank:t.Rank.Jack,suit:t.Suit.Hearts},{rank:t.Rank.Queen,suit:t.Suit.Hearts},{rank:t.Rank.King,suit:t.Suit.Hearts},{rank:t.Rank.Ace,suit:t.Suit.Spades},{rank:t.Rank.Two,suit:t.Suit.Spades},{rank:t.Rank.Three,suit:t.Suit.Spades},{rank:t.Rank.Four,suit:t.Suit.Spades},{rank:t.Rank.Five,suit:t.Suit.Spades},{rank:t.Rank.Six,suit:t.Suit.Spades},{rank:t.Rank.Seven,suit:t.Suit.Spades},{rank:t.Rank.Eight,suit:t.Suit.Spades},{rank:t.Rank.Nine,suit:t.Suit.Spades},{rank:t.Rank.Ten,suit:t.Suit.Spades},{rank:t.Rank.Jack,suit:t.Suit.Spades},{rank:t.Rank.Queen,suit:t.Suit.Spades},{rank:t.Rank.King,suit:t.Suit.Spades}];class y extends Map{constructor(t,e){super(e),this.defaultValueOrDefaultValueFn=t,this.defaultValueIsFunction="function"==typeof t}get(t){return this.has(t)?super.get(t):this.defaultValueIsFunction?this.defaultValueOrDefaultValueFn(t):this.defaultValueOrDefaultValueFn}}const b=new WeakMap;function w(t){const e=t[0].map((t=>t.length));for(const n of t)for(const[t,{length:r}]of n.entries())e[t]<r&&(e[t]=r);return e}function T(t,e){if(Array.isArray(t)&&Array.isArray(e))return function(t,e){return t===e||t.length===e.length&&t.every(((t,n)=>t===e[n]))}(t,e);if(t instanceof Set&&e instanceof Set)return function(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}(t,e);if(t instanceof Map&&e instanceof Map)return function(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const[n,r]of t.entries())if(!e.has(n)||e.get(n)!==r)return!1;return!0}(t,e);throw new RangeError("Expected both parameters to be an array, Set, or Map")}function v(t,e,n){return t<e?e:t>n?n:t}function E(t,e){return t+e}function A(t){const e=t.reduce(E);return e/("bigint"==typeof e?BigInt(t.length):t.length)}function C(t,e,n){return 1/(2.5066282746310002*e)*Math.E**(-.5*(t-n/e)**2)}function N(t,e){return Math.random()*(e-t)+t}function M(t,e=A(t)){return t.map((t=>(t-e)**2)).reduce(E)/(t.length-1)}function F(t,e=A(t)){return Math.sqrt(M(t,e))}const P=Symbol("delayResolvedValue");var x=Object.freeze({__proto__:null,and:function(t,e){return t&e},or:function(t,e){return t|e},xor:function(t,e){return t^e}});function O(t,e){return t<e?-1:t>e?1:0}function D(t,e){return t<e?1:t>e?-1:0}var H=Object.freeze({__proto__:null,ascending:function(t,e){return e===undefined&&"function"==typeof t?(e,n)=>O(t(e),t(n)):O(t,e)},descending:function(t,e){return e===undefined&&"function"==typeof t?(e,n)=>D(t(e),t(n)):D(t,e)}});const z=/\S/;t.AutoPercentage=class{constructor(){this._count=0}percentage(){return this._count++,{[Symbol.toPrimitive]:()=>1/this._count}}count(){return this._count++,{[Symbol.toPrimitive]:()=>this._count}}},t.Bitwise=x,t.DefaultMap=y,t.Http=d,t.Range=e,t.Sort=H,t.Stopwatch=class{static start(){const t=new this;return t.start(),t}get started(){return this.startTime!==undefined}start(){this.startTime=process.hrtime.bigint()}end(){return Number(process.hrtime.bigint()-this.startTime)/1e6}},t.allDuplicates=function(t){const e=new Set,n=[];for(const r of t)e.has(r)?n.push(r):e.add(r);return n},t.binarySearch=function(t,e){let n=0,r=t.length-1;for(;n<=r;){const i=Math.trunc((n+r)/2),o=e(t[i]);if(o<0)n=i+1;else{if(!(o>0))return t[i];r=i-1}}return undefined},t.capitalize=function(t){const e=t.charAt(0).toUpperCase();return`${e}${t.slice(e.length)}`},t.chunk=function(t,e){return t.length===e?t.map((t=>[t])):h((n=>t.slice(n*e,n*e+e)),Math.ceil(t.length/e))},t.clamp=v,t.combineIterables=k,t.count=function(t,e){let n=0;if(e)for(const r of t)e(r)&&n++;else for(const e of t)n++;return n},t.cycle=function*(t,e){for(let n=0;n<e;n++)yield*t},t.difference=function(t,e){if(t===e)return new Set;const n=new Set(t);for(const t of e)n["delete"](t);return n},t.duplicates=function(t){const e=new Set,n=new Set;for(const r of t)e.has(r)?n.add(r):e.add(r);return n},t.enumHas=function(t,e){return b.has(t)||b.set(t,new Set(Object.values(t))),b.get(t).has(e)},t.every=function(t,e){for(const n of t)if(!e(n))return!1;return!0},t.fill=function(t,e){return Array.from({length:e},(()=>t))},t.find=function(t,e){for(const n of t)if(e(n))return n;return undefined},t.findIndexAll=function(t,e){const n=[];for(let r=0;r<t.length;r++)e(t[r],r)&&n.push(r);return n},t.first=function(t,e){if(e===undefined){for(const e of t)return e;return undefined}return function*(t,e){for(const n of t){if(!e--)break;yield n}}(t,e)},t.formatTable=function(t,e=" "){const n=w(t);return t.map((t=>t.map(((t,e)=>t.padEnd(n[e]))).join(e))).join("\n")},t.frequencyTable=m,t.holes=function(t){const e=[];for(let n=0;n<t.length;n++)n in t||e.push(n);return e},t.identical=T,t.includes=function(t,e){for(const n of t)if(n===e)return!0;return!1},t.indexOfAll=p,t.intersection=function(t,e){if(t===e)return new Set(t);const n=new Set,[r,i]=S(t,e);for(const t of r)i.has(t)&&n.add(t);return n},t.invert=function(t){return(...e)=>-t(...e)},t.isAnagram=function(t,e){return t===e||t.length===e.length&&T(m(t),m(e))},t.isDisjoint=function(t,e){if(t===e)return!1;const n=t instanceof Set?t:new Set(t);for(const t of e)if(n.has(t))return!1;return!0},t.isEmpty=function(t){for(const e of t)return!1;return!0},t.isSorted=function(t,e){for(let n=0;n<t.length-1;n++)if(e(t[n],t[n+1])>0)return!1;return!0},t.isSubset=function(t,e){if(t===e)return!0;for(const n of t)if(!e.has(n))return!1;return!0},t.isSuperset=function(t,e){if(t===e)return!0;for(const n of e)if(!t.has(n))return!1;return!0},t.isWhitespace=function(t){return!z.test(t)},t.jaccardIndex=function(t,e){if(0===t.size&&0===e.size)return 1;let n=0;const[r,i]=S(t,e);for(const t of r)i.has(t)&&n++;return v(n/(t.size+e.size-n),0,1)},t.join=function(t,e=","){let n="";const r=t[Symbol.iterator]();let i=r.next();for(;;){const t=i;if(i=r.next(),n+=t.value,i.done)return n;n+=e}},t.largeToSmall=S,t.lines=function(t){return t.split("\n").map((t=>t.trim())).filter((t=>t.length>0))},t.mapFill=h,t.mapRepeat=function*(t,e){for(let n=0;n<e;n++)yield t(n)},t.max=function(t,e){return e>t?e:t},t.maxColumnLength=w,t.mean=A,t.median=function(t){const e=t.length%2==0,n=t.length/2;if(e){const e="bigint"==typeof t[0]?2n:2;return(t[n-1]+t[n])/e}return t[Math.floor(n)]},t.min=function(t,e){return e<t?e:t},t.mode=function(t){const e=new Map;let n=0,r=[];for(const i of t){const t=e.get(i),o=t===undefined?1:t+1;e.set(i,o),o>n?(n=o,r=[i]):o===n&&r.push(i)}return r},t.multiReplace=function(t,e){const n=Object.entries(e);let r="",i=0;for(;i<t.length;)t:{for(const[e,o]of n)if(t.slice(i).startsWith(e)){r+=o,i+=e.length;break t}r+=t[i++]}return r},t.name=function q(t,e){return e?`${q(t)}${e.name in t?".":"#"}${e.name}`:t.name},t.newDeck=function(){return[...R]},t.normaldist=C,t.not=function(t){return(...e)=>!t(...e)},t.nullish=function(t){return null===t||t===undefined},t.overwrite=function(t,e,n){return t.splice(e,e+n.length-1,...n)},t.padEnd=function(t,e,n){t.push(...g(n,e-t.length))},t.padStart=function(t,e,n){t.unshift(...g(n,e-t.length))},t.partition=function(t,e){const n=[],r=[];let i=0;for(const o of t)(e(o,i++)?n:r).push(o);return[n,r]},t.product=function(t,e){return t*e},t.pull=function(t,e){const n=t.indexOf(e);return-1===n?[]:t.splice(n,1)},t.pullAll=function(t,e){const n=p(t,e);n.reverse();const r=[];for(const e of n)r.push(t.splice(e,1)[0]);return r},t.random=N,t.randomInt=function(t,e){return Math.floor(N(Math.ceil(t),Math.floor(e)))},t.regExpUnion=function(...t){return RegExp(t.map((t=>`(${t.source})`)).join("|"))},t.relativeStddev=function(t,e=A(t)){return F(t,e)/e},t.rename=function(t,e,n){if(e===n)return{...t};const{[e]:r,...i}={...t,[n]:t[e]};return i},t.repeat=g,t.replace=function(t,e,n){const r=t.indexOf(e);return-1!==r&&(t[r]=n),r},t.replaceAll=function(t,e,n){let r=0;for(let i=0;i<t.length;i++)t[i]===e&&(t[i]=n,r++);return r},t.same=function(...t){const e=t.map((t=>t[Symbol.iterator]()));for(;;){const t=e.map((t=>t.next())),[{done:n,value:r}]=t;for(const e of t){if(e.done)return t.every((t=>t.done===n));if(e.value!==r)return!1}}},t.sample=function(t){return t[Math.floor(Math.random()*t.length)]},t.settled=async function(t){try{return[await t,undefined]}catch(e){return[undefined,e]}},t.shuffle=function(t,e=!0){const n=e?t:[...t];for(let t=n.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}if(!e)return n},t.some=function(t,e){for(const n of t)if(e(n))return!0;return!1},t.sortObject=function(t,e){return Object.entries(t).sort((([,t],[,n])=>e(t,n)))},t.standardNormaldist=function(t){return C(t,1,0)},t.stddev=F,t.sum=E,t.symmetricDifference=function(t,e){if(t===e)return new Set;const n=new Set(t);for(const t of e)n.has(t)?n["delete"](t):n.add(t);return n},t.thunkify=function(t){let e,n=!1;return(...r)=>(n||(n=!0,e=t(...r)),e)},t.timeout=async function(t,e){const[n,r]=function(t){let e;const n=new Promise((n=>{e=setTimeout((()=>{n(P)}),t)}));return[e,n]}(e),i=await Promise.race([t,r])["finally"]((()=>{clearTimeout(n)}));if(i===P)throw Error("Timed out");return i},t.toDigits=function(t,e){const n=10**e;return Math.round(t*n*(1+Number.EPSILON))/n},t.truncate=function(t,e,n=""){return t.length>e?`${t.slice(0,e)}${n}`:t},t.uncapitalize=function(t){const e=t.charAt(0).toLowerCase();return`${e}${t.slice(e.length)}`},t.union=function(t,e){return t===e?new Set(t):new Set(k(t,e))},t.variance=M,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jonahsniderUtil={}); | ||
var t,e;t=this,e=function(t){"use strict";class e{constructor(t,e){if(this.lower=t,this.upper=e,t>e)throw new RangeError("lower must be less than upper")}static from(t){const[n,r]=t;return new e(n,r)}has(t){return t>=this.lower&&t<=this.upper}*[Symbol.iterator](){yield this.lower,yield this.upper}isSuperrange(t){return t===this||this.lower>=t.lower&&this.upper<=t.upper}isSubrange(t){return t===this||this.lower<=t.lower&&this.upper>=t.upper}equals(t){return t===this||this.lower===t.lower&&this.upper===t.upper}intersects(t){return t===this||this.lower<=t.upper&&this.upper>=t.lower}}const n=Object.freeze(new e(100,200)),r=Object.freeze(new e(200,300)),i=Object.freeze(new e(300,400)),o=Object.freeze(new e(400,500)),u=Object.freeze(new e(500,600));var a,s,c=Object.freeze({__proto__:null,informational:n,success:r,redirects:i,clientErrors:o,serverErrors:u});!function(t){t[t.Continue=100]="Continue",t[t.SwitchingProtocols=101]="SwitchingProtocols",t[t.EarlyHints=103]="EarlyHints",t[t.Ok=200]="Ok",t[t.Created=201]="Created",t[t.Accepted=202]="Accepted",t[t.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",t[t.NoContent=204]="NoContent",t[t.ResetContent=205]="ResetContent",t[t.PartialContent=206]="PartialContent",t[t.MultipleChoices=300]="MultipleChoices",t[t.MovedPermanently=301]="MovedPermanently",t[t.Found=302]="Found",t[t.SeeOther=303]="SeeOther",t[t.NotModified=304]="NotModified",t[t.TemporaryRedirect=307]="TemporaryRedirect",t[t.PermanentRedirect=308]="PermanentRedirect",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.PaymentRequired=402]="PaymentRequired",t[t.Forbidden=403]="Forbidden",t[t.NotFound=404]="NotFound",t[t.MethodNotAllowed=405]="MethodNotAllowed",t[t.NotAcceptable=406]="NotAcceptable",t[t.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",t[t.RequestTimeout=408]="RequestTimeout",t[t.Conflict=409]="Conflict",t[t.Gone=410]="Gone",t[t.LengthRequired=411]="LengthRequired",t[t.PreconditionFailed=412]="PreconditionFailed",t[t.PayloadTooLarge=413]="PayloadTooLarge",t[t.UriTooLong=414]="UriTooLong",t[t.UnsupportedMediaType=415]="UnsupportedMediaType",t[t.RangeNotSatisfiable=416]="RangeNotSatisfiable",t[t.ExpectationFailed=417]="ExpectationFailed",t[t.ImATeapot=418]="ImATeapot",t[t.UnprocessableEntity=422]="UnprocessableEntity",t[t.TooEarly=425]="TooEarly",t[t.UpgradeRequired=426]="UpgradeRequired",t[t.PreconditionRequired=428]="PreconditionRequired",t[t.TooManyRequests=429]="TooManyRequests",t[t.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",t[t.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",t[t.InternalServerError=500]="InternalServerError",t[t.NotImplemented=501]="NotImplemented",t[t.BadGateway=502]="BadGateway",t[t.ServiceUnavailable=503]="ServiceUnavailable",t[t.GatewayTimeout=504]="GatewayTimeout",t[t.HttpVersionNotSupported=505]="HttpVersionNotSupported",t[t.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",t[t.InsufficientStorage=507]="InsufficientStorage",t[t.LoopDetected=508]="LoopDetected",t[t.NotExtended=510]="NotExtended",t[t.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired"}(a||(a={})),function(t){t.Get="GET",t.Head="HEAD",t.Post="POST",t.Put="PUT",t.Delete="DELETE",t.Connect="CONNECT",t.Options="OPTIONS",t.Trace="TRACE",t.Patch="PATCH"}(s||(s={}));var f,l,d=Object.freeze({__proto__:null,StatusRange:c,get Status(){return a},get Method(){return s}});function h(t,e){return Array.from({length:e},((e,n)=>t(n)))}function p(t,e){let n=-1;for(let r=t.length-1;r>=0&&t[r]===e;r--)n=r;return n}function S(t,e){const n=[];for(let r=0;r<t.length;r++)t[r]===e&&n.push(r);return n}function k(t,e){let n;if("size"in t?n="size":"length"in t&&(n="length"),!n)throw new RangeError("Expected a to have a size property or a length property");return t[n]<e[n]?[e,t]:[t,e]}function*m(...t){for(const e of t)yield*e}function g(t){const e=new Map;for(const n of t){const t=(e.get(n)??0)+1;e.set(n,t)}return e}function R(t,e){let n=-1;for(const r of t){if(r!==e)break;n++}return n}function*b(t,e){for(let n=0;n<e;n++)yield t}t.Rank=void 0,(f=t.Rank||(t.Rank={}))[f.Ace=1]="Ace",f[f.Two=2]="Two",f[f.Three=3]="Three",f[f.Four=4]="Four",f[f.Five=5]="Five",f[f.Six=6]="Six",f[f.Seven=7]="Seven",f[f.Eight=8]="Eight",f[f.Nine=9]="Nine",f[f.Ten=10]="Ten",f[f.Jack=11]="Jack",f[f.Queen=12]="Queen",f[f.King=13]="King",t.Suit=void 0,(l=t.Suit||(t.Suit={}))[l.Clubs=0]="Clubs",l[l.Diamonds=1]="Diamonds",l[l.Hearts=2]="Hearts",l[l.Spades=3]="Spades";const y=[{rank:t.Rank.Ace,suit:t.Suit.Clubs},{rank:t.Rank.Two,suit:t.Suit.Clubs},{rank:t.Rank.Three,suit:t.Suit.Clubs},{rank:t.Rank.Four,suit:t.Suit.Clubs},{rank:t.Rank.Five,suit:t.Suit.Clubs},{rank:t.Rank.Six,suit:t.Suit.Clubs},{rank:t.Rank.Seven,suit:t.Suit.Clubs},{rank:t.Rank.Eight,suit:t.Suit.Clubs},{rank:t.Rank.Nine,suit:t.Suit.Clubs},{rank:t.Rank.Ten,suit:t.Suit.Clubs},{rank:t.Rank.Jack,suit:t.Suit.Clubs},{rank:t.Rank.Queen,suit:t.Suit.Clubs},{rank:t.Rank.King,suit:t.Suit.Clubs},{rank:t.Rank.Ace,suit:t.Suit.Diamonds},{rank:t.Rank.Two,suit:t.Suit.Diamonds},{rank:t.Rank.Three,suit:t.Suit.Diamonds},{rank:t.Rank.Four,suit:t.Suit.Diamonds},{rank:t.Rank.Five,suit:t.Suit.Diamonds},{rank:t.Rank.Six,suit:t.Suit.Diamonds},{rank:t.Rank.Seven,suit:t.Suit.Diamonds},{rank:t.Rank.Eight,suit:t.Suit.Diamonds},{rank:t.Rank.Nine,suit:t.Suit.Diamonds},{rank:t.Rank.Ten,suit:t.Suit.Diamonds},{rank:t.Rank.Jack,suit:t.Suit.Diamonds},{rank:t.Rank.Queen,suit:t.Suit.Diamonds},{rank:t.Rank.King,suit:t.Suit.Diamonds},{rank:t.Rank.Ace,suit:t.Suit.Hearts},{rank:t.Rank.Two,suit:t.Suit.Hearts},{rank:t.Rank.Three,suit:t.Suit.Hearts},{rank:t.Rank.Four,suit:t.Suit.Hearts},{rank:t.Rank.Five,suit:t.Suit.Hearts},{rank:t.Rank.Six,suit:t.Suit.Hearts},{rank:t.Rank.Seven,suit:t.Suit.Hearts},{rank:t.Rank.Eight,suit:t.Suit.Hearts},{rank:t.Rank.Nine,suit:t.Suit.Hearts},{rank:t.Rank.Ten,suit:t.Suit.Hearts},{rank:t.Rank.Jack,suit:t.Suit.Hearts},{rank:t.Rank.Queen,suit:t.Suit.Hearts},{rank:t.Rank.King,suit:t.Suit.Hearts},{rank:t.Rank.Ace,suit:t.Suit.Spades},{rank:t.Rank.Two,suit:t.Suit.Spades},{rank:t.Rank.Three,suit:t.Suit.Spades},{rank:t.Rank.Four,suit:t.Suit.Spades},{rank:t.Rank.Five,suit:t.Suit.Spades},{rank:t.Rank.Six,suit:t.Suit.Spades},{rank:t.Rank.Seven,suit:t.Suit.Spades},{rank:t.Rank.Eight,suit:t.Suit.Spades},{rank:t.Rank.Nine,suit:t.Suit.Spades},{rank:t.Rank.Ten,suit:t.Suit.Spades},{rank:t.Rank.Jack,suit:t.Suit.Spades},{rank:t.Rank.Queen,suit:t.Suit.Spades},{rank:t.Rank.King,suit:t.Suit.Spades}],w=new WeakMap;function T(t){const e=t[0].map((t=>t.length));for(const n of t)for(const[t,{length:r}]of n.entries())e[t]<r&&(e[t]=r);return e}function v(t,e){if(Array.isArray(t)&&Array.isArray(e))return function(t,e){return t===e||t.length===e.length&&t.every(((t,n)=>t===e[n]))}(t,e);if(t instanceof Set&&e instanceof Set)return function(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}(t,e);if(t instanceof Map&&e instanceof Map)return function(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const[n,r]of t.entries())if(!e.has(n)||e.get(n)!==r)return!1;return!0}(t,e);throw new RangeError("Expected both parameters to be an array, Set, or Map")}class E extends Map{constructor(t,e){super(e),this.defaultValueOrDefaultValueFn=t,this.defaultValueIsFunction="function"==typeof t}get(t){return this.has(t)?super.get(t):this.defaultValueIsFunction?this.defaultValueOrDefaultValueFn(t):this.defaultValueOrDefaultValueFn}}function A(t,e,n){return t<e?e:t>n?n:t}function M(t,e){return t+e}function N(t){const e=t.reduce(M);return e/("bigint"==typeof e?BigInt(t.length):t.length)}function C(t,e,n){return 1/(2.5066282746310002*e)*Math.E**(-.5*(t-n/e)**2)}function x(t,e){return Math.random()*(e-t)+t}function F(t,e=N(t)){return t.map((t=>(t-e)**2)).reduce(M)/(t.length-1)}function O(t,e=N(t)){return Math.sqrt(F(t,e))}const P=Symbol("delayResolvedValue");var D=Object.freeze({__proto__:null,and:function(t,e){return t&e},or:function(t,e){return t|e},xor:function(t,e){return t^e}});function q(t,e){return t<e?-1:t>e?1:0}function H(t,e){return t<e?1:t>e?-1:0}var z=Object.freeze({__proto__:null,ascending:function(t,e){return e===undefined&&"function"==typeof t?(e,n)=>q(t(e),t(n)):q(t,e)},descending:function(t,e){return e===undefined&&"function"==typeof t?(e,n)=>H(t(e),t(n)):H(t,e)}});const _=/\S/;t.AutoPercentage=class{constructor(){this._count=0}percentage(){return this._count++,{[Symbol.toPrimitive]:()=>1/this._count}}count(){return this._count++,{[Symbol.toPrimitive]:()=>this._count}}},t.Bitwise=D,t.DefaultMap=E,t.Http=d,t.MathMap=class extends E{add(t,e){const n=this.get(t)+e;return this.set(t,n),n}subtract(t,e){return this.add(t,-e)}multiply(t,e){const n=this.get(t)*e;return this.set(t,n),n}divide(t,e){const n=this.get(t)/e;return this.set(t,n),n}pow(t,e){const n=this.get(t)**e;return this.set(t,n),n}sqrt(t){const e=Math.sqrt(this.get(t));return this.set(t,e),e}root(t,e){if(2===e)return this.sqrt(t);const n=this.get(t)**(1/e);return this.set(t,n),n}},t.Range=e,t.Sort=z,t.Stopwatch=class{static start(){const t=new this;return t.start(),t}get started(){return this.startTime!==undefined}start(){this.startTime=process.hrtime.bigint()}end(){return Number(process.hrtime.bigint()-this.startTime)/1e6}},t.allDuplicates=function(t){const e=new Set,n=[];for(const r of t)e.has(r)?n.push(r):e.add(r);return n},t.binarySearch=function(t,e){let n=0,r=t.length-1;for(;n<=r;){const i=Math.trunc((n+r)/2),o=e(t[i]);if(o<0)n=i+1;else{if(!(o>0))return t[i];r=i-1}}return undefined},t.capitalize=function(t){const e=t.charAt(0).toUpperCase();return`${e}${t.slice(e.length)}`},t.chunk=function(t,e){return t.length===e?t.map((t=>[t])):h((n=>t.slice(n*e,n*e+e)),Math.ceil(t.length/e))},t.clamp=A,t.combineIterables=m,t.count=function(t,e){let n=0;if(e)for(const r of t)e(r)&&n++;else for(const e of t)n++;return n},t.cycle=function*(t,e){for(let n=0;n<e;n++)yield*t},t.difference=function(t,e){if(t===e)return new Set;const n=new Set(t);for(const t of e)n["delete"](t);return n},t.duplicates=function(t){const e=new Set,n=new Set;for(const r of t)e.has(r)?n.add(r):e.add(r);return n},t.enumHas=function(t,e){return w.has(t)||w.set(t,new Set(Object.values(t))),w.get(t).has(e)},t.every=function(t,e){for(const n of t)if(!e(n))return!1;return!0},t.fill=function(t,e){return Array.from({length:e},(()=>t))},t.find=function(t,e){for(const n of t)if(e(n))return n;return undefined},t.findIndexAll=function(t,e){const n=[];for(let r=0;r<t.length;r++)e(t[r],r)&&n.push(r);return n},t.first=function(t,e){if(e===undefined){for(const e of t)return e;return undefined}return function*(t,e){for(const n of t){if(!e--)break;yield n}}(t,e)},t.firstIndexOfLastGroup=p,t.formatTable=function(t,e=" "){const n=T(t);return t.map((t=>t.map(((t,e)=>t.padEnd(n[e]))).join(e))).join("\n")},t.frequencyTable=g,t.holes=function(t){const e=[];for(let n=0;n<t.length;n++)n in t||e.push(n);return e},t.identical=v,t.includes=function(t,e){for(const n of t)if(n===e)return!0;return!1},t.indexOfAll=S,t.intersection=function(t,e){if(t===e)return new Set(t);const n=new Set,[r,i]=k(t,e);for(const t of r)i.has(t)&&n.add(t);return n},t.invert=function(t){return(...e)=>-t(...e)},t.isAnagram=function(t,e){return t===e||t.length===e.length&&v(g(t),g(e))},t.isDisjoint=function(t,e){if(t===e)return!1;const n=t instanceof Set?t:new Set(t);for(const t of e)if(n.has(t))return!1;return!0},t.isEmpty=function(t){for(const e of t)return!1;return!0},t.isSorted=function(t,e){for(let n=0;n<t.length-1;n++)if(e(t[n],t[n+1])>0)return!1;return!0},t.isSubset=function(t,e){if(t===e)return!0;for(const n of t)if(!e.has(n))return!1;return!0},t.isSuperset=function(t,e){if(t===e)return!0;for(const n of e)if(!t.has(n))return!1;return!0},t.isWhitespace=function(t){return!_.test(t)},t.iteratorToIterable=function(t){return{[Symbol.iterator]:()=>t}},t.jaccardIndex=function(t,e){if(0===t.size&&0===e.size)return 1;let n=0;const[r,i]=k(t,e);for(const t of r)i.has(t)&&n++;return A(n/(t.size+e.size-n),0,1)},t.join=function(t,e=","){let n="";const r=t[Symbol.iterator]();let i=r.next();for(;;){const t=i;if(i=r.next(),n+=t.value,i.done)return n;n+=e}},t.largeToSmall=k,t.lastIndexOfFirstGroup=R,t.lines=function(t){return t.split("\n").map((t=>t.trim())).filter((t=>t.length>0))},t.mapFill=h,t.mapRepeat=function*(t,e){for(let n=0;n<e;n++)yield t(n)},t.max=function(t,e){return e>t?e:t},t.maxColumnLength=T,t.mean=N,t.median=function(t){const e=t.length%2==0,n=t.length/2;if(e){const e="bigint"==typeof t[0]?2n:2;return(t[n-1]+t[n])/e}return t[Math.floor(n)]},t.min=function(t,e){return e<t?e:t},t.mode=function(t){const e=new Map;let n=0,r=[];for(const i of t){const t=e.get(i),o=t===undefined?1:t+1;e.set(i,o),o>n?(n=o,r=[i]):o===n&&r.push(i)}return r},t.multiReplace=function(t,e){const n=Object.entries(e);let r="",i=0;for(;i<t.length;)t:{for(const[e,o]of n)if(t.slice(i).startsWith(e)){r+=o,i+=e.length;break t}r+=t[i++]}return r},t.name=function j(t,e){return e?`${j(t)}${e.name in t?".":"#"}${e.name}`:t.name},t.newDeck=function(){return[...y]},t.normaldist=C,t.not=function(t){return(...e)=>!t(...e)},t.nullish=function(t){return null===t||t===undefined},t.overwrite=function(t,e,n){return t.splice(e,e+n.length-1,...n)},t.padEnd=function(t,e,n){t.push(...b(n,e-t.length))},t.padStart=function(t,e,n){t.unshift(...b(n,e-t.length))},t.partition=function(t,e){const n=[],r=[];let i=0;for(const o of t)(e(o,i++)?n:r).push(o);return[n,r]},t.product=function(t,e){return t*e},t.pull=function(t,e){const n=t.indexOf(e);return-1===n?[]:t.splice(n,1)},t.pullAll=function(t,e){const n=S(t,e);n.reverse();const r=[];for(const e of n)r.push(t.splice(e,1)[0]);return r},t.random=x,t.randomInt=function(t,e){return Math.floor(x(Math.ceil(t),Math.floor(e)))},t.regExpUnion=function(...t){return RegExp(t.map((t=>`(${t.source})`)).join("|"))},t.relativeStddev=function(t,e=N(t)){return O(t,e)/e},t.rename=function(t,e,n){if(e===n)return{...t};const{[e]:r,...i}={...t,[n]:t[e]};return i},t.repeat=b,t.replace=function(t,e,n){const r=t.indexOf(e);return-1!==r&&(t[r]=n),r},t.replaceAll=function(t,e,n){let r=0;for(let i=0;i<t.length;i++)t[i]===e&&(t[i]=n,r++);return r},t.same=function(...t){const e=t.map((t=>t[Symbol.iterator]()));for(;;){const t=e.map((t=>t.next())),[{done:n,value:r}]=t;for(const e of t){if(e.done)return t.every((t=>t.done===n));if(e.value!==r)return!1}}},t.sample=function(t){return t[Math.floor(Math.random()*t.length)]},t.settled=async function(t){try{return[await t,undefined]}catch(e){return[undefined,e]}},t.shuffle=function(t,e=!0){const n=e?t:[...t];for(let t=n.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}if(!e)return n},t.skip=function(t,e){const n=t[Symbol.iterator]();for(let t=0;t<e&&!n.next().done;t++);return n},t.some=function(t,e){for(const n of t)if(e(n))return!0;return!1},t.sortObject=function(t,e){return Object.entries(t).sort((([,t],[,n])=>e(t,n)))},t.standardNormaldist=function(t){return C(t,1,0)},t.stddev=O,t.sum=M,t.symmetricDifference=function(t,e){if(t===e)return new Set;const n=new Set(t);for(const t of e)n.has(t)?n["delete"](t):n.add(t);return n},t.thunkify=function(t){let e,n=!1;return(...r)=>(n||(n=!0,e=t(...r)),e)},t.timeout=async function(t,e){const[n,r]=function(t){let e;const n=new Promise((n=>{e=setTimeout((()=>{n(P)}),t)}));return[e,n]}(e),i=await Promise.race([t,r])["finally"]((()=>{clearTimeout(n)}));if(i===P)throw Error("Timed out");return i},t.toDigits=function(t,e){const n=10**e;return Math.round(t*n*(1+Number.EPSILON))/n},t.triangularNumber=function(t){if(t<0)throw new RangeError("Value must be greater than or equal to 0");return"bigint"==typeof t?t*(t+1n)/2n:t*(t+1)/2},t.trimEnd=function(t,e){const n=p(t,e);return-1===n?"string"==typeof t?t:[...t]:t.slice(0,n)},t.trimStart=function(t,e){const n=R(t,e);return-1===n?"string"==typeof t?t:[...t]:t.slice(n+1)},t.truncate=function(t,e,n=""){return t.length>e?`${t.slice(0,e)}${n}`:t},t.uncapitalize=function(t){const e=t.charAt(0).toLowerCase();return`${e}${t.slice(e.length)}`},t.union=function(t,e){return t===e?new Set(t):new Set(m(t,e))},t.variance=F,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jonahsniderUtil={}); | ||
//# sourceMappingURL=index.prod.js.map |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.18.19" | ||
"packageVersion": "7.18.21" | ||
} | ||
] | ||
} |
{ | ||
"name": "@jonahsnider/util", | ||
"version": "8.8.0", | ||
"version": "8.9.0", | ||
"description": "A useful collection of optimized utility functions", | ||
@@ -63,3 +63,3 @@ "homepage": "https://util.jonah.pw/", | ||
"@jonahsnider/xo-config": "5.0.1", | ||
"@microsoft/api-extractor": "7.18.19", | ||
"@microsoft/api-extractor": "7.18.21", | ||
"@rollup/plugin-babel": "5.3.0", | ||
@@ -71,10 +71,10 @@ "@rollup/plugin-replace": "3.0.0", | ||
"@types/jest": "27.0.3", | ||
"@types/node": "16.11.11", | ||
"@types/node": "16.11.12", | ||
"@types/xo": "0.39.2", | ||
"jest": "27.4.3", | ||
"prettier": "2.5.0", | ||
"prettier": "2.5.1", | ||
"rollup": "2.60.2", | ||
"rollup-plugin-terser": "7.0.2", | ||
"semantic-release": "18.0.1", | ||
"size-limit": "7.0.3", | ||
"size-limit": "7.0.4", | ||
"terser": "5.10.0", | ||
@@ -97,3 +97,3 @@ "ts-jest": "27.0.7", | ||
"brotli": true, | ||
"limit": "4.5 KiB", | ||
"limit": "5.5 KiB", | ||
"path": "./dist/index.prod.js" | ||
@@ -103,3 +103,3 @@ }, | ||
"gzip": true, | ||
"limit": "5.5 KiB", | ||
"limit": "6.5 KiB", | ||
"path": "./dist/index.prod.js" | ||
@@ -109,3 +109,3 @@ }, | ||
"brotli": true, | ||
"limit": "4.5 KiB", | ||
"limit": "5.5 KiB", | ||
"path": "./dist/index.prod.mjs" | ||
@@ -115,3 +115,3 @@ }, | ||
"gzip": true, | ||
"limit": "5.5 KiB", | ||
"limit": "6.5 KiB", | ||
"path": "./dist/index.prod.mjs" | ||
@@ -118,0 +118,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
762616
4273