@jonahsnider/util
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -7,3 +7,5 @@ /** | ||
* ```ts | ||
* sum(1, 1) === 2; | ||
* const array = [1, 2, 3]; | ||
* | ||
* array.reduce(sum) === 6; | ||
* ``` | ||
@@ -23,3 +25,5 @@ * | ||
* ```ts | ||
* sum(1n, 1n) === 2n; | ||
* const array = [1n, 2n, 3n]; | ||
* | ||
* array.reduce(sum) === 6n; | ||
* ``` | ||
@@ -26,0 +30,0 @@ * |
@@ -1,3 +0,18 @@ | ||
import { Comparable } from './sort'; | ||
import { Comparable, CompareFn } from './sort'; | ||
/** | ||
* Sort an array in ascending order (least to greatest), while applying a function to each element to map the value before comparing.. | ||
* | ||
* @example | ||
* ```ts | ||
* const array = [{ value: 2 }, { value: 3 }, { value: 1 }, { value: 3 }]; | ||
* | ||
* array.sort(Sort.ascending(x => x.value)); | ||
* ``` | ||
* | ||
* @param predicate - A function that maps elements from type `T` to a {@link Comparable | `Comparable`} | ||
* | ||
* @returns A compare function that returns a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise | ||
*/ | ||
export declare function ascending<T>(predicate: (element: T) => Comparable): CompareFn<T>; | ||
/** | ||
* Sort an array in ascending order (least to greatest). | ||
@@ -19,2 +34,17 @@ * | ||
/** | ||
* Sort an array in descending order (greatest to least), while applying a function to each element to map the value before comparing. | ||
* | ||
* @example | ||
* ```ts | ||
* const array = [{ value: 2 }, { value: 3 }, { value: 1 }, { value: 3 }]; | ||
* | ||
* array.sort(Sort.descending(x => x.value)); | ||
* ``` | ||
* | ||
* @param predicate - A function that maps elements from type `T` to a {@link Comparable | `Comparable`} | ||
* | ||
* @returns A compare function that returns a positive value if first argument is less than second argument, zero if they're equal and a negative value otherwise | ||
*/ | ||
export declare function descending<T>(predicate: (element: T) => Comparable): CompareFn<T>; | ||
/** | ||
* Sort an array in descending order (greatest to least). | ||
@@ -31,4 +61,4 @@ * @example | ||
* | ||
* @returns A negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise | ||
* @returns A positive value if first argument is less than second argument, zero if they're equal and a negative value otherwise | ||
*/ | ||
export declare function descending(a: Comparable, b: Comparable): number; |
@@ -1867,18 +1867,3 @@ 'use strict'; | ||
/** | ||
* Sort an array in ascending order (least to greatest). | ||
* | ||
* @example | ||
* ```ts | ||
* const array = [5, 3, 2, 4, 1]; | ||
* | ||
* array.sort(Sort.ascending); | ||
* ``` | ||
* | ||
* @param a - Element | ||
* @param b - Element | ||
* | ||
* @returns A negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise | ||
*/ | ||
function ascending(a, b) { | ||
function ascendingRaw(a, b) { | ||
// null is converted to 0 in comparisons | ||
@@ -1895,18 +1880,4 @@ if (a < b) { | ||
} | ||
/** | ||
* Sort an array in descending order (greatest to least). | ||
* @example | ||
* ```ts | ||
* const array = [5, 3, 2, 4, 1]; | ||
* | ||
* array.sort(Sort.descending); | ||
* ``` | ||
* | ||
* @param a - Element | ||
* @param b - Element | ||
* | ||
* @returns A negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise | ||
*/ | ||
function descending(a, b) { | ||
function descendingRaw(a, b) { | ||
// null is converted to 0 in comparisons | ||
@@ -1924,2 +1895,21 @@ if (a < b) { | ||
function ascending(aOrPredicate, b) { | ||
if (b === undefined && typeof aOrPredicate === 'function') { | ||
return function (a2, b2) { | ||
return ascendingRaw(aOrPredicate(a2), aOrPredicate(b2)); | ||
}; | ||
} | ||
return ascendingRaw(aOrPredicate, b); | ||
} | ||
function descending(aOrPredicate, b) { | ||
if (b === undefined && typeof aOrPredicate === 'function') { | ||
return function (a2, b2) { | ||
return descendingRaw(aOrPredicate(a2), aOrPredicate(b2)); | ||
}; | ||
} | ||
return descendingRaw(aOrPredicate, b); | ||
} | ||
var sortCompare = { | ||
@@ -1926,0 +1916,0 @@ __proto__: null, |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,void 0):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function n(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var o,a;function i(e,t){var r=void 0;if("size"in e?r="size":"length"in e&&(r="length"),!r)throw new RangeError;return e[r]<t[r]?[t,e]:[e,t]}Object.defineProperty(exports,"__esModule",{value:!0}),(o=exports.Rank||(exports.Rank={}))[o.Ace=1]="Ace",o[o.Two=2]="Two",o[o.Three=3]="Three",o[o.Four=4]="Four",o[o.Five=5]="Five",o[o.Six=6]="Six",o[o.Seven=7]="Seven",o[o.Eight=8]="Eight",o[o.Nine=9]="Nine",o[o.Ten=10]="Ten",o[o.Jack=11]="Jack",o[o.Queen=12]="Queen",o[o.King=13]="King",(a=exports.Suit||(exports.Suit={}))[a.Clubs=0]="Clubs",a[a.Diamonds=1]="Diamonds",a[a.Hearts=2]="Hearts",a[a.Spades=3]="Spades";var u,s,p=[{rank:exports.Rank.Ace,suit:exports.Suit.Clubs},{rank:exports.Rank.Two,suit:exports.Suit.Clubs},{rank:exports.Rank.Three,suit:exports.Suit.Clubs},{rank:exports.Rank.Four,suit:exports.Suit.Clubs},{rank:exports.Rank.Five,suit:exports.Suit.Clubs},{rank:exports.Rank.Six,suit:exports.Suit.Clubs},{rank:exports.Rank.Seven,suit:exports.Suit.Clubs},{rank:exports.Rank.Eight,suit:exports.Suit.Clubs},{rank:exports.Rank.Nine,suit:exports.Suit.Clubs},{rank:exports.Rank.Ten,suit:exports.Suit.Clubs},{rank:exports.Rank.Jack,suit:exports.Suit.Clubs},{rank:exports.Rank.Queen,suit:exports.Suit.Clubs},{rank:exports.Rank.King,suit:exports.Suit.Clubs},{rank:exports.Rank.Ace,suit:exports.Suit.Diamonds},{rank:exports.Rank.Two,suit:exports.Suit.Diamonds},{rank:exports.Rank.Three,suit:exports.Suit.Diamonds},{rank:exports.Rank.Four,suit:exports.Suit.Diamonds},{rank:exports.Rank.Five,suit:exports.Suit.Diamonds},{rank:exports.Rank.Six,suit:exports.Suit.Diamonds},{rank:exports.Rank.Seven,suit:exports.Suit.Diamonds},{rank:exports.Rank.Eight,suit:exports.Suit.Diamonds},{rank:exports.Rank.Nine,suit:exports.Suit.Diamonds},{rank:exports.Rank.Ten,suit:exports.Suit.Diamonds},{rank:exports.Rank.Jack,suit:exports.Suit.Diamonds},{rank:exports.Rank.Queen,suit:exports.Suit.Diamonds},{rank:exports.Rank.King,suit:exports.Suit.Diamonds},{rank:exports.Rank.Ace,suit:exports.Suit.Hearts},{rank:exports.Rank.Two,suit:exports.Suit.Hearts},{rank:exports.Rank.Three,suit:exports.Suit.Hearts},{rank:exports.Rank.Four,suit:exports.Suit.Hearts},{rank:exports.Rank.Five,suit:exports.Suit.Hearts},{rank:exports.Rank.Six,suit:exports.Suit.Hearts},{rank:exports.Rank.Seven,suit:exports.Suit.Hearts},{rank:exports.Rank.Eight,suit:exports.Suit.Hearts},{rank:exports.Rank.Nine,suit:exports.Suit.Hearts},{rank:exports.Rank.Ten,suit:exports.Suit.Hearts},{rank:exports.Rank.Jack,suit:exports.Suit.Hearts},{rank:exports.Rank.Queen,suit:exports.Suit.Hearts},{rank:exports.Rank.King,suit:exports.Suit.Hearts},{rank:exports.Rank.Ace,suit:exports.Suit.Spades},{rank:exports.Rank.Two,suit:exports.Suit.Spades},{rank:exports.Rank.Three,suit:exports.Suit.Spades},{rank:exports.Rank.Four,suit:exports.Suit.Spades},{rank:exports.Rank.Five,suit:exports.Suit.Spades},{rank:exports.Rank.Six,suit:exports.Suit.Spades},{rank:exports.Rank.Seven,suit:exports.Suit.Spades},{rank:exports.Rank.Eight,suit:exports.Suit.Spades},{rank:exports.Rank.Nine,suit:exports.Suit.Spades},{rank:exports.Rank.Ten,suit:exports.Suit.Spades},{rank:exports.Rank.Jack,suit:exports.Suit.Spades},{rank:exports.Rank.Queen,suit:exports.Suit.Spades},{rank:exports.Rank.King,suit:exports.Suit.Spades}];function l(e){for(var t,n=e[0].map((function(e){return e.length})),o=r(e);!(t=o()).done;)for(var a=t.value,i=0;i<a.length;i++){var u=a[i].length;n[i]<u&&(n[i]=u)}return n}!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"}(u||(u={})),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 c={__proto__:null,get Status(){return u},get Method(){return s}};function d(e,t){return e+t}function f(e){var t=v(e);return e.map((function(e){return Math.pow(e-t,2)})).reduce(d)/(e.length-1)}function x(e,t,r){return 1/(t*Math.sqrt(2*Math.PI))*Math.pow(Math.E,-.5*Math.pow(e-r/t,2))}function v(e){var t=e.reduce(d);return t/("bigint"==typeof t?BigInt(e.length):e.length)}function h(e,t){return Math.random()*(t-e)+e}var S=function(){function e(){}e.start=function(){var e=new this;return e.start(),e};var t,r=e.prototype;return r.start=function(){this.startTime=process.hrtime.bigint()},r.end=function(){return Number(process.hrtime.bigint()-this.startTime)/1e6},(t=[{key:"started",get:function(){return void 0!==this.startTime}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();exports.Http=c,exports.Sort={__proto__:null,ascending:function(e,t){return e<t?-1:e>t?1:0},descending:function(e,t){return e<t?1:e>t?-1:0}},exports.Stopwatch=S,exports.allDuplicates=function(e){for(var t,n=new Set,o=[],a=r(e);!(t=a()).done;){var i=t.value;n.has(i)&&o.push(i),n.add(i)}return o},exports.binarySearch=function(e,t){for(var r=0,n=e.length-1;r<=n;){var o=Math.trunc((r+n)/2),a=t(e[o]);if(a<0)r=o+1;else{if(!(a>0))return e[o];n=o-1}}},exports.capitalize=function(e){var t=e.charAt(0).toUpperCase();return""+t+e.slice(t.length)},exports.chunk=function(e,t){return e.length===t?e.map((function(e){return[e]})):Array.from({length:Math.ceil(e.length/t)},(function(r,n){return e.slice(n*t,n*t+t)}))},exports.clamp=function(e,t,r){return e<t?t:e>r?r:e},exports.difference=function(e,t){for(var n,o=new Set(e),a=r(t);!(n=a()).done;)o.delete(n.value);return o},exports.duplicates=function(e){for(var t,n=new Set,o=new Set,a=r(e);!(t=a()).done;){var i=t.value;n.has(i)&&o.add(i),n.add(i)}return o},exports.first=function(e,t){var r=e[Symbol.iterator]();if(void 0===t)return r.next().value;for(var n=[],o=0;o<t;o++){var a=r.next();if(a.done)break;n.push(a.value)}return n},exports.formatTable=function(e,t){void 0===t&&(t=" ");var r=l(e);return e.map((function(e){return e.map((function(e,t){return e.padEnd(r[t])})).join(t)})).join("\n")},exports.frequencyTable=function(e){for(var t,n=new Map,o=r(e);!(t=o()).done;){var a=t.value,i=n.get(a);n.set(a,i?i+1:1)}return n},exports.identical=function(e,t){if(e===t)return!0;if(Array.isArray(e))return e.length===t.length&&e.every((function(e,r){return e===t[r]}));if(e.size!==t.size)return!1;if(e instanceof Set){for(var n,o=r(e);!(n=o()).done;)if(!t.has(n.value))return!1}else if(e instanceof Map)for(var a,i=r(e.entries());!(a=i()).done;){var u=a.value,s=u[0],p=u[1];if(t.get(s)!==p||!t.has(s))return!1}return!0},exports.intersection=function(e,t){for(var n,o=new Set,a=i(e,t),u=a[1],s=r(a[0]);!(n=s()).done;){var p=n.value;u.has(p)&&o.add(p)}return o},exports.invert=function(e){return function(){return-e.apply(void 0,arguments)}},exports.isDisjoint=function(e,t){for(var n,o=new Set(e),a=r(t);!(n=a()).done;)if(o.has(n.value))return!1;return!0},exports.isSubset=function(e,t){for(var n,o=r(e);!(n=o()).done;)if(!t.has(n.value))return!1;return!0},exports.isSuperset=function(e,t){for(var n,o=r(t);!(n=o()).done;)if(!e.has(n.value))return!1;return!0},exports.largeToSmall=i,exports.max=function(e,t){return Math.max(e,t)},exports.maxColumnLength=l,exports.mean=v,exports.median=function(e){var t=e.length/2;return e.length%2==0?(e[t-1]+e[t])/("bigint"==typeof e[0]?2n:2):e[Math.floor(t)]},exports.min=function(e,t){return Math.min(e,t)},exports.mode=function(e){for(var t,n=new Map,o=0,a=[],i=r(e);!(t=i()).done;){var u=t.value,s=n.get(u),p=void 0===s?1:s+1;n.set(u,p),p>o?(o=p,a=[u]):p===o&&a.push(u)}return a},exports.multiReplace=function(e,t){for(var n=Object.entries(t),o="",a=0;a<e.length;)e:do{for(var i,u=r(n);!(i=u()).done;){var s=i.value,p=s[0],l=s[1];if(e.slice(a).startsWith(p)){o+=l,a+=p.length;break e}}o+=e[a++]}while(0);return o},exports.newDeck=function(){return[].concat(p)},exports.normaldist=x,exports.not=function(e){return function(){return!e.apply(void 0,arguments)}},exports.nullish=function(e){return null==e},exports.partition=function(e,t){for(var n,o=[],a=[],i=0,u=r(e);!(n=u()).done;){var s=n.value;(t(s,i++)?o:a).push(s)}return[o,a]},exports.random=h,exports.randomInt=function(e,t){return Math.floor(h(Math.ceil(e),Math.floor(t)))},exports.regExpUnion=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new RegExp(t.map((function(e){return"("+e.source+")"})).join("|"))},exports.rename=function(t,r,o){var a;return r===o?e({},t):function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(o[r]=e[r]);return o}(e({},t,((a={})[o]=t[r],a)),[r].map(n))},exports.reverse=function(e){if(Array.isArray(e))return Array.from({length:e.length},(function(t,r){return e[e.length-(r+1)]}));for(var t,n=[],o=r(e);!(t=o()).done;)n.unshift(t.value);return n},exports.same=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var o=t.map((function(e){return e[Symbol.iterator]()})),a=function(){for(var e,t=o.map((function(e){return e.next()})),n=t[0],a=n.done,i=n.value,u=r(t);!(e=u()).done;){var s=e.value;if(s.done)return{v:t.every((function(e){return e.done===a}))};if(s.value!==i)return{v:!1}}};;){var i=a();if("object"==typeof i)return i.v}},exports.sample=function(e){return e[Math.floor(Math.random()*e.length)]},exports.shuffle=function(e,t){void 0===t&&(t=!0);for(var r=t?e:[].concat(e),n=r.length-1;n>0;n--){var o=Math.floor(Math.random()*(n+1)),a=[r[o],r[n]];r[n]=a[0],r[o]=a[1]}if(!t)return r},exports.sortObject=function(e,t){return Object.entries(e).sort((function(e,r){return t(e[1],r[1])}))},exports.standardNormaldist=function(e){return x(e,1,0)},exports.stddev=function(e){return Math.sqrt(f(e))},exports.sum=d,exports.symmetricDifference=function(e,t){for(var n,o=new Set(e),a=r(t);!(n=a()).done;){var i=n.value;o.has(i)?o.delete(i):o.add(i)}return o},exports.toDigits=function(e,t){var r=Math.pow(10,t);return Math.round(e*r*(1+Number.EPSILON))/r},exports.truncate=function(e,t,r){return void 0===r&&(r=""),e.length>t?""+e.slice(0,t)+r:e},exports.uncapitalize=function(e){var t=e.charAt(0).toLowerCase();return""+t+e.slice(t.length)},exports.union=function(e,t){for(var n,o=new Set(e),a=r(t);!(n=a()).done;)o.add(n.value);return o},exports.variance=f; | ||
"use strict";function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function r(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,r){if(t){if("string"==typeof t)return e(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,void 0):void 0}}(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function n(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var o,a;function i(t,e){var r=void 0;if("size"in t?r="size":"length"in t&&(r="length"),!r)throw new RangeError;return t[r]<e[r]?[e,t]:[t,e]}Object.defineProperty(exports,"__esModule",{value:!0}),(o=exports.Rank||(exports.Rank={}))[o.Ace=1]="Ace",o[o.Two=2]="Two",o[o.Three=3]="Three",o[o.Four=4]="Four",o[o.Five=5]="Five",o[o.Six=6]="Six",o[o.Seven=7]="Seven",o[o.Eight=8]="Eight",o[o.Nine=9]="Nine",o[o.Ten=10]="Ten",o[o.Jack=11]="Jack",o[o.Queen=12]="Queen",o[o.King=13]="King",(a=exports.Suit||(exports.Suit={}))[a.Clubs=0]="Clubs",a[a.Diamonds=1]="Diamonds",a[a.Hearts=2]="Hearts",a[a.Spades=3]="Spades";var u,s,p=[{rank:exports.Rank.Ace,suit:exports.Suit.Clubs},{rank:exports.Rank.Two,suit:exports.Suit.Clubs},{rank:exports.Rank.Three,suit:exports.Suit.Clubs},{rank:exports.Rank.Four,suit:exports.Suit.Clubs},{rank:exports.Rank.Five,suit:exports.Suit.Clubs},{rank:exports.Rank.Six,suit:exports.Suit.Clubs},{rank:exports.Rank.Seven,suit:exports.Suit.Clubs},{rank:exports.Rank.Eight,suit:exports.Suit.Clubs},{rank:exports.Rank.Nine,suit:exports.Suit.Clubs},{rank:exports.Rank.Ten,suit:exports.Suit.Clubs},{rank:exports.Rank.Jack,suit:exports.Suit.Clubs},{rank:exports.Rank.Queen,suit:exports.Suit.Clubs},{rank:exports.Rank.King,suit:exports.Suit.Clubs},{rank:exports.Rank.Ace,suit:exports.Suit.Diamonds},{rank:exports.Rank.Two,suit:exports.Suit.Diamonds},{rank:exports.Rank.Three,suit:exports.Suit.Diamonds},{rank:exports.Rank.Four,suit:exports.Suit.Diamonds},{rank:exports.Rank.Five,suit:exports.Suit.Diamonds},{rank:exports.Rank.Six,suit:exports.Suit.Diamonds},{rank:exports.Rank.Seven,suit:exports.Suit.Diamonds},{rank:exports.Rank.Eight,suit:exports.Suit.Diamonds},{rank:exports.Rank.Nine,suit:exports.Suit.Diamonds},{rank:exports.Rank.Ten,suit:exports.Suit.Diamonds},{rank:exports.Rank.Jack,suit:exports.Suit.Diamonds},{rank:exports.Rank.Queen,suit:exports.Suit.Diamonds},{rank:exports.Rank.King,suit:exports.Suit.Diamonds},{rank:exports.Rank.Ace,suit:exports.Suit.Hearts},{rank:exports.Rank.Two,suit:exports.Suit.Hearts},{rank:exports.Rank.Three,suit:exports.Suit.Hearts},{rank:exports.Rank.Four,suit:exports.Suit.Hearts},{rank:exports.Rank.Five,suit:exports.Suit.Hearts},{rank:exports.Rank.Six,suit:exports.Suit.Hearts},{rank:exports.Rank.Seven,suit:exports.Suit.Hearts},{rank:exports.Rank.Eight,suit:exports.Suit.Hearts},{rank:exports.Rank.Nine,suit:exports.Suit.Hearts},{rank:exports.Rank.Ten,suit:exports.Suit.Hearts},{rank:exports.Rank.Jack,suit:exports.Suit.Hearts},{rank:exports.Rank.Queen,suit:exports.Suit.Hearts},{rank:exports.Rank.King,suit:exports.Suit.Hearts},{rank:exports.Rank.Ace,suit:exports.Suit.Spades},{rank:exports.Rank.Two,suit:exports.Suit.Spades},{rank:exports.Rank.Three,suit:exports.Suit.Spades},{rank:exports.Rank.Four,suit:exports.Suit.Spades},{rank:exports.Rank.Five,suit:exports.Suit.Spades},{rank:exports.Rank.Six,suit:exports.Suit.Spades},{rank:exports.Rank.Seven,suit:exports.Suit.Spades},{rank:exports.Rank.Eight,suit:exports.Suit.Spades},{rank:exports.Rank.Nine,suit:exports.Suit.Spades},{rank:exports.Rank.Ten,suit:exports.Suit.Spades},{rank:exports.Rank.Jack,suit:exports.Suit.Spades},{rank:exports.Rank.Queen,suit:exports.Suit.Spades},{rank:exports.Rank.King,suit:exports.Suit.Spades}];function c(t){for(var e,n=t[0].map((function(t){return t.length})),o=r(t);!(e=o()).done;)for(var a=e.value,i=0;i<a.length;i++){var u=a[i].length;n[i]<u&&(n[i]=u)}return n}!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"}(u||(u={})),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 l={__proto__:null,get Status(){return u},get Method(){return s}};function d(t,e){return t+e}function f(t){var e=v(t);return t.map((function(t){return Math.pow(t-e,2)})).reduce(d)/(t.length-1)}function x(t,e,r){return 1/(e*Math.sqrt(2*Math.PI))*Math.pow(Math.E,-.5*Math.pow(t-r/e,2))}function v(t){var e=t.reduce(d);return e/("bigint"==typeof e?BigInt(t.length):t.length)}function h(t,e){return Math.random()*(e-t)+t}function S(t,e){return t<e?-1:t>e?1:0}function k(t,e){return t<e?1:t>e?-1:0}var m={__proto__:null,ascending:function(t,e){return void 0===e&&"function"==typeof t?function(e,r){return S(t(e),t(r))}:S(t,e)},descending:function(t,e){return void 0===e&&"function"==typeof t?function(e,r){return k(t(e),t(r))}:k(t,e)}},g=function(){function t(){}t.start=function(){var t=new this;return t.start(),t};var e,r=t.prototype;return r.start=function(){this.startTime=process.hrtime.bigint()},r.end=function(){return Number(process.hrtime.bigint()-this.startTime)/1e6},(e=[{key:"started",get:function(){return void 0!==this.startTime}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}();exports.Http=l,exports.Sort=m,exports.Stopwatch=g,exports.allDuplicates=function(t){for(var e,n=new Set,o=[],a=r(t);!(e=a()).done;){var i=e.value;n.has(i)&&o.push(i),n.add(i)}return o},exports.binarySearch=function(t,e){for(var r=0,n=t.length-1;r<=n;){var o=Math.trunc((r+n)/2),a=e(t[o]);if(a<0)r=o+1;else{if(!(a>0))return t[o];n=o-1}}},exports.capitalize=function(t){var e=t.charAt(0).toUpperCase();return""+e+t.slice(e.length)},exports.chunk=function(t,e){return t.length===e?t.map((function(t){return[t]})):Array.from({length:Math.ceil(t.length/e)},(function(r,n){return t.slice(n*e,n*e+e)}))},exports.clamp=function(t,e,r){return t<e?e:t>r?r:t},exports.difference=function(t,e){for(var n,o=new Set(t),a=r(e);!(n=a()).done;)o.delete(n.value);return o},exports.duplicates=function(t){for(var e,n=new Set,o=new Set,a=r(t);!(e=a()).done;){var i=e.value;n.has(i)&&o.add(i),n.add(i)}return o},exports.first=function(t,e){var r=t[Symbol.iterator]();if(void 0===e)return r.next().value;for(var n=[],o=0;o<e;o++){var a=r.next();if(a.done)break;n.push(a.value)}return n},exports.formatTable=function(t,e){void 0===e&&(e=" ");var r=c(t);return t.map((function(t){return t.map((function(t,e){return t.padEnd(r[e])})).join(e)})).join("\n")},exports.frequencyTable=function(t){for(var e,n=new Map,o=r(t);!(e=o()).done;){var a=e.value,i=n.get(a);n.set(a,i?i+1:1)}return n},exports.identical=function(t,e){if(t===e)return!0;if(Array.isArray(t))return t.length===e.length&&t.every((function(t,r){return t===e[r]}));if(t.size!==e.size)return!1;if(t instanceof Set){for(var n,o=r(t);!(n=o()).done;)if(!e.has(n.value))return!1}else if(t instanceof Map)for(var a,i=r(t.entries());!(a=i()).done;){var u=a.value,s=u[0],p=u[1];if(e.get(s)!==p||!e.has(s))return!1}return!0},exports.intersection=function(t,e){for(var n,o=new Set,a=i(t,e),u=a[1],s=r(a[0]);!(n=s()).done;){var p=n.value;u.has(p)&&o.add(p)}return o},exports.invert=function(t){return function(){return-t.apply(void 0,arguments)}},exports.isDisjoint=function(t,e){for(var n,o=new Set(t),a=r(e);!(n=a()).done;)if(o.has(n.value))return!1;return!0},exports.isSubset=function(t,e){for(var n,o=r(t);!(n=o()).done;)if(!e.has(n.value))return!1;return!0},exports.isSuperset=function(t,e){for(var n,o=r(e);!(n=o()).done;)if(!t.has(n.value))return!1;return!0},exports.largeToSmall=i,exports.max=function(t,e){return Math.max(t,e)},exports.maxColumnLength=c,exports.mean=v,exports.median=function(t){var e=t.length/2;return t.length%2==0?(t[e-1]+t[e])/("bigint"==typeof t[0]?2n:2):t[Math.floor(e)]},exports.min=function(t,e){return Math.min(t,e)},exports.mode=function(t){for(var e,n=new Map,o=0,a=[],i=r(t);!(e=i()).done;){var u=e.value,s=n.get(u),p=void 0===s?1:s+1;n.set(u,p),p>o?(o=p,a=[u]):p===o&&a.push(u)}return a},exports.multiReplace=function(t,e){for(var n=Object.entries(e),o="",a=0;a<t.length;)t:do{for(var i,u=r(n);!(i=u()).done;){var s=i.value,p=s[0],c=s[1];if(t.slice(a).startsWith(p)){o+=c,a+=p.length;break t}}o+=t[a++]}while(0);return o},exports.newDeck=function(){return[].concat(p)},exports.normaldist=x,exports.not=function(t){return function(){return!t.apply(void 0,arguments)}},exports.nullish=function(t){return null==t},exports.partition=function(t,e){for(var n,o=[],a=[],i=0,u=r(t);!(n=u()).done;){var s=n.value;(e(s,i++)?o:a).push(s)}return[o,a]},exports.random=h,exports.randomInt=function(t,e){return Math.floor(h(Math.ceil(t),Math.floor(e)))},exports.regExpUnion=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return new RegExp(e.map((function(t){return"("+t.source+")"})).join("|"))},exports.rename=function(e,r,o){var a;return r===o?t({},e):function(t,e){if(null==t)return{};var r,n,o={},a=Object.keys(t);for(n=0;n<a.length;n++)e.indexOf(r=a[n])>=0||(o[r]=t[r]);return o}(t({},e,((a={})[o]=e[r],a)),[r].map(n))},exports.reverse=function(t){if(Array.isArray(t))return Array.from({length:t.length},(function(e,r){return t[t.length-(r+1)]}));for(var e,n=[],o=r(t);!(e=o()).done;)n.unshift(e.value);return n},exports.same=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(var o=e.map((function(t){return t[Symbol.iterator]()})),a=function(){for(var t,e=o.map((function(t){return t.next()})),n=e[0],a=n.done,i=n.value,u=r(e);!(t=u()).done;){var s=t.value;if(s.done)return{v:e.every((function(t){return t.done===a}))};if(s.value!==i)return{v:!1}}};;){var i=a();if("object"==typeof i)return i.v}},exports.sample=function(t){return t[Math.floor(Math.random()*t.length)]},exports.shuffle=function(t,e){void 0===e&&(e=!0);for(var r=e?t:[].concat(t),n=r.length-1;n>0;n--){var o=Math.floor(Math.random()*(n+1)),a=[r[o],r[n]];r[n]=a[0],r[o]=a[1]}if(!e)return r},exports.sortObject=function(t,e){return Object.entries(t).sort((function(t,r){return e(t[1],r[1])}))},exports.standardNormaldist=function(t){return x(t,1,0)},exports.stddev=function(t){return Math.sqrt(f(t))},exports.sum=d,exports.symmetricDifference=function(t,e){for(var n,o=new Set(t),a=r(e);!(n=a()).done;){var i=n.value;o.has(i)?o.delete(i):o.add(i)}return o},exports.toDigits=function(t,e){var r=Math.pow(10,e);return Math.round(t*r*(1+Number.EPSILON))/r},exports.truncate=function(t,e,r){return void 0===r&&(r=""),t.length>e?""+t.slice(0,e)+r:t},exports.uncapitalize=function(t){var e=t.charAt(0).toLowerCase();return""+e+t.slice(e.length)},exports.union=function(t,e){for(var n,o=new Set(t),a=r(e);!(n=a()).done;)o.add(n.value);return o},exports.variance=f; | ||
//# sourceMappingURL=util.cjs.production.min.js.map |
@@ -1869,18 +1869,3 @@ (function (global, factory) { | ||
/** | ||
* Sort an array in ascending order (least to greatest). | ||
* | ||
* @example | ||
* ```ts | ||
* const array = [5, 3, 2, 4, 1]; | ||
* | ||
* array.sort(Sort.ascending); | ||
* ``` | ||
* | ||
* @param a - Element | ||
* @param b - Element | ||
* | ||
* @returns A negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise | ||
*/ | ||
function ascending(a, b) { | ||
function ascendingRaw(a, b) { | ||
// null is converted to 0 in comparisons | ||
@@ -1897,18 +1882,4 @@ if (a < b) { | ||
} | ||
/** | ||
* Sort an array in descending order (greatest to least). | ||
* @example | ||
* ```ts | ||
* const array = [5, 3, 2, 4, 1]; | ||
* | ||
* array.sort(Sort.descending); | ||
* ``` | ||
* | ||
* @param a - Element | ||
* @param b - Element | ||
* | ||
* @returns A negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise | ||
*/ | ||
function descending(a, b) { | ||
function descendingRaw(a, b) { | ||
// null is converted to 0 in comparisons | ||
@@ -1926,2 +1897,21 @@ if (a < b) { | ||
function ascending(aOrPredicate, b) { | ||
if (b === undefined && typeof aOrPredicate === 'function') { | ||
return function (a2, b2) { | ||
return ascendingRaw(aOrPredicate(a2), aOrPredicate(b2)); | ||
}; | ||
} | ||
return ascendingRaw(aOrPredicate, b); | ||
} | ||
function descending(aOrPredicate, b) { | ||
if (b === undefined && typeof aOrPredicate === 'function') { | ||
return function (a2, b2) { | ||
return descendingRaw(aOrPredicate(a2), aOrPredicate(b2)); | ||
}; | ||
} | ||
return descendingRaw(aOrPredicate, b); | ||
} | ||
var sortCompare = { | ||
@@ -1928,0 +1918,0 @@ __proto__: null, |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["@jonahsnider/util"]={})}(this,(function(e){"use strict";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return n(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var i,o;function u(e,t){var n=void 0;if("size"in e?n="size":"length"in e&&(n="length"),!n)throw new RangeError;return e[n]<t[n]?[t,e]:[e,t]}(i=e.Rank||(e.Rank={}))[i.Ace=1]="Ace",i[i.Two=2]="Two",i[i.Three=3]="Three",i[i.Four=4]="Four",i[i.Five=5]="Five",i[i.Six=6]="Six",i[i.Seven=7]="Seven",i[i.Eight=8]="Eight",i[i.Nine=9]="Nine",i[i.Ten=10]="Ten",i[i.Jack=11]="Jack",i[i.Queen=12]="Queen",i[i.King=13]="King",(o=e.Suit||(e.Suit={}))[o.Clubs=0]="Clubs",o[o.Diamonds=1]="Diamonds",o[o.Hearts=2]="Hearts",o[o.Spades=3]="Spades";var s,l,c=[{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}];function d(e){for(var t,n=e[0].map((function(e){return e.length})),a=r(e);!(t=a()).done;)for(var i=t.value,o=0;o<i.length;o++){var u=i[o].length;n[o]<u&&(n[o]=u)}return n}!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"}(s||(s={})),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"}(l||(l={}));var f={__proto__:null,get Status(){return s},get Method(){return l}};function v(e,t){return e+t}function h(e){var t=S(e);return e.map((function(e){return Math.pow(e-t,2)})).reduce(v)/(e.length-1)}function p(e,t,n){return 1/(t*Math.sqrt(2*Math.PI))*Math.pow(Math.E,-.5*Math.pow(e-n/t,2))}function S(e){var t=e.reduce(v);return t/("bigint"==typeof t?BigInt(e.length):e.length)}function k(e,t){return Math.random()*(t-e)+e}var m=function(){function e(){}e.start=function(){var e=new this;return e.start(),e};var t,n=e.prototype;return n.start=function(){this.startTime=process.hrtime.bigint()},n.end=function(){return Number(process.hrtime.bigint()-this.startTime)/1e6},(t=[{key:"started",get:function(){return void 0!==this.startTime}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();e.Http=f,e.Sort={__proto__:null,ascending:function(e,t){return e<t?-1:e>t?1:0},descending:function(e,t){return e<t?1:e>t?-1:0}},e.Stopwatch=m,e.allDuplicates=function(e){for(var t,n=new Set,a=[],i=r(e);!(t=i()).done;){var o=t.value;n.has(o)&&a.push(o),n.add(o)}return a},e.binarySearch=function(e,t){for(var n=0,r=e.length-1;n<=r;){var a=Math.trunc((n+r)/2),i=t(e[a]);if(i<0)n=a+1;else{if(!(i>0))return e[a];r=a-1}}},e.capitalize=function(e){var t=e.charAt(0).toUpperCase();return""+t+e.slice(t.length)},e.chunk=function(e,t){return e.length===t?e.map((function(e){return[e]})):Array.from({length:Math.ceil(e.length/t)},(function(n,r){return e.slice(r*t,r*t+t)}))},e.clamp=function(e,t,n){return e<t?t:e>n?n:e},e.difference=function(e,t){for(var n,a=new Set(e),i=r(t);!(n=i()).done;)a.delete(n.value);return a},e.duplicates=function(e){for(var t,n=new Set,a=new Set,i=r(e);!(t=i()).done;){var o=t.value;n.has(o)&&a.add(o),n.add(o)}return a},e.first=function(e,t){var n=e[Symbol.iterator]();if(void 0===t)return n.next().value;for(var r=[],a=0;a<t;a++){var i=n.next();if(i.done)break;r.push(i.value)}return r},e.formatTable=function(e,t){void 0===t&&(t=" ");var n=d(e);return e.map((function(e){return e.map((function(e,t){return e.padEnd(n[t])})).join(t)})).join("\n")},e.frequencyTable=function(e){for(var t,n=new Map,a=r(e);!(t=a()).done;){var i=t.value,o=n.get(i);n.set(i,o?o+1:1)}return n},e.identical=function(e,t){if(e===t)return!0;if(Array.isArray(e))return e.length===t.length&&e.every((function(e,n){return e===t[n]}));if(e.size!==t.size)return!1;if(e instanceof Set){for(var n,a=r(e);!(n=a()).done;)if(!t.has(n.value))return!1}else if(e instanceof Map)for(var i,o=r(e.entries());!(i=o()).done;){var u=i.value,s=u[0],l=u[1];if(t.get(s)!==l||!t.has(s))return!1}return!0},e.intersection=function(e,t){for(var n,a=new Set,i=u(e,t),o=i[1],s=r(i[0]);!(n=s()).done;){var l=n.value;o.has(l)&&a.add(l)}return a},e.invert=function(e){return function(){return-e.apply(void 0,arguments)}},e.isDisjoint=function(e,t){for(var n,a=new Set(e),i=r(t);!(n=i()).done;)if(a.has(n.value))return!1;return!0},e.isSubset=function(e,t){for(var n,a=r(e);!(n=a()).done;)if(!t.has(n.value))return!1;return!0},e.isSuperset=function(e,t){for(var n,a=r(t);!(n=a()).done;)if(!e.has(n.value))return!1;return!0},e.largeToSmall=u,e.max=function(e,t){return Math.max(e,t)},e.maxColumnLength=d,e.mean=S,e.median=function(e){var t=e.length/2;return e.length%2==0?(e[t-1]+e[t])/("bigint"==typeof e[0]?2n:2):e[Math.floor(t)]},e.min=function(e,t){return Math.min(e,t)},e.mode=function(e){for(var t,n=new Map,a=0,i=[],o=r(e);!(t=o()).done;){var u=t.value,s=n.get(u),l=void 0===s?1:s+1;n.set(u,l),l>a?(a=l,i=[u]):l===a&&i.push(u)}return i},e.multiReplace=function(e,t){for(var n=Object.entries(t),a="",i=0;i<e.length;)e:do{for(var o,u=r(n);!(o=u()).done;){var s=o.value,l=s[0],c=s[1];if(e.slice(i).startsWith(l)){a+=c,i+=l.length;break e}}a+=e[i++]}while(0);return a},e.newDeck=function(){return[].concat(c)},e.normaldist=p,e.not=function(e){return function(){return!e.apply(void 0,arguments)}},e.nullish=function(e){return null==e},e.partition=function(e,t){for(var n,a=[],i=[],o=0,u=r(e);!(n=u()).done;){var s=n.value;(t(s,o++)?a:i).push(s)}return[a,i]},e.random=k,e.randomInt=function(e,t){return Math.floor(k(Math.ceil(e),Math.floor(t)))},e.regExpUnion=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new RegExp(t.map((function(e){return"("+e.source+")"})).join("|"))},e.rename=function(e,n,r){var i;return n===r?t({},e):function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(a[n]=e[n]);return a}(t({},e,((i={})[r]=e[n],i)),[n].map(a))},e.reverse=function(e){if(Array.isArray(e))return Array.from({length:e.length},(function(t,n){return e[e.length-(n+1)]}));for(var t,n=[],a=r(e);!(t=a()).done;)n.unshift(t.value);return n},e.same=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var a=t.map((function(e){return e[Symbol.iterator]()})),i=function(){for(var e,t=a.map((function(e){return e.next()})),n=t[0],i=n.done,o=n.value,u=r(t);!(e=u()).done;){var s=e.value;if(s.done)return{v:t.every((function(e){return e.done===i}))};if(s.value!==o)return{v:!1}}};;){var o=i();if("object"==typeof o)return o.v}},e.sample=function(e){return e[Math.floor(Math.random()*e.length)]},e.shuffle=function(e,t){void 0===t&&(t=!0);for(var n=t?e:[].concat(e),r=n.length-1;r>0;r--){var a=Math.floor(Math.random()*(r+1)),i=[n[a],n[r]];n[r]=i[0],n[a]=i[1]}if(!t)return n},e.sortObject=function(e,t){return Object.entries(e).sort((function(e,n){return t(e[1],n[1])}))},e.standardNormaldist=function(e){return p(e,1,0)},e.stddev=function(e){return Math.sqrt(h(e))},e.sum=v,e.symmetricDifference=function(e,t){for(var n,a=new Set(e),i=r(t);!(n=i()).done;){var o=n.value;a.has(o)?a.delete(o):a.add(o)}return a},e.toDigits=function(e,t){var n=Math.pow(10,t);return Math.round(e*n*(1+Number.EPSILON))/n},e.truncate=function(e,t,n){return void 0===n&&(n=""),e.length>t?""+e.slice(0,t)+n:e},e.uncapitalize=function(e){var t=e.charAt(0).toLowerCase();return""+t+e.slice(t.length)},e.union=function(e,t){for(var n,a=new Set(e),i=r(t);!(n=i()).done;)a.add(n.value);return a},e.variance=h,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self)["@jonahsnider/util"]={})}(this,(function(e){"use strict";function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function t(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function r(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return t(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}function i(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof n?n:String(n)}var a,o;function u(e,n){var t=void 0;if("size"in e?t="size":"length"in e&&(t="length"),!t)throw new RangeError;return e[t]<n[t]?[n,e]:[e,n]}(a=e.Rank||(e.Rank={}))[a.Ace=1]="Ace",a[a.Two=2]="Two",a[a.Three=3]="Three",a[a.Four=4]="Four",a[a.Five=5]="Five",a[a.Six=6]="Six",a[a.Seven=7]="Seven",a[a.Eight=8]="Eight",a[a.Nine=9]="Nine",a[a.Ten=10]="Ten",a[a.Jack=11]="Jack",a[a.Queen=12]="Queen",a[a.King=13]="King",(o=e.Suit||(e.Suit={}))[o.Clubs=0]="Clubs",o[o.Diamonds=1]="Diamonds",o[o.Hearts=2]="Hearts",o[o.Spades=3]="Spades";var s,c,l=[{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}];function f(e){for(var n,t=e[0].map((function(e){return e.length})),i=r(e);!(n=i()).done;)for(var a=n.value,o=0;o<a.length;o++){var u=a[o].length;t[o]<u&&(t[o]=u)}return t}!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"}(s||(s={})),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"}(c||(c={}));var d={__proto__:null,get Status(){return s},get Method(){return c}};function v(e,n){return e+n}function h(e){var n=S(e);return e.map((function(e){return Math.pow(e-n,2)})).reduce(v)/(e.length-1)}function p(e,n,t){return 1/(n*Math.sqrt(2*Math.PI))*Math.pow(Math.E,-.5*Math.pow(e-t/n,2))}function S(e){var n=e.reduce(v);return n/("bigint"==typeof n?BigInt(e.length):e.length)}function k(e,n){return Math.random()*(n-e)+e}function m(e,n){return e<n?-1:e>n?1:0}function g(e,n){return e<n?1:e>n?-1:0}var R={__proto__:null,ascending:function(e,n){return void 0===n&&"function"==typeof e?function(n,t){return m(e(n),e(t))}:m(e,n)},descending:function(e,n){return void 0===n&&"function"==typeof e?function(n,t){return g(e(n),e(t))}:g(e,n)}},y=function(){function e(){}e.start=function(){var e=new this;return e.start(),e};var n,t=e.prototype;return t.start=function(){this.startTime=process.hrtime.bigint()},t.end=function(){return Number(process.hrtime.bigint()-this.startTime)/1e6},(n=[{key:"started",get:function(){return void 0!==this.startTime}}])&&function(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,n),e}();e.Http=d,e.Sort=R,e.Stopwatch=y,e.allDuplicates=function(e){for(var n,t=new Set,i=[],a=r(e);!(n=a()).done;){var o=n.value;t.has(o)&&i.push(o),t.add(o)}return i},e.binarySearch=function(e,n){for(var t=0,r=e.length-1;t<=r;){var i=Math.trunc((t+r)/2),a=n(e[i]);if(a<0)t=i+1;else{if(!(a>0))return e[i];r=i-1}}},e.capitalize=function(e){var n=e.charAt(0).toUpperCase();return""+n+e.slice(n.length)},e.chunk=function(e,n){return e.length===n?e.map((function(e){return[e]})):Array.from({length:Math.ceil(e.length/n)},(function(t,r){return e.slice(r*n,r*n+n)}))},e.clamp=function(e,n,t){return e<n?n:e>t?t:e},e.difference=function(e,n){for(var t,i=new Set(e),a=r(n);!(t=a()).done;)i.delete(t.value);return i},e.duplicates=function(e){for(var n,t=new Set,i=new Set,a=r(e);!(n=a()).done;){var o=n.value;t.has(o)&&i.add(o),t.add(o)}return i},e.first=function(e,n){var t=e[Symbol.iterator]();if(void 0===n)return t.next().value;for(var r=[],i=0;i<n;i++){var a=t.next();if(a.done)break;r.push(a.value)}return r},e.formatTable=function(e,n){void 0===n&&(n=" ");var t=f(e);return e.map((function(e){return e.map((function(e,n){return e.padEnd(t[n])})).join(n)})).join("\n")},e.frequencyTable=function(e){for(var n,t=new Map,i=r(e);!(n=i()).done;){var a=n.value,o=t.get(a);t.set(a,o?o+1:1)}return t},e.identical=function(e,n){if(e===n)return!0;if(Array.isArray(e))return e.length===n.length&&e.every((function(e,t){return e===n[t]}));if(e.size!==n.size)return!1;if(e instanceof Set){for(var t,i=r(e);!(t=i()).done;)if(!n.has(t.value))return!1}else if(e instanceof Map)for(var a,o=r(e.entries());!(a=o()).done;){var u=a.value,s=u[0],c=u[1];if(n.get(s)!==c||!n.has(s))return!1}return!0},e.intersection=function(e,n){for(var t,i=new Set,a=u(e,n),o=a[1],s=r(a[0]);!(t=s()).done;){var c=t.value;o.has(c)&&i.add(c)}return i},e.invert=function(e){return function(){return-e.apply(void 0,arguments)}},e.isDisjoint=function(e,n){for(var t,i=new Set(e),a=r(n);!(t=a()).done;)if(i.has(t.value))return!1;return!0},e.isSubset=function(e,n){for(var t,i=r(e);!(t=i()).done;)if(!n.has(t.value))return!1;return!0},e.isSuperset=function(e,n){for(var t,i=r(n);!(t=i()).done;)if(!e.has(t.value))return!1;return!0},e.largeToSmall=u,e.max=function(e,n){return Math.max(e,n)},e.maxColumnLength=f,e.mean=S,e.median=function(e){var n=e.length/2;return e.length%2==0?(e[n-1]+e[n])/("bigint"==typeof e[0]?2n:2):e[Math.floor(n)]},e.min=function(e,n){return Math.min(e,n)},e.mode=function(e){for(var n,t=new Map,i=0,a=[],o=r(e);!(n=o()).done;){var u=n.value,s=t.get(u),c=void 0===s?1:s+1;t.set(u,c),c>i?(i=c,a=[u]):c===i&&a.push(u)}return a},e.multiReplace=function(e,n){for(var t=Object.entries(n),i="",a=0;a<e.length;)e:do{for(var o,u=r(t);!(o=u()).done;){var s=o.value,c=s[0],l=s[1];if(e.slice(a).startsWith(c)){i+=l,a+=c.length;break e}}i+=e[a++]}while(0);return i},e.newDeck=function(){return[].concat(l)},e.normaldist=p,e.not=function(e){return function(){return!e.apply(void 0,arguments)}},e.nullish=function(e){return null==e},e.partition=function(e,n){for(var t,i=[],a=[],o=0,u=r(e);!(t=u()).done;){var s=t.value;(n(s,o++)?i:a).push(s)}return[i,a]},e.random=k,e.randomInt=function(e,n){return Math.floor(k(Math.ceil(e),Math.floor(n)))},e.regExpUnion=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return new RegExp(n.map((function(e){return"("+e.source+")"})).join("|"))},e.rename=function(e,t,r){var a;return t===r?n({},e):function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n.indexOf(t=a[r])>=0||(i[t]=e[t]);return i}(n({},e,((a={})[r]=e[t],a)),[t].map(i))},e.reverse=function(e){if(Array.isArray(e))return Array.from({length:e.length},(function(n,t){return e[e.length-(t+1)]}));for(var n,t=[],i=r(e);!(n=i()).done;)t.unshift(n.value);return t},e.same=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];for(var i=n.map((function(e){return e[Symbol.iterator]()})),a=function(){for(var e,n=i.map((function(e){return e.next()})),t=n[0],a=t.done,o=t.value,u=r(n);!(e=u()).done;){var s=e.value;if(s.done)return{v:n.every((function(e){return e.done===a}))};if(s.value!==o)return{v:!1}}};;){var o=a();if("object"==typeof o)return o.v}},e.sample=function(e){return e[Math.floor(Math.random()*e.length)]},e.shuffle=function(e,n){void 0===n&&(n=!0);for(var t=n?e:[].concat(e),r=t.length-1;r>0;r--){var i=Math.floor(Math.random()*(r+1)),a=[t[i],t[r]];t[r]=a[0],t[i]=a[1]}if(!n)return t},e.sortObject=function(e,n){return Object.entries(e).sort((function(e,t){return n(e[1],t[1])}))},e.standardNormaldist=function(e){return p(e,1,0)},e.stddev=function(e){return Math.sqrt(h(e))},e.sum=v,e.symmetricDifference=function(e,n){for(var t,i=new Set(e),a=r(n);!(t=a()).done;){var o=t.value;i.has(o)?i.delete(o):i.add(o)}return i},e.toDigits=function(e,n){var t=Math.pow(10,n);return Math.round(e*t*(1+Number.EPSILON))/t},e.truncate=function(e,n,t){return void 0===t&&(t=""),e.length>n?""+e.slice(0,n)+t:e},e.uncapitalize=function(e){var n=e.charAt(0).toLowerCase();return""+n+e.slice(n.length)},e.union=function(e,n){for(var t,i=new Set(e),a=r(n);!(t=a()).done;)i.add(t.value);return i},e.variance=h,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=util.umd.production.min.js.map |
@@ -10,4 +10,4 @@ { | ||
"@size-limit/preset-small-lib": "4.12.0", | ||
"@typescript-eslint/eslint-plugin": "4.27.0", | ||
"@typescript-eslint/parser": "4.27.0", | ||
"@typescript-eslint/eslint-plugin": "4.28.0", | ||
"@typescript-eslint/parser": "4.28.0", | ||
"eslint-plugin-prettier": "3.4.0", | ||
@@ -22,3 +22,3 @@ "eslint-plugin-tsdoc": "0.2.14", | ||
"tslib": "2.3.0", | ||
"typedoc": "0.20.36", | ||
"typedoc": "0.21.0", | ||
"typescript": "4.2.4" | ||
@@ -74,3 +74,3 @@ }, | ||
"typings": "dist/index.d.ts", | ||
"version": "4.0.0" | ||
"version": "4.1.0" | ||
} |
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
604256
7010