tsu 2.11.1 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var R=(e,r)=>{for(var n in r)d(e,n,{get:r[n],enumerable:!0})},B=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of U(r))!L.call(e,o)&&o!==n&&d(e,o,{get:()=>r[o],enumerable:!(t=S(r,o))||t.enumerable});return e};var D=e=>B(d({},"__esModule",{value:!0}),e);var Xe={};R(Xe,{average:()=>z,capitalise:()=>E,capitalize:()=>Se,ceil:()=>_,chars:()=>Ue,clamp:()=>m,clone:()=>a,copyToClipboard:()=>he,debounce:()=>Oe,drop:()=>q,es:()=>se,floor:()=>V,groups:()=>H,head:()=>I,init:()=>W,isArray:()=>l,isBlank:()=>Le,isBoolean:()=>te,isBrowser:()=>s,isDefined:()=>oe,isEmpty:()=>Re,isEmptyArray:()=>ie,isEmptyObject:()=>ue,isEven:()=>J,isFunction:()=>fe,isNull:()=>p,isNumber:()=>y,isObject:()=>T,isObjectLike:()=>c,isOdd:()=>K,isString:()=>b,isTouchDevice:()=>me,isUndefined:()=>le,isWindow:()=>f,ks:()=>pe,last:()=>$,max:()=>Y,memoise:()=>O,memoize:()=>Ce,min:()=>Z,noop:()=>Ne,once:()=>Ee,partition:()=>P,product:()=>G,randomChance:()=>Q,randomNumber:()=>u,range:()=>X,replaceChar:()=>Be,round:()=>ee,scroll:()=>ke,shuffle:()=>ae,sleep:()=>Me,splitArray:()=>xe,splitString:()=>De,sum:()=>g,tail:()=>be,take:()=>de,throttle:()=>Ae,toArray:()=>ge,toCamel:()=>qe,toDp:()=>re,toKebab:()=>He,toNumber:()=>ne,toOrdinal:()=>Ie,toRomanNumerals:()=>We,truncate:()=>$e,unchars:()=>Pe,uniq:()=>Te,uuid:()=>Fe,vs:()=>ce});module.exports=D(Xe);function q(e,r){return r<=0?[...e]:e.slice(r)}function H(e,r){if(r<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(r>=e.length)return[[...e]];let n=[];for(let t=0;t<e.length;t+=r)n.push(e.slice(t,t+r));return n}function I(e){return e[0]}function W(e){return e.slice(0,e.length-1)}function $(e){return e[e.length-1]}function P(e,r){let n=[],t=[];for(let o=0;o<e.length;o++){let i=e[o];r(i,o,e)?n.push(i):t.push(i)}return[n,t]}function X(...e){let r,n,t;e.length===1?(n=e[0],r=0,t=1):(r=e[0],n=e[1],t=e[2]||1),t<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),t=1);let o=[],i=r;for(;i<n;)o.push(i),i+=t||1;return o}function z(e){return e.length<1?0:g(e)/e.length}function _(e,r=1){let n=e/r;return Math.ceil(n)*r}function m(e,r,n){return Math.min(n,Math.max(r,e))}function V(e,r=1){let n=e/r;return Math.floor(n)*r}function J(e){return e%2===0}function K(e){return e%2!==0}function Y(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.max(...r)}function Z(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.min(...r)}function G(e){if(e.length<1)return 0;let r=1;for(let n=0;n<e.length;n++)r*=e[n];return r}function u(...e){let r,n;return e.length===1?(r=0,n=e[0]):(r=e[0],n=e[1]),Math.floor(Math.random()*(n-r))+r}function Q(e){return u(e)===0}function ee(e,r=1){let n=e/r;return Math.round(n)*r}function g(e){let r=0;for(let n=0;n<e.length;n++)r+=e[n];return r}function re(e,r=0){r<0&&console.warn("[tsu] warning: decimalPlaces less than 0 are set to 0."),r>100&&console.warn("[tsu] warning: decimalPlaces greater than 100 are set to 100.");let n=m(r,0,100);return Number(e.toFixed(n))}function ne(e,r=[]){if(!e.length)return NaN;let n=["#","\xA3","\u20AC","$","%",",",...r],t=new RegExp(`[${n.join("")}]`,"g");return Number(e.replace(t,""))}function l(e){return Array.isArray(e)}function te(e){return typeof e=="boolean"}function s(){return typeof window<"u"}function oe(e){return typeof e<"u"}function ie(e){return l(e)&&e.length===0}function ue(e){if(!T(e))return!1;for(let r in e)return!1;return!0}function fe(e){return typeof e=="function"}function p(e){return Object.prototype.toString.call(e)==="[object Null]"}function y(e){return typeof e=="number"}function T(e){return Object.prototype.toString.call(e)==="[object Object]"}function c(e){return typeof e=="object"}function b(e){return typeof e=="string"}function me(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function le(e){return typeof e>"u"}function f(e){return s()&&Object.prototype.toString.call(e)==="[object Window]"}function a(e){if(l(e)){let r=[];for(let n=0;n<e.length;n++)c(e[n])&&!p(e[n])?r[n]=a(e[n]):r[n]=e[n];return r}if(c(e)&&!p(e)){let r={};for(let n in e)c(e[n])&&!p(e[n])?r[n]=a(e[n]):r[n]=e[n];return r}return e}function se(e){return Object.entries(e)}function pe(e){return Object.keys(e)}function ce(e){return Object.values(e)}function ae(e){let r=a(e),n,t,o;for(n=r.length;n;n-=1)t=u(n),o=r[n-1],r[n-1]=r[t],r[t]=o;return r}function xe(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function be(e){return e.slice(1)}function de(e,r){return r<=0?[]:e.slice(0,r)}function ge(e){return e?Array.isArray(e)?e:[e]:[]}function Te(e){return Array.from(new Set(e))}function ye(e){let r=document.createElement("textarea");r.value=e??"",r.style.position="absolute",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),r.remove()}function he(e){s()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):ye(e))}function we(e){return e<.5?4*Math.pow(e,3):(e-1)*(2*e-2)*(2*e-2)+1}function je(e,r,n,t){return e+(r-e)*we(n/t)}function ve(e,r,n){let t;return y(e)?t=e:f(n)?t=e.getBoundingClientRect().top+r:t=e.getBoundingClientRect().top+r-n.getBoundingClientRect().top,t}function ke({to:e,offset:r=0,duration:n=1e3,container:t=null}){let o=b(e)?document.querySelector(e):e,i=b(t)?document.querySelector(t):t||window,x=f(i)?window.pageYOffset||document.documentElement.scrollTop:i.scrollTop||0,N=f(i)?document.documentElement.scrollHeight-window.innerHeight:i.scrollHeight-i.clientHeight,M=ve(o,x,i)+r,h=m(M,0,N),F=Date.now();function w(){let j=Date.now()-F,v=j<n,k=v?je(x,h,j,n):h;v&&requestAnimationFrame(w),f(i)?window.scrollTo(0,k):i instanceof HTMLElement&&(i.scrollTop=k)}w()}function Oe(e,r){r<0&&console.warn("[tsu] warning: debounce delays less than 0 will be set to 0.");let n;return function(...t){clearTimeout(n),n=setTimeout(()=>{clearTimeout(n),e(...t)},r)}}function O(e){let r={};return function(...n){let t=JSON.stringify(n);if(t in r)return r[t];let o=e(...n);return r[t]=o,o}}var Ce=O;function Ee(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Ae(e,r){r<0&&console.warn("[tsu] warning: throttle limits less than 0 will be set to 0.");let n=!1;return function(...t){n||(e(...t),n=!0,setTimeout(()=>{n=!1},r))}}function Ne(){}async function Me(e){return e<0&&console.warn("[tsu] warning: sleep durations less than 0 are set to 0."),new Promise(r=>{setTimeout(r,e)})}var C="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function Fe(e=16){let r=C.length,n=e,t="";for(;n--;)t+=C[u(r)];return t}function E(e,r=!1,n=" "){return r?e.split(n).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(n):e.charAt(0).toUpperCase()+e.slice(1)}var Se=E;function Ue(e){return e.split("")}function Le(e){return e.trim().length===0}function Re(e){return e.length===0}function Be(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function De(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function qe(e){let r=/-(\w)/g;return e.replace(r,(n,t)=>t?t.toUpperCase():"")}function He(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function Ie(e){let n=["st","nd","rd"][(Math.abs(e)/10%10^1&&Math.abs(e)%10)-1]||"th";return`${e}${n}`}var A={1:"I",4:"IV",5:"V",9:"IX",10:"X",40:"XL",50:"L",90:"XC",100:"C",400:"CD",500:"D",900:"CM",1e3:"M"};function We(e,r=!1){let n=e,t="",o=Object.keys(A).map(Number).sort((i,x)=>x-i);for(let i of o)for(;n>=i;)t+=A[i],n-=i;return r?t.toLowerCase():t}function $e(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function Pe(e){return e.join("")}0&&(module.exports={average,capitalise,capitalize,ceil,chars,clamp,clone,copyToClipboard,debounce,drop,es,floor,groups,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyArray,isEmptyObject,isEven,isFunction,isNull,isNumber,isObject,isObjectLike,isOdd,isString,isTouchDevice,isUndefined,isWindow,ks,last,max,memoise,memoize,min,noop,once,partition,product,randomChance,randomNumber,range,replaceChar,round,scroll,shuffle,sleep,splitArray,splitString,sum,tail,take,throttle,toArray,toCamel,toDp,toKebab,toNumber,toOrdinal,toRomanNumerals,truncate,unchars,uniq,uuid,vs});
1
+ "use strict";var d=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var B=(e,r)=>{for(var n in r)d(e,n,{get:r[n],enumerable:!0})},D=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of R(r))!L.call(e,t)&&t!==n&&d(e,t,{get:()=>r[t],enumerable:!(o=U(r,t))||o.enumerable});return e};var q=e=>D(d({},"__esModule",{value:!0}),e);var _e={};B(_e,{average:()=>G,capitalise:()=>A,capitalize:()=>Le,ceil:()=>ee,chars:()=>Be,clamp:()=>c,clone:()=>a,copyToClipboard:()=>ve,debounce:()=>Oe,drop:()=>H,es:()=>ce,floor:()=>re,groups:()=>I,head:()=>P,init:()=>W,isArray:()=>m,isBlank:()=>De,isBoolean:()=>z,isBrowser:()=>l,isDefined:()=>_,isEmpty:()=>qe,isEmptyArray:()=>V,isEmptyObject:()=>J,isEven:()=>ne,isFunction:()=>g,isNull:()=>s,isNumber:()=>y,isObject:()=>T,isObjectLike:()=>p,isOdd:()=>oe,isString:()=>b,isTouchDevice:()=>Y,isUndefined:()=>Z,isWindow:()=>f,ks:()=>ae,last:()=>$,max:()=>te,memoise:()=>C,memoize:()=>Ae,min:()=>ie,noop:()=>Se,omit:()=>pe,once:()=>Ne,partition:()=>K,product:()=>ue,randomChance:()=>fe,randomNumber:()=>u,range:()=>X,remove:()=>Q,repeat:()=>Me,replaceChar:()=>He,round:()=>me,scroll:()=>Ce,shuffle:()=>be,sleep:()=>Ue,splitArray:()=>de,splitString:()=>Ie,sum:()=>h,tail:()=>Te,take:()=>ge,throttle:()=>Fe,toArray:()=>ye,toCamel:()=>Pe,toDp:()=>le,toKebab:()=>We,toNumber:()=>se,toOrdinal:()=>$e,toRomanNumerals:()=>Ke,truncate:()=>Xe,unchars:()=>ze,uniq:()=>he,uuid:()=>Re,vs:()=>xe});module.exports=q(_e);function H(e,r){return r<=0?[...e]:e.slice(r)}function I(e,r){if(r<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(r>=e.length)return[[...e]];let n=[];for(let o=0;o<e.length;o+=r)n.push(e.slice(o,o+r));return n}function P(e){return e[0]}function W(e){return e.slice(0,e.length-1)}function $(e){return e[e.length-1]}function K(e,r){let n=[],o=[];for(let t=0;t<e.length;t++){let i=e[t];r(i,t,e)?n.push(i):o.push(i)}return[n,o]}function X(...e){let r,n,o;e.length===1?(n=e[0],r=0,o=1):(r=e[0],n=e[1],o=e[2]||1),o<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),o=1);let t=[],i=r;for(;i<n;)t.push(i),i+=o||1;return t}function m(e){return Array.isArray(e)}function z(e){return typeof e=="boolean"}function l(){return typeof window<"u"}function _(e){return typeof e<"u"}function V(e){return m(e)&&e.length===0}function J(e){if(!T(e))return!1;for(let r in e)return!1;return!0}function g(e){return typeof e=="function"}function s(e){return Object.prototype.toString.call(e)==="[object Null]"}function y(e){return typeof e=="number"}function T(e){return Object.prototype.toString.call(e)==="[object Object]"}function p(e){return typeof e=="object"}function b(e){return typeof e=="string"}function Y(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function Z(e){return typeof e>"u"}function f(e){return l()&&Object.prototype.toString.call(e)==="[object Window]"}function Q(e,r){let n=g(r)?r:t=>t===r,o=e.findIndex(n);return o!==-1?[...e.slice(0,o),...e.slice(o+1)]:e}function G(e){return e.length<1?0:h(e)/e.length}function ee(e,r=1){let n=e/r;return Math.ceil(n)*r}function c(e,r,n){return Math.min(n,Math.max(r,e))}function re(e,r=1){let n=e/r;return Math.floor(n)*r}function ne(e){return e%2===0}function oe(e){return e%2!==0}function te(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.max(...r)}function ie(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.min(...r)}function ue(e){if(e.length<1)return 0;let r=1;for(let n=0;n<e.length;n++)r*=e[n];return r}function u(...e){let r,n;return e.length===1?(r=0,n=e[0]):(r=e[0],n=e[1]),Math.floor(Math.random()*(n-r))+r}function fe(e){return u(e)===0}function me(e,r=1){let n=e/r;return Math.round(n)*r}function h(e){let r=0;for(let n=0;n<e.length;n++)r+=e[n];return r}function le(e,r=0){r<0&&console.warn("[tsu] warning: decimalPlaces less than 0 are set to 0."),r>100&&console.warn("[tsu] warning: decimalPlaces greater than 100 are set to 100.");let n=c(r,0,100);return Number(e.toFixed(n))}function se(e,r=[]){if(!e.length)return NaN;let n=["#","\xA3","\u20AC","$","%",",",...r],o=new RegExp(`[${n.join("")}]`,"g");return Number(e.replace(o,""))}function a(e){if(m(e)){let r=[];for(let n=0;n<e.length;n++)p(e[n])&&!s(e[n])?r[n]=a(e[n]):r[n]=e[n];return r}if(p(e)&&!s(e)){let r={};for(let n in e)p(e[n])&&!s(e[n])?r[n]=a(e[n]):r[n]=e[n];return r}return e}function pe(e,r){let n={...e};for(let o of r)delete n[o];return n}function ce(e){return Object.entries(e)}function ae(e){return Object.keys(e)}function xe(e){return Object.values(e)}function be(e){let r=a(e),n,o,t;for(n=r.length;n;n-=1)o=u(n),t=r[n-1],r[n-1]=r[o],r[o]=t;return r}function de(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function Te(e){return e.slice(1)}function ge(e,r){return r<=0?[]:e.slice(0,r)}function ye(e){return e?Array.isArray(e)?e:[e]:[]}function he(e){return Array.from(new Set(e))}function we(e){let r=document.createElement("textarea");r.value=e??"",r.style.position="absolute",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),r.remove()}function ve(e){l()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):we(e))}function je(e){return e<.5?4*Math.pow(e,3):(e-1)*(2*e-2)*(2*e-2)+1}function ke(e,r,n,o){return e+(r-e)*je(n/o)}function Ee(e,r,n){let o;return y(e)?o=e:f(n)?o=e.getBoundingClientRect().top+r:o=e.getBoundingClientRect().top+r-n.getBoundingClientRect().top,o}function Ce({to:e,offset:r=0,duration:n=1e3,container:o=null}){let t=b(e)?document.querySelector(e):e,i=b(o)?document.querySelector(o):o||window,x=f(i)?window.pageYOffset||document.documentElement.scrollTop:i.scrollTop||0,M=f(i)?document.documentElement.scrollHeight-window.innerHeight:i.scrollHeight-i.clientHeight,F=Ee(t,x,i)+r,w=c(F,0,M),S=Date.now();function v(){let j=Date.now()-S,k=j<n,E=k?ke(x,w,j,n):w;k&&requestAnimationFrame(v),f(i)?window.scrollTo(0,E):i instanceof HTMLElement&&(i.scrollTop=E)}v()}function Oe(e,r){r<0&&console.warn("[tsu] warning: debounce delays less than 0 will be set to 0.");let n;return function(...o){clearTimeout(n),n=setTimeout(()=>{clearTimeout(n),e(...o)},r)}}function C(e){let r={};return function(...n){let o=JSON.stringify(n);if(o in r)return r[o];let t=e(...n);return r[o]=t,t}}var Ae=C;function Ne(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Me(e,r){if(!(r<=0))for(let n=0;n<r;n++)e(n)}function Fe(e,r){r<0&&console.warn("[tsu] warning: throttle limits less than 0 will be set to 0.");let n=!1;return function(...o){n||(e(...o),n=!0,setTimeout(()=>{n=!1},r))}}function Se(){}async function Ue(e){return e<0&&console.warn("[tsu] warning: sleep durations less than 0 are set to 0."),new Promise(r=>{setTimeout(r,e)})}var O="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function Re(e=16){let r=O.length,n=e,o="";for(;n--;)o+=O[u(r)];return o}function A(e,r=!1,n=" "){return r?e.split(n).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(n):e.charAt(0).toUpperCase()+e.slice(1)}var Le=A;function Be(e){return e.split("")}function De(e){return e.trim().length===0}function qe(e){return e.length===0}function He(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function Ie(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function Pe(e){let r=/-(\w)/g;return e.replace(r,(n,o)=>o?o.toUpperCase():"")}function We(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function $e(e){let n=["st","nd","rd"][(Math.abs(e)/10%10^1&&Math.abs(e)%10)-1]||"th";return`${e}${n}`}var N={1:"I",4:"IV",5:"V",9:"IX",10:"X",40:"XL",50:"L",90:"XC",100:"C",400:"CD",500:"D",900:"CM",1e3:"M"};function Ke(e,r=!1){let n=e,o="",t=Object.keys(N).map(Number).sort((i,x)=>x-i);for(let i of t)for(;n>=i;)o+=N[i],n-=i;return r?o.toLowerCase():o}function Xe(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function ze(e){return e.join("")}0&&(module.exports={average,capitalise,capitalize,ceil,chars,clamp,clone,copyToClipboard,debounce,drop,es,floor,groups,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyArray,isEmptyObject,isEven,isFunction,isNull,isNumber,isObject,isObjectLike,isOdd,isString,isTouchDevice,isUndefined,isWindow,ks,last,max,memoise,memoize,min,noop,omit,once,partition,product,randomChance,randomNumber,range,remove,repeat,replaceChar,round,scroll,shuffle,sleep,splitArray,splitString,sum,tail,take,throttle,toArray,toCamel,toDp,toKebab,toNumber,toOrdinal,toRomanNumerals,truncate,unchars,uniq,uuid,vs});
package/dist/index.d.cts CHANGED
@@ -62,6 +62,15 @@ declare function partition<T, U = T>(array: readonly (T | U)[], filter: (current
62
62
  declare function range(stop: number): number[];
63
63
  declare function range(start: number, stop: number, step?: number): number[];
64
64
 
65
+ /**
66
+ * Removes an item from an array.
67
+ *
68
+ * @param array - The array.
69
+ * @param item - The item, or getter function for the item, to remove.
70
+ * @returns The array with the item removed, if found.
71
+ */
72
+ declare function remove<T>(array: T[], itemOrGetter: T | ((item: T) => boolean)): T[];
73
+
65
74
  /**
66
75
  * Randomly shuffles items in an array.
67
76
  *
@@ -168,6 +177,14 @@ declare const memoize: typeof memoise;
168
177
  */
169
178
  declare function once(fn: Fn<void>): Fn<void>;
170
179
 
180
+ /**
181
+ * Executes a given function a specified number of times.
182
+ *
183
+ * @param fn - The function to execute for each iteration.
184
+ * @param n - The number of times to execute the function.
185
+ */
186
+ declare function repeat(fn: (i: number) => void, n: number): void;
187
+
171
188
  /**
172
189
  * Prevents function execution for a specified time period after it was last called.
173
190
  *
@@ -455,6 +472,15 @@ declare function toNumber(str: string, extensions?: string[]): number;
455
472
  */
456
473
  declare function clone<T>(input: T): T;
457
474
 
475
+ /**
476
+ * Creates a shallow copy of an object, omitting the specified keys.
477
+ *
478
+ * @param object - The object to copy.
479
+ * @param keysToOmit - The keys to omit from the copied object.
480
+ * @returns A shallow copy of the object, without the specified keys.
481
+ */
482
+ declare function omit<T extends Record<string, any>, K extends keyof T>(object: T, keysToOmit: K[] | any[]): Pick<T, Exclude<keyof T, K>>;
483
+
458
484
  /**
459
485
  * Strict-typed, shorthand `Object.entries`
460
486
  *
@@ -584,4 +610,4 @@ declare function truncate(str: string, length: number, suffix?: string): string;
584
610
  */
585
611
  declare function unchars(chars: string[]): string;
586
612
 
587
- export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, average, capitalise, capitalize, ceil, chars, clamp, clone, copyToClipboard, debounce, drop, es, floor, groups, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyArray, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isUndefined, isWindow, ks, last, max, memoise, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, replaceChar, round, scroll, shuffle, sleep, splitArray, splitString, sum, tail, take, throttle, toArray, toCamel, toDp, toKebab, toNumber, toOrdinal, toRomanNumerals, truncate, unchars, uniq, uuid, vs };
613
+ export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, average, capitalise, capitalize, ceil, chars, clamp, clone, copyToClipboard, debounce, drop, es, floor, groups, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyArray, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isUndefined, isWindow, ks, last, max, memoise, memoize, min, noop, omit, once, partition, product, randomChance, randomNumber, range, remove, repeat, replaceChar, round, scroll, shuffle, sleep, splitArray, splitString, sum, tail, take, throttle, toArray, toCamel, toDp, toKebab, toNumber, toOrdinal, toRomanNumerals, truncate, unchars, uniq, uuid, vs };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,15 @@ declare function partition<T, U = T>(array: readonly (T | U)[], filter: (current
62
62
  declare function range(stop: number): number[];
63
63
  declare function range(start: number, stop: number, step?: number): number[];
64
64
 
65
+ /**
66
+ * Removes an item from an array.
67
+ *
68
+ * @param array - The array.
69
+ * @param item - The item, or getter function for the item, to remove.
70
+ * @returns The array with the item removed, if found.
71
+ */
72
+ declare function remove<T>(array: T[], itemOrGetter: T | ((item: T) => boolean)): T[];
73
+
65
74
  /**
66
75
  * Randomly shuffles items in an array.
67
76
  *
@@ -168,6 +177,14 @@ declare const memoize: typeof memoise;
168
177
  */
169
178
  declare function once(fn: Fn<void>): Fn<void>;
170
179
 
180
+ /**
181
+ * Executes a given function a specified number of times.
182
+ *
183
+ * @param fn - The function to execute for each iteration.
184
+ * @param n - The number of times to execute the function.
185
+ */
186
+ declare function repeat(fn: (i: number) => void, n: number): void;
187
+
171
188
  /**
172
189
  * Prevents function execution for a specified time period after it was last called.
173
190
  *
@@ -455,6 +472,15 @@ declare function toNumber(str: string, extensions?: string[]): number;
455
472
  */
456
473
  declare function clone<T>(input: T): T;
457
474
 
475
+ /**
476
+ * Creates a shallow copy of an object, omitting the specified keys.
477
+ *
478
+ * @param object - The object to copy.
479
+ * @param keysToOmit - The keys to omit from the copied object.
480
+ * @returns A shallow copy of the object, without the specified keys.
481
+ */
482
+ declare function omit<T extends Record<string, any>, K extends keyof T>(object: T, keysToOmit: K[] | any[]): Pick<T, Exclude<keyof T, K>>;
483
+
458
484
  /**
459
485
  * Strict-typed, shorthand `Object.entries`
460
486
  *
@@ -584,4 +610,4 @@ declare function truncate(str: string, length: number, suffix?: string): string;
584
610
  */
585
611
  declare function unchars(chars: string[]): string;
586
612
 
587
- export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, average, capitalise, capitalize, ceil, chars, clamp, clone, copyToClipboard, debounce, drop, es, floor, groups, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyArray, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isUndefined, isWindow, ks, last, max, memoise, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, replaceChar, round, scroll, shuffle, sleep, splitArray, splitString, sum, tail, take, throttle, toArray, toCamel, toDp, toKebab, toNumber, toOrdinal, toRomanNumerals, truncate, unchars, uniq, uuid, vs };
613
+ export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, average, capitalise, capitalize, ceil, chars, clamp, clone, copyToClipboard, debounce, drop, es, floor, groups, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyArray, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isUndefined, isWindow, ks, last, max, memoise, memoize, min, noop, omit, once, partition, product, randomChance, randomNumber, range, remove, repeat, replaceChar, round, scroll, shuffle, sleep, splitArray, splitString, sum, tail, take, throttle, toArray, toCamel, toDp, toKebab, toNumber, toOrdinal, toRomanNumerals, truncate, unchars, uniq, uuid, vs };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function R(e,r){return r<=0?[...e]:e.slice(r)}function D(e,r){if(r<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(r>=e.length)return[[...e]];let n=[];for(let t=0;t<e.length;t+=r)n.push(e.slice(t,t+r));return n}function H(e){return e[0]}function W(e){return e.slice(0,e.length-1)}function P(e){return e[e.length-1]}function z(e,r){let n=[],t=[];for(let i=0;i<e.length;i++){let o=e[i];r(o,i,e)?n.push(o):t.push(o)}return[n,t]}function V(...e){let r,n,t;e.length===1?(n=e[0],r=0,t=1):(r=e[0],n=e[1],t=e[2]||1),t<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),t=1);let i=[],o=r;for(;o<n;)i.push(o),o+=t||1;return i}function Y(e){return e.length<1?0:w(e)/e.length}function G(e,r=1){let n=e/r;return Math.ceil(n)*r}function l(e,r,n){return Math.min(n,Math.max(r,e))}function re(e,r=1){let n=e/r;return Math.floor(n)*r}function te(e){return e%2===0}function ie(e){return e%2!==0}function fe(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.max(...r)}function le(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.min(...r)}function pe(e){if(e.length<1)return 0;let r=1;for(let n=0;n<e.length;n++)r*=e[n];return r}function u(...e){let r,n;return e.length===1?(r=0,n=e[0]):(r=e[0],n=e[1]),Math.floor(Math.random()*(n-r))+r}function be(e){return u(e)===0}function ge(e,r=1){let n=e/r;return Math.round(n)*r}function w(e){let r=0;for(let n=0;n<e.length;n++)r+=e[n];return r}function we(e,r=0){r<0&&console.warn("[tsu] warning: decimalPlaces less than 0 are set to 0."),r>100&&console.warn("[tsu] warning: decimalPlaces greater than 100 are set to 100.");let n=l(r,0,100);return Number(e.toFixed(n))}function ve(e,r=[]){if(!e.length)return NaN;let n=["#","\xA3","\u20AC","$","%",",",...r],t=new RegExp(`[${n.join("")}]`,"g");return Number(e.replace(t,""))}function s(e){return Array.isArray(e)}function $e(e){return typeof e=="boolean"}function p(){return typeof window<"u"}function ze(e){return typeof e<"u"}function Je(e){return s(e)&&e.length===0}function Ze(e){if(!j(e))return!1;for(let r in e)return!1;return!0}function Qe(e){return typeof e=="function"}function c(e){return Object.prototype.toString.call(e)==="[object Null]"}function v(e){return typeof e=="number"}function j(e){return Object.prototype.toString.call(e)==="[object Object]"}function a(e){return typeof e=="object"}function b(e){return typeof e=="string"}function ur(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function mr(e){return typeof e>"u"}function f(e){return p()&&Object.prototype.toString.call(e)==="[object Window]"}function x(e){if(s(e)){let r=[];for(let n=0;n<e.length;n++)a(e[n])&&!c(e[n])?r[n]=x(e[n]):r[n]=e[n];return r}if(a(e)&&!c(e)){let r={};for(let n in e)a(e[n])&&!c(e[n])?r[n]=x(e[n]):r[n]=e[n];return r}return e}function Mr(e){return Object.entries(e)}function Sr(e){return Object.keys(e)}function Lr(e){return Object.values(e)}function Pr(e){let r=x(e),n,t,i;for(n=r.length;n;n-=1)t=u(n),i=r[n-1],r[n-1]=r[t],r[t]=i;return r}function zr(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function Vr(e){return e.slice(1)}function Kr(e,r){return r<=0?[]:e.slice(0,r)}function Zr(e){return e?Array.isArray(e)?e:[e]:[]}function Qr(e){return Array.from(new Set(e))}function N(e){let r=document.createElement("textarea");r.value=e??"",r.style.position="absolute",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),r.remove()}function gn(e){p()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):N(e))}function M(e){return e<.5?4*Math.pow(e,3):(e-1)*(2*e-2)*(2*e-2)+1}function F(e,r,n,t){return e+(r-e)*M(n/t)}function S(e,r,n){let t;return v(e)?t=e:f(n)?t=e.getBoundingClientRect().top+r:t=e.getBoundingClientRect().top+r-n.getBoundingClientRect().top,t}function wn({to:e,offset:r=0,duration:n=1e3,container:t=null}){let i=b(e)?document.querySelector(e):e,o=b(t)?document.querySelector(t):t||window,m=f(o)?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop||0,C=f(o)?document.documentElement.scrollHeight-window.innerHeight:o.scrollHeight-o.clientHeight,E=S(i,m,o)+r,d=l(E,0,C),A=Date.now();function g(){let T=Date.now()-A,y=T<n,h=y?F(m,d,T,n):d;y&&requestAnimationFrame(g),f(o)?window.scrollTo(0,h):o instanceof HTMLElement&&(o.scrollTop=h)}g()}function Cn(e,r){r<0&&console.warn("[tsu] warning: debounce delays less than 0 will be set to 0.");let n;return function(...t){clearTimeout(n),n=setTimeout(()=>{clearTimeout(n),e(...t)},r)}}function U(e){let r={};return function(...n){let t=JSON.stringify(n);if(t in r)return r[t];let i=e(...n);return r[t]=i,i}}var An=U;function Mn(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Sn(e,r){r<0&&console.warn("[tsu] warning: throttle limits less than 0 will be set to 0.");let n=!1;return function(...t){n||(e(...t),n=!0,setTimeout(()=>{n=!1},r))}}function Hn(){}async function Wn(e){return e<0&&console.warn("[tsu] warning: sleep durations less than 0 are set to 0."),new Promise(r=>{setTimeout(r,e)})}var k="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function Xn(e=16){let r=k.length,n=e,t="";for(;n--;)t+=k[u(r)];return t}function L(e,r=!1,n=" "){return r?e.split(n).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(n):e.charAt(0).toUpperCase()+e.slice(1)}var Yn=L;function Gn(e){return e.split("")}function et(e){return e.trim().length===0}function nt(e){return e.length===0}function ot(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function ut(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function mt(e){let r=/-(\w)/g;return e.replace(r,(n,t)=>t?t.toUpperCase():"")}function st(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function ct(e){let n=["st","nd","rd"][(Math.abs(e)/10%10^1&&Math.abs(e)%10)-1]||"th";return`${e}${n}`}var O={1:"I",4:"IV",5:"V",9:"IX",10:"X",40:"XL",50:"L",90:"XC",100:"C",400:"CD",500:"D",900:"CM",1e3:"M"};function xt(e,r=!1){let n=e,t="",i=Object.keys(O).map(Number).sort((o,m)=>m-o);for(let o of i)for(;n>=o;)t+=O[o],n-=o;return r?t.toLowerCase():t}function dt(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function Tt(e){return e.join("")}export{Y as average,L as capitalise,Yn as capitalize,G as ceil,Gn as chars,l as clamp,x as clone,gn as copyToClipboard,Cn as debounce,R as drop,Mr as es,re as floor,D as groups,H as head,W as init,s as isArray,et as isBlank,$e as isBoolean,p as isBrowser,ze as isDefined,nt as isEmpty,Je as isEmptyArray,Ze as isEmptyObject,te as isEven,Qe as isFunction,c as isNull,v as isNumber,j as isObject,a as isObjectLike,ie as isOdd,b as isString,ur as isTouchDevice,mr as isUndefined,f as isWindow,Sr as ks,P as last,fe as max,U as memoise,An as memoize,le as min,Hn as noop,Mn as once,z as partition,pe as product,be as randomChance,u as randomNumber,V as range,ot as replaceChar,ge as round,wn as scroll,Pr as shuffle,Wn as sleep,zr as splitArray,ut as splitString,w as sum,Vr as tail,Kr as take,Sn as throttle,Zr as toArray,mt as toCamel,we as toDp,st as toKebab,ve as toNumber,ct as toOrdinal,xt as toRomanNumerals,dt as truncate,Tt as unchars,Qr as uniq,Xn as uuid,Lr as vs};
1
+ function B(e,r){return r<=0?[...e]:e.slice(r)}function q(e,r){if(r<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(r>=e.length)return[[...e]];let n=[];for(let o=0;o<e.length;o+=r)n.push(e.slice(o,o+r));return n}function I(e){return e[0]}function W(e){return e.slice(0,e.length-1)}function K(e){return e[e.length-1]}function z(e,r){let n=[],o=[];for(let i=0;i<e.length;i++){let t=e[i];r(t,i,e)?n.push(t):o.push(t)}return[n,o]}function V(...e){let r,n,o;e.length===1?(n=e[0],r=0,o=1):(r=e[0],n=e[1],o=e[2]||1),o<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),o=1);let i=[],t=r;for(;t<n;)i.push(t),t+=o||1;return i}function l(e){return Array.isArray(e)}function Z(e){return typeof e=="boolean"}function s(){return typeof window<"u"}function ee(e){return typeof e<"u"}function oe(e){return l(e)&&e.length===0}function ue(e){if(!w(e))return!1;for(let r in e)return!1;return!0}function v(e){return typeof e=="function"}function p(e){return Object.prototype.toString.call(e)==="[object Null]"}function j(e){return typeof e=="number"}function w(e){return Object.prototype.toString.call(e)==="[object Object]"}function c(e){return typeof e=="object"}function b(e){return typeof e=="string"}function xe(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function de(e){return typeof e>"u"}function f(e){return s()&&Object.prototype.toString.call(e)==="[object Window]"}function De(e,r){let n=v(r)?r:i=>i===r,o=e.findIndex(n);return o!==-1?[...e.slice(0,o),...e.slice(o+1)]:e}function Ie(e){return e.length<1?0:k(e)/e.length}function We(e,r=1){let n=e/r;return Math.ceil(n)*r}function a(e,r,n){return Math.min(n,Math.max(r,e))}function Xe(e,r=1){let n=e/r;return Math.floor(n)*r}function _e(e){return e%2===0}function Je(e){return e%2!==0}function Ze(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.max(...r)}function Ge(...e){let r;return e.length===1&&Array.isArray(e[0])?r=e[0]:r=e,Math.min(...r)}function rr(e){if(e.length<1)return 0;let r=1;for(let n=0;n<e.length;n++)r*=e[n];return r}function u(...e){let r,n;return e.length===1?(r=0,n=e[0]):(r=e[0],n=e[1]),Math.floor(Math.random()*(n-r))+r}function ir(e){return u(e)===0}function fr(e,r=1){let n=e/r;return Math.round(n)*r}function k(e){let r=0;for(let n=0;n<e.length;n++)r+=e[n];return r}function pr(e,r=0){r<0&&console.warn("[tsu] warning: decimalPlaces less than 0 are set to 0."),r>100&&console.warn("[tsu] warning: decimalPlaces greater than 100 are set to 100.");let n=a(r,0,100);return Number(e.toFixed(n))}function ar(e,r=[]){if(!e.length)return NaN;let n=["#","\xA3","\u20AC","$","%",",",...r],o=new RegExp(`[${n.join("")}]`,"g");return Number(e.replace(o,""))}function x(e){if(l(e)){let r=[];for(let n=0;n<e.length;n++)c(e[n])&&!p(e[n])?r[n]=x(e[n]):r[n]=e[n];return r}if(c(e)&&!p(e)){let r={};for(let n in e)c(e[n])&&!p(e[n])?r[n]=x(e[n]):r[n]=e[n];return r}return e}function Ur(e,r){let n={...e};for(let o of r)delete n[o];return n}function Lr(e){return Object.entries(e)}function Dr(e){return Object.keys(e)}function Hr(e){return Object.values(e)}function Jr(e){let r=x(e),n,o,i;for(n=r.length;n;n-=1)o=u(n),i=r[n-1],r[n-1]=r[o],r[o]=i;return r}function Zr(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function Gr(e){return e.slice(1)}function rn(e,r){return r<=0?[]:e.slice(0,r)}function on(e){return e?Array.isArray(e)?e:[e]:[]}function un(e){return Array.from(new Set(e))}function M(e){let r=document.createElement("textarea");r.value=e??"",r.style.position="absolute",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),r.remove()}function kn(e){s()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):M(e))}function F(e){return e<.5?4*Math.pow(e,3):(e-1)*(2*e-2)*(2*e-2)+1}function S(e,r,n,o){return e+(r-e)*F(n/o)}function U(e,r,n){let o;return j(e)?o=e:f(n)?o=e.getBoundingClientRect().top+r:o=e.getBoundingClientRect().top+r-n.getBoundingClientRect().top,o}function An({to:e,offset:r=0,duration:n=1e3,container:o=null}){let i=b(e)?document.querySelector(e):e,t=b(o)?document.querySelector(o):o||window,m=f(t)?window.pageYOffset||document.documentElement.scrollTop:t.scrollTop||0,O=f(t)?document.documentElement.scrollHeight-window.innerHeight:t.scrollHeight-t.clientHeight,A=U(i,m,t)+r,d=a(A,0,O),N=Date.now();function T(){let g=Date.now()-N,y=g<n,h=y?S(m,d,g,n):d;y&&requestAnimationFrame(T),f(t)?window.scrollTo(0,h):t instanceof HTMLElement&&(t.scrollTop=h)}T()}function Un(e,r){r<0&&console.warn("[tsu] warning: debounce delays less than 0 will be set to 0.");let n;return function(...o){clearTimeout(n),n=setTimeout(()=>{clearTimeout(n),e(...o)},r)}}function R(e){let r={};return function(...n){let o=JSON.stringify(n);if(o in r)return r[o];let i=e(...n);return r[o]=i,i}}var Ln=R;function Dn(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Hn(e,r){if(!(r<=0))for(let n=0;n<r;n++)e(n)}function Pn(e,r){r<0&&console.warn("[tsu] warning: throttle limits less than 0 will be set to 0.");let n=!1;return function(...o){n||(e(...o),n=!0,setTimeout(()=>{n=!1},r))}}function Jn(){}async function Zn(e){return e<0&&console.warn("[tsu] warning: sleep durations less than 0 are set to 0."),new Promise(r=>{setTimeout(r,e)})}var E="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function eo(e=16){let r=E.length,n=e,o="";for(;n--;)o+=E[u(r)];return o}function L(e,r=!1,n=" "){return r?e.split(n).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(n):e.charAt(0).toUpperCase()+e.slice(1)}var uo=L;function mo(e){return e.split("")}function so(e){return e.trim().length===0}function co(e){return e.length===0}function xo(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function To(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function yo(e){let r=/-(\w)/g;return e.replace(r,(n,o)=>o?o.toUpperCase():"")}function wo(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function jo(e){let n=["st","nd","rd"][(Math.abs(e)/10%10^1&&Math.abs(e)%10)-1]||"th";return`${e}${n}`}var C={1:"I",4:"IV",5:"V",9:"IX",10:"X",40:"XL",50:"L",90:"XC",100:"C",400:"CD",500:"D",900:"CM",1e3:"M"};function Eo(e,r=!1){let n=e,o="",i=Object.keys(C).map(Number).sort((t,m)=>m-t);for(let t of i)for(;n>=t;)o+=C[t],n-=t;return r?o.toLowerCase():o}function Oo(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function No(e){return e.join("")}export{Ie as average,L as capitalise,uo as capitalize,We as ceil,mo as chars,a as clamp,x as clone,kn as copyToClipboard,Un as debounce,B as drop,Lr as es,Xe as floor,q as groups,I as head,W as init,l as isArray,so as isBlank,Z as isBoolean,s as isBrowser,ee as isDefined,co as isEmpty,oe as isEmptyArray,ue as isEmptyObject,_e as isEven,v as isFunction,p as isNull,j as isNumber,w as isObject,c as isObjectLike,Je as isOdd,b as isString,xe as isTouchDevice,de as isUndefined,f as isWindow,Dr as ks,K as last,Ze as max,R as memoise,Ln as memoize,Ge as min,Jn as noop,Ur as omit,Dn as once,z as partition,rr as product,ir as randomChance,u as randomNumber,V as range,De as remove,Hn as repeat,xo as replaceChar,fr as round,An as scroll,Jr as shuffle,Zn as sleep,Zr as splitArray,To as splitString,k as sum,Gr as tail,rn as take,Pn as throttle,on as toArray,yo as toCamel,pr as toDp,wo as toKebab,ar as toNumber,jo as toOrdinal,Eo as toRomanNumerals,Oo as truncate,No as unchars,un as uniq,eo as uuid,Hr as vs};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsu",
3
- "version": "2.11.1",
3
+ "version": "2.13.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript utilities",
6
6
  "license": "MIT",
@@ -10,9 +10,9 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
+ "types": "./dist/index.d.ts",
13
14
  "import": "./dist/index.js",
14
- "require": "./dist/index.cjs",
15
- "types": "./dist/index.d.ts"
15
+ "require": "./dist/index.cjs"
16
16
  }
