You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP →

@danoaky/js-utils

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danoaky/js-utils - npm Package Compare versions

Comparing version

to
0.28.1

export declare function assert(value: unknown, message?: string | Error): asserts value;
/**
* @deprecated Use `assert.throws` from node assert package instead or somewhere else.
*/
export declare const throws: (block: () => unknown, message?: string | Error) => void;

@@ -8,3 +11,5 @@ /**

export declare const expectType: <T>(value: T) => T;
/** Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
/**
* @deprecated Use `assert.deepStrictEqual` from node assert package instead or somewhere else.
* @description Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
export declare const equal: <T>(actual: T, expected: T, message?: string | Error) => boolean;

@@ -6,4 +6,4 @@ import {

throws
} from "./chunk-SPTQBQAG.js";
import "./chunk-SFBOBPM6.js";
} from "./chunk-JPOT7FZO.js";
import "./chunk-MT7OXZSO.js";
import "./chunk-3E2OVB6I.js";

@@ -10,0 +10,0 @@ import "./chunk-6PUHUOEZ.js";

@@ -30,3 +30,3 @@ import {

tryResult
} from "./chunk-SFBOBPM6.js";
} from "./chunk-MT7OXZSO.js";
import "./chunk-3E2OVB6I.js";

@@ -33,0 +33,0 @@ import "./chunk-6PUHUOEZ.js";

import {
Vector2,
vector2
} from "./chunk-GJORIYU5.js";
import {
Dayjs
} from "./chunk-6SHJTHML.js";
import {
BinarySearch
} from "./chunk-4NCPK65V.js";
import {
DEGREES_MULT,
RADIANS_MULT,
clamp,
isBetween,
lerp,
manhattanDistance,
randFloat,
randInteger,
roundTo,
roundToNearest,
safeParseFloat,
safeParseInt,
toDegrees,
toRadians
} from "./chunk-6VQA33IW.js";
import {
toSimpleCache
} from "./chunk-R6MNMUIE.js";
import {
exec,

@@ -11,13 +40,4 @@ execSync,

sh
} from "./chunk-ARIG43WR.js";
} from "./chunk-CWZP7SKW.js";
import {
BinarySearch
} from "./chunk-4NCPK65V.js";
import {
InMemoryCache
} from "./chunk-QOVA75R2.js";
import {
Dayjs
} from "./chunk-6SHJTHML.js";
import {
assert,

@@ -27,10 +47,9 @@ equal,

throws
} from "./chunk-SPTQBQAG.js";
} from "./chunk-JPOT7FZO.js";
import {
toSimpleCache
} from "./chunk-R6MNMUIE.js";
Singleton
} from "./chunk-KBDJ4GP6.js";
import {
Vector2,
vector2
} from "./chunk-YD5V5I6O.js";
InMemoryCache
} from "./chunk-D5O2JNYC.js";
import {

@@ -56,2 +75,3 @@ addTimeout,

isNullish,
isObjectDeepEqual,
isObjectLike,

@@ -85,26 +105,7 @@ isPartiallyLike,

uniqueId
} from "./chunk-SFBOBPM6.js";
} from "./chunk-MT7OXZSO.js";
import {
Result
} from "./chunk-3E2OVB6I.js";
import {
DEGREES_MULT,
RADIANS_MULT,
clamp,
isBetween,
lerp,
manhattanDistance,
randFloat,
randInteger,
roundTo,
roundToNearest,
safeParseFloat,
safeParseInt,
toDegrees,
toRadians
} from "./chunk-6VQA33IW.js";
import "./chunk-6PUHUOEZ.js";
import {
Singleton
} from "./chunk-KBDJ4GP6.js";
import "./chunk-XXUQQ62P.js";

@@ -148,2 +149,3 @@ export {

isNullish,
isObjectDeepEqual,
isObjectLike,

@@ -150,0 +152,0 @@ isPartiallyLike,

import {
InMemoryCache
} from "./chunk-QOVA75R2.js";
import "./chunk-SFBOBPM6.js";
} from "./chunk-D5O2JNYC.js";
import "./chunk-MT7OXZSO.js";
import "./chunk-3E2OVB6I.js";

@@ -6,0 +6,0 @@ import "./chunk-6PUHUOEZ.js";

@@ -11,4 +11,4 @@ import {

sh
} from "./chunk-ARIG43WR.js";
import "./chunk-SFBOBPM6.js";
} from "./chunk-CWZP7SKW.js";
import "./chunk-MT7OXZSO.js";
import "./chunk-3E2OVB6I.js";

@@ -15,0 +15,0 @@ import "./chunk-6PUHUOEZ.js";

@@ -37,1 +37,3 @@ import { Comparator, ObjectWithValueAtPath, Split } from './types';

export declare function pick<T extends object>(obj: T, ...keys: string[]): T;
/** Returns true if `a` and `b` are deeply equal. Does not check for alphabetical order. */
export declare function isObjectDeepEqual(a: object, b: object): boolean;
import {
findItemsFrom,
groupBy,
isObjectDeepEqual,
isPartiallyLike,

@@ -10,3 +11,3 @@ omit,

sortByKeys
} from "./chunk-SFBOBPM6.js";
} from "./chunk-MT7OXZSO.js";
import "./chunk-3E2OVB6I.js";

