@jonahsnider/util
Advanced tools
Comparing version 10.1.0 to 10.2.0
@@ -1,2 +0,2 @@ | ||
var e,t;e=this,t=function(e){"use strict";class t{static from(e){const[n,r]=e;return new t(n,r)}constructor(e,t){if(this.lower=e,this.upper=t,e>t)throw new RangeError("lower must be less than upper")}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,f=Object.freeze({__proto__:null,clientErrors:o,informational:n,redirects:i,serverErrors:u,success:r});!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"}(a||(a={})),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.MisdirectedRequest=421]="MisdirectedRequest",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"}(s||(s={})),function(e){e[e.Continue=100]="Continue",e[e["Switching Protocols"]=101]="Switching Protocols",e[e["Early Hints"]=103]="Early Hints",e[e.OK=200]="OK",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e["Non-Authoritative Information"]=203]="Non-Authoritative Information",e[e["No Content"]=204]="No Content",e[e["Reset Content"]=205]="Reset Content",e[e["Partial Content"]=206]="Partial Content",e[e["Multiple Choices"]=300]="Multiple Choices",e[e["Moved Permanently"]=301]="Moved Permanently",e[e.Found=302]="Found",e[e["See Other"]=303]="See Other",e[e["Not Modified"]=304]="Not Modified",e[e["Temporary Redirect"]=307]="Temporary Redirect",e[e["Permanent Redirect"]=308]="Permanent Redirect",e[e["Bad Request"]=400]="Bad Request",e[e.Unauthorized=401]="Unauthorized",e[e["Payment Required"]=402]="Payment Required",e[e.Forbidden=403]="Forbidden",e[e["Not Found"]=404]="Not Found",e[e["Method Not Allowed"]=405]="Method Not Allowed",e[e["Not Acceptable"]=406]="Not Acceptable",e[e["Proxy Authentication Required"]=407]="Proxy Authentication Required",e[e["Request Timeout"]=408]="Request Timeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e["Length Required"]=411]="Length Required",e[e["Precondition Failed"]=412]="Precondition Failed",e[e["Payload Too Large"]=413]="Payload Too Large",e[e["URI Too Long"]=414]="URI Too Long",e[e["Unsupported Media Type"]=415]="Unsupported Media Type",e[e["Range Not Satisfiable"]=416]="Range Not Satisfiable",e[e["Expectation Failed"]=417]="Expectation Failed",e[e["I'm a Teapot"]=418]="I'm a Teapot",e[e["Misdirected Request"]=421]="Misdirected Request",e[e["Unprocessable Content"]=422]="Unprocessable Content",e[e["Too Early"]=425]="Too Early",e[e["Upgrade Required"]=426]="Upgrade Required",e[e["Precondition Required"]=428]="Precondition Required",e[e["Too Many Requests"]=429]="Too Many Requests",e[e["Request Header Fields Too Large"]=431]="Request Header Fields Too Large",e[e["Unavailable For Legal Reasons"]=451]="Unavailable For Legal Reasons",e[e["Internal Server Error"]=500]="Internal Server Error",e[e["Not Implemented"]=501]="Not Implemented",e[e["Bad Gateway"]=502]="Bad Gateway",e[e["Service Unavailable"]=503]="Service Unavailable",e[e["Gateway Timeout"]=504]="Gateway Timeout",e[e["HTTP Version Not Supported"]=505]="HTTP Version Not Supported",e[e["Variant Also Negotiates"]=506]="Variant Also Negotiates",e[e["Insufficient Storage"]=507]="Insufficient Storage",e[e["Loop Detected"]=508]="Loop Detected",e[e["Not Extended"]=510]="Not Extended",e[e["Network Authentication Required"]=511]="Network Authentication Required"}(c||(c={}));var l,d,h=Object.freeze({__proto__:null,get Method(){return a},get Status(){return s},get StatusName(){return c},StatusRange:f});function p(e,t){return Array.from({length:t},((t,n)=>e(n)))}function S(e,t){let n=-1;for(let r=e.length-1;r>=0&&e[r]===t;r--)n=r;return n}function m(e,t){const n=[];for(let r=0;r<e.length;r++)e[r]===t&&n.push(r);return n}function g(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*R(...e){for(const t of e)yield*t}function k(e){const t=new Map;for(const n of e){const e=(t.get(n)??0)+1;t.set(n,e)}return t}function y(e,t){let n=-1;for(const r of e){if(r!==t)break;n++}return n}function*b(e,t){for(let n=0;n<t;n++)yield e}e.Rank=void 0,(l=e.Rank||(e.Rank={}))[l.Ace=1]="Ace",l[l.Two=2]="Two",l[l.Three=3]="Three",l[l.Four=4]="Four",l[l.Five=5]="Five",l[l.Six=6]="Six",l[l.Seven=7]="Seven",l[l.Eight=8]="Eight",l[l.Nine=9]="Nine",l[l.Ten=10]="Ten",l[l.Jack=11]="Jack",l[l.Queen=12]="Queen",l[l.King=13]="King",e.Suit=void 0,(d=e.Suit||(e.Suit={}))[d.Clubs=0]="Clubs",d[d.Diamonds=1]="Diamonds",d[d.Hearts=2]="Hearts",d[d.Spades=3]="Spades";const w=new WeakMap;function T(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 v(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")}class N 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}}function E(e,t,n){if(t>n)throw new RangeError("min exceeded max");return e<t?t:e>n?n:e}function M(e,t){return e*t}function A(e,t){return e+t}function C(e){const t=e.reduce(A);return t/("bigint"==typeof t?BigInt(e.length):e.length)}function q(e,t,n){return 1/(2.5066282746310002*t)*Math.E**(-.5*(e-n/t)**2)}function P(e,t){if(e>t)throw new RangeError("min exceeded max");return Math.random()*(t-e)+e}function x(e,t=C(e)){return e.map((e=>(e-t)**2)).reduce(A)/(e.length-1)}function F(e,t=C(e)){return Math.sqrt(x(e,t))}function O(e,t){if(e===t)return new Set;const n=new Set(e);for(const e of t)n["delete"](e);return n}const I=Symbol("delayResolvedValue");var H=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 U(e,t){return e<t?-1:e>t?1:0}function D(e,t){return e<t?1:e>t?-1:0}var L=Object.freeze({__proto__:null,ascending:function(e,t){return t===undefined&&"function"==typeof e?(t,n)=>U(e(t),e(n)):U(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/,j=/\r\n?|\n/gim;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=H,e.DefaultMap=N,e.Http=h,e.MathMap=class extends N{add(e,t){const n=this.get(e)+t;return this.set(e,n),n}subtract(e,t){const n=this.get(e)-t;return this.set(e,n),n}multiply(e,t){const n=this.get(e)*t;return this.set(e,n),n}divide(e,t){const n=this.get(e)/t;return this.set(e,n),n}pow(e,t){const n=this.get(e)**t;return this.set(e,n),n}sqrt(e){const t=Math.sqrt(this.get(e));return this.set(e,t),t}root(e,t){if(2===t)return this.sqrt(e);const n=this.get(e)**(1/t);return this.set(e,n),n}},e.Range=t,e.Sort=L,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 Stopwatch 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])):p((n=>e.slice(n*t,n*t+t)),Math.ceil(e.length/t))},e.clamp=E,e.concatIterables=R,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=O,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 w.has(e)||w.set(e,new Set(Object.values(e))),w.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.firstIndexOfLastGroup=S,e.formatTable=function(e,t=" "){const n=T(e);return e.map((e=>e.map(((e,t)=>e.padEnd(n[t]))).join(t))).join("\n")},e.frequencyTable=k,e.geometricMean=function(e){return e.reduce(M)**(1/e.length)},e.harmonicMean=function(e){return e.length/e.reduce(((e,t)=>e+1/t),0)},e.holes=function(e){const t=[];for(let n=0;n<e.length;n++)n in e||t.push(n);return t},e.identical=v,e.includes=function(e,t){for(const n of e)if(n===t)return!0;return!1},e.indexOfAll=m,e.intersection=function(e,t){if(e===t)return new Set(e);const n=new Set,[r,i]=g(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&&v(k(e),k(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.iteratorToIterable=function(e){return{[Symbol.iterator]:()=>e}},e.jaccardIndex=function(e,t){if(0===e.size&&0===t.size)return 1;let n=0;const[r,i]=g(e,t);for(const e of r)i.has(e)&&n++;return E(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=g,e.lastIndexOfFirstGroup=y,e.lines=function(e){return e.split(j)},e.mapFill=p,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=T,e.mean=C,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 _(e,t){return t?`${_(e)}${t.name in e?".":"#"}${t.name}`:e.name},e.newDeck=function(){return[{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}]},e.normaldist=q,e.not=function(e){return(...t)=>!e(...t)},e.nullish=function(e){return null===e||e===undefined},e.omit=function(e,t){const n=O(Object.keys(e),t.filter((e=>"symbol"!=typeof e)).map(String));return Object.fromEntries([...n].map((t=>[t,e[t]])))},e.overwrite=function(e,t,n){return e.splice(t,t+n.length-1,...n)},e.padEnd=function(e,t,n){e.push(...b(n,t-e.length))},e.padStart=function(e,t,n){e.unshift(...b(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.pick=function(e,t){return Object.fromEntries(t.map((t=>[t,e[t]])))},e.product=M,e.pull=function(e,t){const n=e.indexOf(t);return-1===n?[]:e.splice(n,1)},e.pullAll=function(e,t){const n=m(e,t);n.reverse();const r=[];for(const t of n)r.push(e.splice(t,1)[0]);return r},e.random=P,e.randomInt=function(e,t){if(e>t)throw new RangeError("min exceeded max");return Math.floor(P(Math.ceil(e),Math.floor(t)))},e.regExpUnion=function(...e){return RegExp(e.map((e=>`(${e.source})`)).join("|"))},e.relativeStddev=function(e,t=C(e)){return F(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=b,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.skip=function(e,t){const n=e[Symbol.iterator]();for(let e=0;e<t&&!n.next().done;e++);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 q(e,1,0)},e.stddev=F,e.sum=A,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(I)}),e)}));return[t,n]}(t),i=await Promise.race([e,r])["finally"]((()=>{clearTimeout(n)}));if(i===I)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.triangularNumber=function(e){if(e<0)throw new RangeError("Value must be greater than or equal to 0");return"bigint"==typeof e?e*(e+1n)/2n:e*(e+1)/2},e.trimEnd=function(e,t){const n=S(e,t);return-1===n?"string"==typeof e?e:[...e]:e.slice(0,n)},e.trimStart=function(e,t){const n=y(e,t);return-1===n?"string"==typeof e?e:[...e]:e.slice(n+1)},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(R(e,t))},e.variance=x},"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 e,t;e=this,t=function(e){"use strict";class t{static from(e){const[n,r]=e;return new t(n,r)}constructor(e,t){if(this.lower=e,this.upper=t,e>t)throw new RangeError("lower must be less than upper")}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,f=Object.freeze({__proto__:null,clientErrors:o,informational:n,redirects:i,serverErrors:u,success:r});!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"}(a||(a={})),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.MisdirectedRequest=421]="MisdirectedRequest",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"}(s||(s={})),function(e){e[e.Continue=100]="Continue",e[e["Switching Protocols"]=101]="Switching Protocols",e[e["Early Hints"]=103]="Early Hints",e[e.OK=200]="OK",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e["Non-Authoritative Information"]=203]="Non-Authoritative Information",e[e["No Content"]=204]="No Content",e[e["Reset Content"]=205]="Reset Content",e[e["Partial Content"]=206]="Partial Content",e[e["Multiple Choices"]=300]="Multiple Choices",e[e["Moved Permanently"]=301]="Moved Permanently",e[e.Found=302]="Found",e[e["See Other"]=303]="See Other",e[e["Not Modified"]=304]="Not Modified",e[e["Temporary Redirect"]=307]="Temporary Redirect",e[e["Permanent Redirect"]=308]="Permanent Redirect",e[e["Bad Request"]=400]="Bad Request",e[e.Unauthorized=401]="Unauthorized",e[e["Payment Required"]=402]="Payment Required",e[e.Forbidden=403]="Forbidden",e[e["Not Found"]=404]="Not Found",e[e["Method Not Allowed"]=405]="Method Not Allowed",e[e["Not Acceptable"]=406]="Not Acceptable",e[e["Proxy Authentication Required"]=407]="Proxy Authentication Required",e[e["Request Timeout"]=408]="Request Timeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e["Length Required"]=411]="Length Required",e[e["Precondition Failed"]=412]="Precondition Failed",e[e["Payload Too Large"]=413]="Payload Too Large",e[e["URI Too Long"]=414]="URI Too Long",e[e["Unsupported Media Type"]=415]="Unsupported Media Type",e[e["Range Not Satisfiable"]=416]="Range Not Satisfiable",e[e["Expectation Failed"]=417]="Expectation Failed",e[e["I'm a Teapot"]=418]="I'm a Teapot",e[e["Misdirected Request"]=421]="Misdirected Request",e[e["Unprocessable Content"]=422]="Unprocessable Content",e[e["Too Early"]=425]="Too Early",e[e["Upgrade Required"]=426]="Upgrade Required",e[e["Precondition Required"]=428]="Precondition Required",e[e["Too Many Requests"]=429]="Too Many Requests",e[e["Request Header Fields Too Large"]=431]="Request Header Fields Too Large",e[e["Unavailable For Legal Reasons"]=451]="Unavailable For Legal Reasons",e[e["Internal Server Error"]=500]="Internal Server Error",e[e["Not Implemented"]=501]="Not Implemented",e[e["Bad Gateway"]=502]="Bad Gateway",e[e["Service Unavailable"]=503]="Service Unavailable",e[e["Gateway Timeout"]=504]="Gateway Timeout",e[e["HTTP Version Not Supported"]=505]="HTTP Version Not Supported",e[e["Variant Also Negotiates"]=506]="Variant Also Negotiates",e[e["Insufficient Storage"]=507]="Insufficient Storage",e[e["Loop Detected"]=508]="Loop Detected",e[e["Not Extended"]=510]="Not Extended",e[e["Network Authentication Required"]=511]="Network Authentication Required"}(c||(c={}));var l,d,h=Object.freeze({__proto__:null,get Method(){return a},get Status(){return s},get StatusName(){return c},StatusRange:f});function p(e,t){let n=-1;for(let r=e.length-1;r>=0&&e[r]===t;r--)n=r;return n}function S(e,t){const n=[];for(let r=0;r<e.length;r++)e[r]===t&&n.push(r);return n}function m(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 g(e,t){return Array.from({length:t},((t,n)=>e(n)))}function*R(...e){for(const t of e)yield*t}function k(e){const t=new Map;for(const n of e){const e=(t.get(n)??0)+1;t.set(n,e)}return t}function y(e,t){let n=-1;for(const r of e){if(r!==t)break;n++}return n}function*b(e,t){for(let n=0;n<t;n++)yield e}e.Rank=void 0,(l=e.Rank||(e.Rank={}))[l.Ace=1]="Ace",l[l.Two=2]="Two",l[l.Three=3]="Three",l[l.Four=4]="Four",l[l.Five=5]="Five",l[l.Six=6]="Six",l[l.Seven=7]="Seven",l[l.Eight=8]="Eight",l[l.Nine=9]="Nine",l[l.Ten=10]="Ten",l[l.Jack=11]="Jack",l[l.Queen=12]="Queen",l[l.King=13]="King",e.Suit=void 0,(d=e.Suit||(e.Suit={}))[d.Clubs=0]="Clubs",d[d.Diamonds=1]="Diamonds",d[d.Hearts=2]="Hearts",d[d.Spades=3]="Spades";const w=new WeakMap;function T(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 v(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")}class N 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}}function E(e,t,n){if(t>n)throw new RangeError("min exceeded max");return e<t?t:e>n?n:e}function M(e,t){return e*t}function A(e,t){return e+t}function C(e){const t=e.reduce(A);return t/("bigint"==typeof t?BigInt(e.length):e.length)}function q(e,t,n){return 1/(2.5066282746310002*t)*Math.E**(-.5*(e-n/t)**2)}function P(e,t){if(e>t)throw new RangeError("min exceeded max");return Math.random()*(t-e)+e}function x(e,t=C(e)){return e.map((e=>(e-t)**2)).reduce(A)/(e.length-1)}function F(e,t=C(e)){return Math.sqrt(x(e,t))}function O(e,t){if(e===t)return new Set;const n=new Set(e);for(const e of t)n["delete"](e);return n}const I=Symbol("delayResolvedValue");var H=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 U(e,t){return e<t?-1:e>t?1:0}function D(e,t){return e<t?1:e>t?-1:0}var L=Object.freeze({__proto__:null,ascending:function(e,t){return t===undefined&&"function"==typeof e?(t,n)=>U(e(t),e(n)):U(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/,j=/\r\n?|\n/gim;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=H,e.DefaultMap=N,e.Http=h,e.MathMap=class extends N{add(e,t){const n=this.get(e)+t;return this.set(e,n),n}subtract(e,t){const n=this.get(e)-t;return this.set(e,n),n}multiply(e,t){const n=this.get(e)*t;return this.set(e,n),n}divide(e,t){const n=this.get(e)/t;return this.set(e,n),n}pow(e,t){const n=this.get(e)**t;return this.set(e,n),n}sqrt(e){const t=Math.sqrt(this.get(e));return this.set(e,t),t}root(e,t){if(2===t)return this.sqrt(e);const n=this.get(e)**(1/t);return this.set(e,n),n}},e.Range=t,e.Sort=L,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 Stopwatch 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 Array.isArray(e)?function(e,t){return g((n=>e.slice(n*t,n*t+t)),Math.ceil(e.length/t))}(e,t):function*(e,t){let n=[];for(const r of e)n.push(r),n.length===t&&(yield n,n=[]);n.length>0&&(yield n)}(e,t)},e.clamp=E,e.concatIterables=R,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=O,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 w.has(e)||w.set(e,new Set(Object.values(e))),w.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.firstIndexOfLastGroup=p,e.formatTable=function(e,t=" "){const n=T(e);return e.map((e=>e.map(((e,t)=>e.padEnd(n[t]))).join(t))).join("\n")},e.frequencyTable=k,e.geometricMean=function(e){return e.reduce(M)**(1/e.length)},e.harmonicMean=function(e){return e.length/e.reduce(((e,t)=>e+1/t),0)},e.holes=function(e){const t=[];for(let n=0;n<e.length;n++)n in e||t.push(n);return t},e.identical=v,e.includes=function(e,t){for(const n of e)if(n===t)return!0;return!1},e.indexOfAll=S,e.intersection=function(e,t){if(e===t)return new Set(e);const n=new Set,[r,i]=m(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&&v(k(e),k(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.iteratorToIterable=function(e){return{[Symbol.iterator]:()=>e}},e.jaccardIndex=function(e,t){if(0===e.size&&0===t.size)return 1;let n=0;const[r,i]=m(e,t);for(const e of r)i.has(e)&&n++;return E(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=m,e.lastIndexOfFirstGroup=y,e.lines=function(e){return e.split(j)},e.mapFill=g,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=T,e.mean=C,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 _(e,t){return t?`${_(e)}${t.name in e?".":"#"}${t.name}`:e.name},e.newDeck=function(){return[{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}]},e.normaldist=q,e.not=function(e){return(...t)=>!e(...t)},e.nullish=function(e){return null===e||e===undefined},e.omit=function(e,t){const n=O(Object.keys(e),t.filter((e=>"symbol"!=typeof e)).map(String));return Object.fromEntries([...n].map((t=>[t,e[t]])))},e.overwrite=function(e,t,n){return e.splice(t,t+n.length-1,...n)},e.padEnd=function(e,t,n){e.push(...b(n,t-e.length))},e.padStart=function(e,t,n){e.unshift(...b(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.pick=function(e,t){return Object.fromEntries(t.map((t=>[t,e[t]])))},e.product=M,e.pull=function(e,t){const n=e.indexOf(t);return-1===n?[]:e.splice(n,1)},e.pullAll=function(e,t){const n=S(e,t);n.reverse();const r=[];for(const t of n)r.push(e.splice(t,1)[0]);return r},e.random=P,e.randomInt=function(e,t){if(e>t)throw new RangeError("min exceeded max");return Math.floor(P(Math.ceil(e),Math.floor(t)))},e.regExpUnion=function(...e){return RegExp(e.map((e=>`(${e.source})`)).join("|"))},e.relativeStddev=function(e,t=C(e)){return F(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=b,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.skip=function(e,t){const n=e[Symbol.iterator]();for(let e=0;e<t&&!n.next().done;e++);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 q(e,1,0)},e.stddev=F,e.sum=A,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(I)}),e)}));return[t,n]}(t),i=await Promise.race([e,r])["finally"]((()=>{clearTimeout(n)}));if(i===I)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.triangularNumber=function(e){if(e<0)throw new RangeError("Value must be greater than or equal to 0");return"bigint"==typeof e?e*(e+1n)/2n:e*(e+1)/2},e.trimEnd=function(e,t){const n=p(e,t);return-1===n?"string"==typeof e?e:[...e]:e.slice(0,n)},e.trimStart=function(e,t){const n=y(e,t);return-1===n?"string"==typeof e?e:[...e]:e.slice(n+1)},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(R(e,t))},e.variance=x},"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={}); | ||
//# sourceMappingURL=index.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.36.4" | ||
"packageVersion": "7.37.0" | ||
} | ||
] | ||
} |
{ | ||
"name": "@jonahsnider/util", | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"description": "A useful collection of optimized utility functions", | ||
@@ -49,28 +49,23 @@ "homepage": "https://util.jonah.pw/", | ||
"prettier": "@jonahsnider/prettier-config", | ||
"resolutions": { | ||
"terser": "5.19.4" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.22.15", | ||
"@babel/preset-env": "7.22.15", | ||
"@babel/core": "7.22.19", | ||
"@jonahsnider/prettier-config": "1.1.2", | ||
"@jonahsnider/xo-config": "5.3.0", | ||
"@microsoft/api-extractor": "7.36.4", | ||
"@microsoft/api-extractor": "7.37.0", | ||
"@rollup/plugin-babel": "6.0.3", | ||
"@rollup/plugin-typescript": "11.1.3", | ||
"@size-limit/preset-small-lib": "8.2.6", | ||
"@size-limit/preset-small-lib": "9.0.0", | ||
"@tsconfig/node16": "16.1.1", | ||
"@types/node": "18.17.14", | ||
"@vitest/coverage-v8": "0.34.3", | ||
"@vitest/ui": "0.34.3", | ||
"@types/node": "18.17.15", | ||
"@vitest/coverage-v8": "0.34.4", | ||
"@vitest/ui": "0.34.4", | ||
"prettier": "3.0.3", | ||
"rollup": "3.28.1", | ||
"rollup": "3.29.1", | ||
"rollup-plugin-terser": "7.0.2", | ||
"semantic-release": "21.1.1", | ||
"size-limit": "8.2.6", | ||
"terser": "5.19.4", | ||
"size-limit": "9.0.0", | ||
"tsd": "0.29.0", | ||
"typedoc": "0.25.1", | ||
"typescript": "5.2.2", | ||
"vitest": "0.34.3", | ||
"vitest": "0.34.4", | ||
"xo": "0.56.0" | ||
@@ -77,0 +72,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
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
433142
21
4469