17
17
  },
18
18
  "files": [
@@ -30,22 +30,25 @@
30
30
  "watch": "nr build --watch src",
31
31
  "test": "vitest run",
32
32
  "test:watch": "vitest watch",
33
+ "lint": "eslint 'src/**/*.{ts,tsx}'",
34
+ "lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
33
35
  "docs:dev": "vitepress dev docs --port 8888",
34
36
  "docs:build": "vitepress build docs",
35
37
  "prepublishOnly": "nr test; nr build"
36
38
  },
37
39
  "devDependencies": {
38
- "@antfu/ni": "^0.21.12",
39
- "@typescript-eslint/eslint-plugin": "^7.4.0",
40
- "@typescript-eslint/parser": "^7.4.0",
41
- "eslint": "^8.57.0",
42
- "eslint-config-prettier": "^9.1.0",
43
- "eslint-plugin-prettier": "^5.1.3",
44
- "prettier": "^3.2.5",
45
- "tsup": "^8.0.2",
46
- "typescript": "^5.4.3",
47
- "vite": "^5.2.6",
48
- "vitepress": "^1.0.1",
49
- "vitest": "^1.4.0"
40
+ "@antfu/ni": "^28.2.0",
41
+ "@eslint/js": "^9.39.2",
42
+ "@types/node": "^25.2.0",
43
+ "eslint": "^9.39.2",
44
+ "eslint-config-prettier": "^10.1.8",
45
+ "jiti": "^2.6.1",
46
+ "prettier": "^3.8.1",
47
+ "tsup": "^8.5.1",
48
+ "typescript": "^5.9.3",
49
+ "typescript-eslint": "^8.54.0",
50
+ "vite": "^7.3.1",
51
+ "vitepress": "^1.6.4",
52
+ "vitest": "^4.0.18"
50
53
  }
51
54
  }