@@ -18,2 +19,3 @@ import "./chunk-6PUHUOEZ.js";

groupBy,
isObjectDeepEqual,
isPartiallyLike,

@@ -20,0 +22,0 @@ omit,

@@ -13,3 +13,3 @@ import {

uniqueId
} from "./chunk-SFBOBPM6.js";
} from "./chunk-MT7OXZSO.js";
import "./chunk-3E2OVB6I.js";

@@ -16,0 +16,0 @@ import "./chunk-6PUHUOEZ.js";

import {
Vector2,
vector2
} from "./chunk-YD5V5I6O.js";
import "./chunk-SFBOBPM6.js";
} from "./chunk-GJORIYU5.js";
import "./chunk-MT7OXZSO.js";
import "./chunk-3E2OVB6I.js";

@@ -7,0 +7,0 @@ import "./chunk-6PUHUOEZ.js";

export declare function assert(value: unknown, message?: string | Error): asserts value;
/**
* @deprecated Use `assert.throws` from node assert package instead or somewhere else.
*/
export declare const throws: (block: () => unknown, message?: string | Error) => void;

@@ -8,4 +11,6 @@ /**

export declare const expectType: <T>(value: T) => T;
/** Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
/**
* @deprecated Use `assert.deepStrictEqual` from node assert package instead or somewhere else.
* @description Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
export declare const equal: <T>(actual: T, expected: T, message?: string | Error) => boolean;
//# sourceMappingURL=assertions.d.ts.map
// @bun
import"./object.js";import"./result.js";import{Ea as z}from"./chunk-65pypddk.js";function B(j,w){if(!j)if(typeof w==="string")throw new Error(w);else throw w??new Error("Assertion failed")}var C=(j,w)=>{return z("assert").throws(j,w)},D=(j)=>j,F=(j,w,A)=>{return z("assert").deepStrictEqual(j,w,A)};export{C as throws,D as expectType,F as equal,B as assert};
export{B as m,C as n,D as o,F as p};
import{sa as z}from"./string.js";import"./result.js";import"./chunk-xwctzjfy.js";function B(b,j){if(!b)if(typeof j==="string")throw new Error(j);else throw j??new Error("Assertion failed")}var C=z("`throws` is deprecated, use `assert.throws` from node assert package instead or somewhere else."),D=(b)=>b,F=z("`equal` is deprecated, use `deepStrictEqual` from node assert package instead or somewhere else.");export{C as throws,D as expectType,F as equal,B as assert};
export{B as C,C as D,D as E,F};
//# debugId=76846403204F1ACA64756E2164756E21
//# debugId=91DA611CA5B3827764756E2164756E21
// @bun
import"./chunk-65pypddk.js";class G{array;constructor(k,q={}){if(k.length<2)throw new Error("Array must be of at least length 2.");this.array=k,this.comparator=q.comparator||this.comparator}get length(){return this.array.length}has(k){return this.indexOf(k)!==-1}indexOf(k){let{found:q,index:v}=this.search(k);return q?v:-1}closestIndexOf(k){let{found:q,index:v}=this.search(k);if(q)return v;let z=0,C=null;for(let A=v-1;A<=v+1;A++){if(A<0||A>=this.array.length)continue;let E=this.array[A];if(!E)continue;let F=Math.abs(this.comparator(k,E));if(!C||F<C)C=F,z=A}return z}at(k){return this.array[k]}insert(k){return this.array.splice(this.closestIndexOf(k)+1,0,k),this}comparator=(k,q)=>k-q;search(k){let q=0,v=this.array.length-1,z;do{z=Math.floor((q+v)/2);let C=this.array[z];if(!C)break;let A=this.comparator(k,C);if(A>0)q=z+1;else if(A<0)v=z-1;else return{found:!0,index:z}}while(q<=v);return{found:!1,index:z}}}var J=G;export{J as default,G as BinarySearch};
export{G as j};
import"./chunk-xwctzjfy.js";class G{array;constructor(k,q={}){if(k.length<2)throw new Error("Array must be of at least length 2.");this.array=k,this.comparator=q.comparator||this.comparator}get length(){return this.array.length}has(k){return this.indexOf(k)!==-1}indexOf(k){let{found:q,index:v}=this.search(k);return q?v:-1}closestIndexOf(k){let{found:q,index:v}=this.search(k);if(q)return v;let z=0,C=null;for(let A=v-1;A<=v+1;A++){if(A<0||A>=this.array.length)continue;let E=this.array[A];if(!E)continue;let F=Math.abs(this.comparator(k,E));if(!C||F<C)C=F,z=A}return z}at(k){return this.array[k]}insert(k){return this.array.splice(this.closestIndexOf(k)+1,0,k),this}comparator=(k,q)=>k-q;search(k){let q=0,v=this.array.length-1,z;do{z=Math.floor((q+v)/2);let C=this.array[z];if(!C)break;let A=this.comparator(k,C);if(A>0)q=z+1;else if(A<0)v=z-1;else return{found:!0,index:z}}while(q<=v);return{found:!1,index:z}}}var J=G;export{J as default,G as BinarySearch};
export{G as d};
//# debugId=F4410B6DCC6A940364756E2164756E21
//# debugId=B1887D21BD1B674564756E2164756E21
// @bun
import"./chunk-65pypddk.js";function i(t,a){return{get:(e)=>t.get(e).then(a.get),set:(e,l)=>t.set(e,a.set(l)),delete:async(e)=>t.delete(e)}}export{i as toSimpleCache};
export{i as q};
import"./chunk-xwctzjfy.js";function i(t,a){return{get:(e)=>t.get(e).then(a.get),set:(e,l)=>t.set(e,a.set(l)),delete:async(e)=>t.delete(e)}}export{i as toSimpleCache};
export{i as s};
//# debugId=833F6C974041457764756E2164756E21
//# debugId=237B52F8E0F1EF6C64756E2164756E21
// @bun
import"./chunk-65pypddk.js";import e from"dayjs";import t from"dayjs/plugin/utc";import"dayjs/plugin/utc";import o from"dayjs/plugin/duration";import"dayjs/plugin/duration";import r from"dayjs/plugin/isBetween";import"dayjs/plugin/isBetween";import i from"dayjs/plugin/relativeTime";import"dayjs/plugin/relativeTime";import m from"dayjs/plugin/minMax";import"dayjs/plugin/minMax";e.extend(t);e.extend(o);e.extend(r);e.extend(i);e.extend(m);var p=e,h=p;export{h as default,p as Dayjs};
export{p as l};
import"./chunk-xwctzjfy.js";import e from"dayjs";import t from"dayjs/plugin/utc";import"dayjs/plugin/utc";import o from"dayjs/plugin/duration";import"dayjs/plugin/duration";import r from"dayjs/plugin/isBetween";import"dayjs/plugin/isBetween";import i from"dayjs/plugin/relativeTime";import"dayjs/plugin/relativeTime";import m from"dayjs/plugin/minMax";import"dayjs/plugin/minMax";e.extend(t);e.extend(o);e.extend(r);e.extend(i);e.extend(m);var p=e,h=p;export{h as default,p as Dayjs};
export{p as c};
//# debugId=39975F53C8328F9F64756E2164756E21
//# debugId=87101953DA0DD50D64756E2164756E21
// @bun
import"./chunk-65pypddk.js";var z=()=>{let v=[];return Object.assign((...q)=>{v.push(...q)},{[Symbol.asyncDispose]:async()=>{await Promise.all(v.map((q)=>q()))}})};export{z as deferral};
import"./chunk-xwctzjfy.js";var z=()=>{let v=[];return Object.assign((...q)=>{v.push(...q)},{[Symbol.asyncDispose]:async()=>{await Promise.all(v.map((q)=>q()))}})};export{z as deferral};
//# debugId=F7FCEBAF5BAD9D2164756E2164756E21
// @bun
import"./chunk-65pypddk.js";class r{get size(){throw new Error("Method not implemented.")}get(e){throw new Error("Method not implemented.")}delete(e){throw new Error("Method not implemented.")}set(e,o){throw new Error("Method not implemented.")}has(e){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}keys(){throw new Error("Method not implemented.")}}export{r as FSCache};
import"./chunk-xwctzjfy.js";class r{get size(){throw new Error("Method not implemented.")}get(e){throw new Error("Method not implemented.")}delete(e){throw new Error("Method not implemented.")}set(e,o){throw new Error("Method not implemented.")}has(e){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}keys(){throw new Error("Method not implemented.")}}export{r as FSCache};
//# debugId=6D52AE0F6648C9AC64756E2164756E21
// @bun
import{a as lo,b as no,c as qo,d as so,e as uo,f as vo,g as wo,h as yo,i as zo}from"./misc.js";import{j as ho}from"./BinarySearch.js";import{k as ko}from"./InMemoryCache.js";import{l as jo}from"./dayjs.js";import{m as ao,n as bo,o as co,p as go}from"./assertions.js";import{q as io}from"./caching.js";import{r as Po,s as Qo}from"./vector2.js";import{$ as X,A as u,B as v,C as w,D as y,E as z,F as A,G as B,H as C,I as D,J as E,K as F,L as G,M as I,N as J,O as K,P as L,Q as M,R as N,S as O,T as P,U as Q,V as R,W as S,X as T,Y as U,Z as V,_ as W,aa as Y,ba as Z,ca as _,da as $,ea as oo,fa as ro,ga as eo,ha as fo,ia as mo,ja as po,ka as to,la as xo,t as i,u as j,v as k,w as l,x as n,y as q,z as s}from"./object.js";import{ma as H}from"./result.js";import{Aa as Mo,Ba as No,oa as Ao,pa as Bo,qa as Co,ra as Do,sa as Eo,ta as Fo,ua as Go,va as Ho,wa as Io,xa as Jo,ya as Ko,za as Lo}from"./number.js";import{Ca as Oo}from"./types.js";import"./chunk-65pypddk.js";export{Qo as vector2,C as uniqueId,D as txt,N as tryResult,F as truncate,io as toSimpleCache,Co as toRadians,A as toMatch,Do as toDegrees,fo as toAsyncFn,bo as throws,xo as throttle,B as stringSplice,l as sortByKeys,P as sleep,so as sh,Ko as safeParseInt,Lo as safeParseFloat,j as safeJSONParse,O as safeCall,Jo as roundToNearest,Io as roundTo,Go as randInteger,Ho as randFloat,Z as raise,yo as question,k as propIs,I as pipe,u as pick,ro as once,s as omit,X as okOr,W as ok,oo as not,T as noop,lo as nodeOnly,$ as multiComparator,eo as memoize,z as matches,Eo as manhattanDistance,qo as main,zo as localIPs,K as limitConcurrency,Fo as lerp,n as isPartiallyLike,L as isObjectLike,V as isNullish,wo as isInDebug,Y as isError,No as isBetween,no as importSync,Q as iife,R as identity,w as hashWithLength,i as groupBy,J as flow,q as findItemsFrom,v as fastHash,co as expectType,vo as execSync,uo as exec,go as equal,U as effect,E as deburr,to as debounce,S as constant,y as coerceHash,po as classToFn,Mo as clamp,G as capitalize,M as attempt,ao as assert,_ as alwaysRaise,mo as addTimeout,Po as Vector2,Oo as Singleton,H as Result,Ao as RADIANS_MULT,ko as InMemoryCache,jo as Dayjs,Bo as DEGREES_MULT,ho as BinarySearch};
import{a as Qo,b as Ro}from"./vector2.js";import{c as Ao}from"./dayjs.js";import{d as zo}from"./BinarySearch.js";import{e as Co,f as Do,g as Eo,h as Fo,i as Go,j as Ho,k as Io,l as Jo,m as Ko,n as Lo,o as Mo,p as No,q as Oo,r as Po}from"./number.js";import{s as i}from"./caching.js";import{A as no,B as qo,t as co,u as go,v as ho,w as io,x as jo,y as ko,z as lo}from"./misc.js";import{C as so,D as uo,E as vo,F as wo}from"./assertions.js";import{G as yo}from"./types.js";import{H as Bo}from"./InMemoryCache.js";import{$ as I,Aa as ao,Ba as bo,I as j,J as k,K as l,L as n,M as q,N as s,O as u,P as v,Q as w,R as y,S as z,T as A,U as B,V as C,W as D,X as E,Y as F,Z as G,_ as H,aa as K,ba as L,ca as M,da as N,ea as O,fa as P,ga as Q,ha as R,ia as S,ja as T,ka as U,la as V,ma as W,na as X,oa as Y,pa as Z,qa as _,ra as $,sa as oo,ta as ro,ua as eo,va as fo,wa as mo,xa as po,ya as to,za as xo}from"./string.js";import{Ca as J}from"./result.js";import"./chunk-xwctzjfy.js";export{Ro as vector2,E as uniqueId,F as txt,P as tryResult,H as truncate,i as toSimpleCache,Eo as toRadians,C as toMatch,Fo as toDegrees,po as toAsyncFn,uo as throws,bo as throttle,D as stringSplice,n as sortByKeys,R as sleep,io as sh,Mo as safeParseInt,No as safeParseFloat,k as safeJSONParse,Q as safeCall,Lo as roundToNearest,Ko as roundTo,Io as randInteger,Jo as randFloat,$ as raise,no as question,l as propIs,K as pipe,v as pick,fo as once,u as omit,Z as okOr,Y as ok,eo as not,V as noop,co as nodeOnly,ro as multiComparator,mo as memoize,B as matches,Go as manhattanDistance,ho as main,qo as localIPs,M as limitConcurrency,Ho as lerp,q as isPartiallyLike,N as isObjectLike,w as isObjectDeepEqual,X as isNullish,lo as isInDebug,_ as isError,Po as isBetween,go as importSync,S as iife,T as identity,z as hashWithLength,j as groupBy,L as flow,s as findItemsFrom,y as fastHash,vo as expectType,ko as execSync,jo as exec,wo as equal,W as effect,G as deburr,ao as debounce,U as constant,A as coerceHash,xo as classToFn,Oo as clamp,I as capitalize,O as attempt,so as assert,oo as alwaysRaise,to as addTimeout,Qo as Vector2,yo as Singleton,J as Result,Co as RADIANS_MULT,Bo as InMemoryCache,Ao as Dayjs,Do as DEGREES_MULT,zo as BinarySearch};
//# debugId=D266BDDFCC849FE064756E2164756E21
//# debugId=3E4A39B446C7D41E64756E2164756E21
// @bun
import{u as r}from"./object.js";import"./result.js";import"./chunk-65pypddk.js";class t{map=new Map;get size(){return Promise.resolve(this.map.size)}async get(e){let s=this.map.get(e);return r(s??"")}async delete(e){return this.map.delete(e)}async set(e,s){return this.map.set(e,typeof s!=="string"?JSON.stringify(s):s),!0}async has(e){return this.map.has(e)}async clear(){return this.map.clear(),!0}async*keys(){yield*this.map.keys()}}export{t as InMemoryCache};
export{t as k};
import{J as r}from"./string.js";import"./result.js";import"./chunk-xwctzjfy.js";class t{map=new Map;get size(){return Promise.resolve(this.map.size)}async get(e){let s=this.map.get(e);return r(s??"")}async delete(e){return this.map.delete(e)}async set(e,s){return this.map.set(e,typeof s!=="string"?JSON.stringify(s):s),!0}async has(e){return this.map.has(e)}async clear(){return this.map.clear(),!0}async*keys(){yield*this.map.keys()}}export{t as InMemoryCache};
export{t as H};
//# debugId=0A3AA536B618FE5C64756E2164756E21
//# debugId=E6BBA8EB3661FBC864756E2164756E21
// @bun
import{Q as O,U as Q,ca as U}from"./object.js";import{na as F}from"./result.js";import{Da as X,Ea as L}from"./chunk-65pypddk.js";function P(z){return z}var T=(z)=>L(z),g=U("Cannot have a main function in this runtime environment."),x=(...z)=>Q(({spawn:B}=T("child_process"))=>{let G=z.join(`
import{ea as O,ia as Q,sa as U}from"./string.js";import{Da as F}from"./result.js";import{Ea as X,Fa as L}from"./chunk-xwctzjfy.js";function P(z){return z}var T=(z)=>L(z),g=U("Cannot have a main function in this runtime environment."),x=(...z)=>Q(({spawn:B}=T("child_process"))=>{let G=z.join(`
`);return new Promise((j)=>{let{status:E,data:H,error:M}=O(()=>B(G,{shell:!0,stdio:"inherit",env:{...process.env}}));if(E==="error")return j(F.Err(M));H.on("close",(J)=>{if(J)j(F.Err(new Error(`Command "${G}" exited with code ${J}`)));else j(F.Ok(!0))}),H.on("error",(J)=>j(F.Err(J)))})}),V=(...z)=>Q(({spawn:B}=T("child_process"))=>{let G=z.join(`
`);return new Promise((j)=>{let{data:E,error:H}=O(()=>B(G,{shell:!0,env:{...process.env}}));if(H)return j(F.Err(H));let M="",J=(K)=>{let W=K.toString();M+=W+`
`};E.stdout?.on("data",J),E.stderr?.on("data",J),E.on("close",(K)=>{if(K)j(F.Err(new Error(`Command "${G}" exited with code ${K}`)));else j(F.Ok(M))}),E.on("error",(K)=>j(F.Err(K)))})}),b=(z)=>Q(({execSync:B}=T("child_process"))=>O(()=>B(z,{encoding:"utf-8",env:process.env,shell:!0}))),Y=()=>typeof L("inspector").url()!=="undefined",k=async(z,B)=>{if(Y())return B||"";let j=(await import("readline")).createInterface({input:process.stdin,output:process.stdout});return new Promise((E)=>j.question(z,(H)=>{j.close(),E(H||B||"")}))};function*q(){let z=L("os").networkInterfaces;for(let[B,G]of Object.entries(z()))for(let j of G??[]){let E=typeof j.family==="string"?"IPv4":4;if(j.family===E&&!j.internal)yield{name:B,address:j.address}}}export{x as sh,k as question,P as nodeOnly,g as main,q as localIPs,Y as isInDebug,T as importSync,b as execSync,V as exec};
export{P as a,T as b,g as c,x as d,V as e,b as f,Y as g,k as h,q as i};
export{P as t,T as u,g as v,x as w,V as x,b as y,Y as z,k as A,q as B};
//# debugId=F01964436F313B1464756E2164756E21
//# debugId=33554139AEF1721064756E2164756E21
// @bun
import"./chunk-65pypddk.js";import{reduce as w,zip as B}from"iteragain";var C=Math.PI/180,F=180/Math.PI;function K(h){return h*C}function O(h){return h*F}function P(h,j){return w(B(h,j),(k,[q,v])=>k+Math.abs(q-v),0)}function Q(h,j,k){return h+(j-h)*k}function V(h,j){return Math.floor(Math.random()*(j-h+1))+h}function W(h,j){return Math.random()*(j-h)+h}function X(h,j){let k=Math.pow(10,j);return Math.round(h*k)/k}function Y(h,j){let k=Math.round(h/j)*j,q=Math.max((j.toString().split(".")[1]||"").length,(h.toString().split(".")[1]||"").length);return Number(k.toFixed(q))}function Z(h){let j=parseInt(h);return isNaN(j)?null:j}function $(h){let j=parseFloat(h);return isNaN(j)?null:j}function y(h,j,k){return Math.min(k,Math.max(j,h))}function z(h,j,k){return h>=j&&h<=k}export{K as toRadians,O as toDegrees,Z as safeParseInt,$ as safeParseFloat,Y as roundToNearest,X as roundTo,V as randInteger,W as randFloat,P as manhattanDistance,Q as lerp,z as isBetween,y as clamp,C as RADIANS_MULT,F as DEGREES_MULT};
export{C as oa,F as pa,K as qa,O as ra,P as sa,Q as ta,V as ua,W as va,X as wa,Y as xa,Z as ya,$ as za,y as Aa,z as Ba};
import"./chunk-xwctzjfy.js";import{reduce as w,zip as B}from"iteragain";var C=Math.PI/180,F=180/Math.PI;function K(h){return h*C}function O(h){return h*F}function P(h,j){return w(B(h,j),(k,[q,v])=>k+Math.abs(q-v),0)}function Q(h,j,k){return h+(j-h)*k}function V(h,j){return Math.floor(Math.random()*(j-h+1))+h}function W(h,j){return Math.random()*(j-h)+h}function X(h,j){let k=Math.pow(10,j);return Math.round(h*k)/k}function Y(h,j){let k=Math.round(h/j)*j,q=Math.max((j.toString().split(".")[1]||"").length,(h.toString().split(".")[1]||"").length);return Number(k.toFixed(q))}function Z(h){let j=parseInt(h);return isNaN(j)?null:j}function $(h){let j=parseFloat(h);return isNaN(j)?null:j}function y(h,j,k){return Math.min(k,Math.max(j,h))}function z(h,j,k){return h>=j&&h<=k}export{K as toRadians,O as toDegrees,Z as safeParseInt,$ as safeParseFloat,Y as roundToNearest,X as roundTo,V as randInteger,W as randFloat,P as manhattanDistance,Q as lerp,z as isBetween,y as clamp,C as RADIANS_MULT,F as DEGREES_MULT};
export{C as e,F as f,K as g,O as h,P as i,Q as j,V as k,W as l,X as m,Y as n,Z as o,$ as p,y as q,z as r};
//# debugId=536BAAB34A894E4964756E2164756E21
//# debugId=D5551013E45387B264756E2164756E21

@@ -37,2 +37,4 @@ import { Comparator, ObjectWithValueAtPath, Split } from './types';

export declare function pick<T extends object>(obj: T, ...keys: string[]): T;
/** Returns true if `a` and `b` are deeply equal. Does not check for alphabetical order. */
export declare function isObjectDeepEqual(a: object, b: object): boolean;
//# sourceMappingURL=object.d.ts.map
// @bun
import"./chunk-65pypddk.js";var k={Ok:(b)=>({status:"success",data:b}),Err:(b)=>({status:"error",error:b}),unwrap:({data:b,error:g},j)=>{if(g){if(j!==void 0)return j;throw g}return b},isOk:(b)=>b.status==="success",isError:(b)=>b.status==="error"},q=k;export{q as default,k as Result};
export{k as ma,q as na};
import"./chunk-xwctzjfy.js";var k={Ok:(b)=>({status:"success",data:b}),Err:(b)=>({status:"error",error:b}),unwrap:({data:b,error:g},j)=>{if(g){if(j!==void 0)return j;throw g}return b},isOk:(b)=>b.status==="success",isError:(b)=>b.status==="error"},q=k;export{q as default,k as Result};
export{k as Ca,q as Da};
//# debugId=A9BEF87585D8C65964756E2164756E21
//# debugId=55A38713B913BF7D64756E2164756E21
// @bun
import"./chunk-65pypddk.js";class a{static _instance;constructor(){}static instance(){return this._instance}}export{a as Singleton};
export{a as Ca};
import"./chunk-xwctzjfy.js";class a{static _instance;constructor(){}static instance(){return this._instance}}export{a as Singleton};
export{a as G};
//# debugId=BB122D1AB9EF48EC64756E2164756E21
//# debugId=0697F85121A5DABF64756E2164756E21
// @bun
import{ja as i}from"./object.js";import"./result.js";import"./chunk-65pypddk.js";var u=/\d+(\.\d+)?/g;class r{static ZERO=new r(0,0);static ONE=new r(1,1);static UP=new r(0,1);static DOWN=new r(0,-1);static LEFT=new r(-1,0);static RIGHT=new r(1,0);x;y;constructor(...[t,e]){if(typeof t==="number")this.x=t,this.y=e??t;else if(Array.isArray(t))this.x=t[0],this.y=t[1];else if(typeof t==="object")this.x=t.x,this.y=t.y;else throw new Error("Invalid arguments")}static fromString(t){let[e,n]=t.matchAll(u).take(2).map((s)=>parseFloat(s[0]));return new r(e??0,n??0)}static fromAngle(t){return new r(Math.cos(t),Math.sin(t))}add(...t){let e=new r(...t);return new r(this.x+e.x,this.y+e.y)}sub(...t){let e=new r(...t);return new r(this.x-e.x,this.y-e.y)}mul(...t){let e=new r(...t);return new r(this.x*e.x,this.y*e.y)}div(...t){let e=new r(...t),n=this.x/e.x,s=this.y/e.y;return new r(isNaN(n)?0:n,isNaN(s)?0:s)}neg(){return new r(-this.x,-this.y)}abs(){return new r(Math.abs(this.x),Math.abs(this.y))}len(){return Math.sqrt(this.x*this.x+this.y*this.y)}dist(t){return this.sub(t).len()}norm(){return this.div(this.sub(new r(0,0)))}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t){return new r(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t))}angle(){return Math.atan2(this.y,this.x)}project(...t){let e=new r(...t);return e.mul(this.dot(e)/e.dot(e))}reflect(...t){let e=new r(...t);return this.sub(this.project(e).mul(2))}toJSON(){return{x:this.x,y:this.y}}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}}var a=i(r);export{a as vector2,r as Vector2};
export{r,a as s};
import{za as i}from"./string.js";import"./result.js";import"./chunk-xwctzjfy.js";var u=/\d+(\.\d+)?/g;class r{static ZERO=new r(0,0);static ONE=new r(1,1);static UP=new r(0,1);static DOWN=new r(0,-1);static LEFT=new r(-1,0);static RIGHT=new r(1,0);x;y;constructor(...[t,e]){if(typeof t==="number")this.x=t,this.y=e??t;else if(Array.isArray(t))this.x=t[0],this.y=t[1];else if(typeof t==="object")this.x=t.x,this.y=t.y;else throw new Error("Invalid arguments")}static fromString(t){let[e,n]=t.matchAll(u).take(2).map((s)=>parseFloat(s[0]));return new r(e??0,n??0)}static fromAngle(t){return new r(Math.cos(t),Math.sin(t))}add(...t){let e=new r(...t);return new r(this.x+e.x,this.y+e.y)}sub(...t){let e=new r(...t);return new r(this.x-e.x,this.y-e.y)}mul(...t){let e=new r(...t);return new r(this.x*e.x,this.y*e.y)}div(...t){let e=new r(...t),n=this.x/e.x,s=this.y/e.y;return new r(isNaN(n)?0:n,isNaN(s)?0:s)}neg(){return new r(-this.x,-this.y)}abs(){return new r(Math.abs(this.x),Math.abs(this.y))}len(){return Math.sqrt(this.x*this.x+this.y*this.y)}dist(t){return this.sub(t).len()}norm(){return this.div(this.sub(new r(0,0)))}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t){return new r(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t))}angle(){return Math.atan2(this.y,this.x)}project(...t){let e=new r(...t);return e.mul(this.dot(e)/e.dot(e))}reflect(...t){let e=new r(...t);return this.sub(this.project(e).mul(2))}toJSON(){return{x:this.x,y:this.y}}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}}var a=i(r);export{a as vector2,r as Vector2};
export{r as a,a as b};
//# debugId=77BD26B56F3D646B64756E2164756E21
//# debugId=720CA0E3F8F237E364756E2164756E21
export declare function assert(value: unknown, message?: string | Error): asserts value;
/**
* @deprecated Use `assert.throws` from node assert package instead or somewhere else.
*/
export declare const throws: (block: () => unknown, message?: string | Error) => void;

@@ -8,3 +11,5 @@ /**

export declare const expectType: <T>(value: T) => T;
/** Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
/**
* @deprecated Use `assert.deepStrictEqual` from node assert package instead or somewhere else.
* @description Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
export declare const equal: <T>(actual: T, expected: T, message?: string | Error) => boolean;

@@ -26,2 +26,13 @@ "use strict";

module.exports = __toCommonJS(assertions_exports);
// src/functional.ts
var import_moderndash = require("moderndash");
function raise(...exceptions) {
throw exceptions.length === 1 ? typeof exceptions[0] == "string" ? new Error(exceptions[0]) : exceptions[0] : new AggregateError(exceptions);
}
function alwaysRaise(...exceptions) {
return () => raise(...exceptions);
}
// src/assertions.ts
function assert(value, message) {

@@ -31,3 +42,7 @@ if (!value)

}
var throws = (block, message) => require("assert").throws(block, message), expectType = (value) => value, equal = (actual, expected, message) => require("assert").deepStrictEqual(actual, expected, message);
var throws = alwaysRaise(
"`throws` is deprecated, use `assert.throws` from node assert package instead or somewhere else."
), expectType = (value) => value, equal = alwaysRaise(
"`equal` is deprecated, use `deepStrictEqual` from node assert package instead or somewhere else."
);
// Annotate the CommonJS export names for ESM import in node:

@@ -34,0 +49,0 @@ 0 && (module.exports = {

@@ -68,3 +68,3 @@ "use strict";

function coerceHash(input, seed = 0) {
return typeof input == "string" ? fastHash(input, seed) : typeof input == "number" ? fastHash(input.toString(), seed) : Array.isArray(input) ? fastHash(input.map((v) => coerceHash(v, seed)).join("")) : isObjectLike(input) ? fastHash(JSON.stringify(sortByKeys(input)), seed) : typeof input == "bigint" ? fastHash(input.toString()) : fastHash(typeof input > "u" ? "undefined" : typeof input == "symbol" ? input.toString() : JSON.stringify(input), seed);
return typeof input == "string" ? fastHash(input, seed) : typeof input == "number" || typeof input == "bigint" || typeof input == "symbol" ? fastHash(input.toString(), seed) : Array.isArray(input) ? fastHash(input.map((v) => coerceHash(v, seed)).join("")) : isObjectLike(input) ? fastHash(JSON.stringify(sortByKeys(input)), seed) : fastHash(typeof input > "u" ? "undefined" : JSON.stringify(input), seed);
}

@@ -71,0 +71,0 @@ var emptyPrefix = Symbol("empty");

@@ -37,1 +37,3 @@ import { Comparator, ObjectWithValueAtPath, Split } from './types';

export declare function pick<T extends object>(obj: T, ...keys: string[]): T;
/** Returns true if `a` and `b` are deeply equal. Does not check for alphabetical order. */
export declare function isObjectDeepEqual(a: object, b: object): boolean;
export declare function assert(value: unknown, message?: string | Error): asserts value;
/**
* @deprecated Use `assert.throws` from node assert package instead or somewhere else.
*/
export declare const throws: (block: () => unknown, message?: string | Error) => void;

@@ -8,4 +11,6 @@ /**

export declare const expectType: <T>(value: T) => T;
/** Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
/**
* @deprecated Use `assert.deepStrictEqual` from node assert package instead or somewhere else.
* @description Wrapper for `deepStrictEqual` that asserts at the type level that `actual` and `expected` are the same type. */
export declare const equal: <T>(actual: T, expected: T, message?: string | Error) => boolean;
//# sourceMappingURL=assertions.d.ts.map

@@ -37,2 +37,4 @@ import { Comparator, ObjectWithValueAtPath, Split } from './types';

export declare function pick<T extends object>(obj: T, ...keys: string[]): T;
/** Returns true if `a` and `b` are deeply equal. Does not check for alphabetical order. */
export declare function isObjectDeepEqual(a: object, b: object): boolean;
//# sourceMappingURL=object.d.ts.map
{
"name": "@danoaky/js-utils",
"version": "0.28.0",
"version": "0.28.1",
"author": "Daniel Brown",

@@ -5,0 +5,0 @@ "main": "./dist/node-cjs/index.js",

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

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

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet