tsu 2.11.0 → 2.12.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 +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var L=(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))!R.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 ze={};L(ze,{average:()=>X,capitalise:()=>C,capitalize:()=>Re,ceil:()=>z,chars:()=>Le,clamp:()=>m,clone:()=>a,copyToClipboard:()=>we,debounce:()=>Ee,drop:()=>q,es:()=>pe,floor:()=>_,groups:()=>H,head:()=>I,init:()=>P,isArray:()=>l,isBlank:()=>Be,isBoolean:()=>te,isBrowser:()=>s,isDefined:()=>oe,isEmpty:()=>De,isEmptyArray:()=>ie,isEmptyObject:()=>ue,isEven:()=>V,isFunction:()=>fe,isNull:()=>p,isNumber:()=>y,isObject:()=>g,isObjectLike:()=>c,isOdd:()=>J,isString:()=>b,isTouchDevice:()=>me,isUndefined:()=>le,isWindow:()=>f,ks:()=>ce,last:()=>W,max:()=>Y,memoise:()=>O,memoize:()=>Ce,min:()=>Z,noop:()=>Fe,omit:()=>se,once:()=>Ae,partition:()=>$,product:()=>G,randomChance:()=>Q,randomNumber:()=>u,range:()=>K,repeat:()=>Ne,replaceChar:()=>qe,round:()=>ee,scroll:()=>Oe,shuffle:()=>xe,sleep:()=>Se,splitArray:()=>be,splitString:()=>He,sum:()=>T,tail:()=>de,take:()=>Te,throttle:()=>Me,toArray:()=>ge,toCamel:()=>Ie,toDp:()=>re,toKebab:()=>Pe,toNumber:()=>ne,toOrdinal:()=>We,toRomanNumerals:()=>$e,truncate:()=>Ke,unchars:()=>Xe,uniq:()=>ye,uuid:()=>Ue,vs:()=>ae});module.exports=D(ze);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 P(e){return e.slice(0,e.length-1)}function W(e){return e[e.length-1]}function $(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 K(...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 X(e){return e.length<1?0:T(e)/e.length}function z(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 _(e,r=1){let n=e/r;return Math.floor(n)*r}function V(e){return e%2===0}function J(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 T(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(!g(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 g(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,r){let n={...e};for(let t of r)delete n[t];return n}function pe(e){return Object.entries(e)}function ce(e){return Object.keys(e)}function ae(e){return Object.values(e)}function xe(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 be(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function de(e){return e.slice(1)}function Te(e,r){return r<=0?[]:e.slice(0,r)}function ge(e){return e?Array.isArray(e)?e:[e]:[]}function ye(e){return Array.from(new Set(e))}function he(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 we(e){s()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):he(e))}function ve(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)*ve(n/t)}function ke(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 Oe({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=ke(o,x,i)+r,h=m(M,0,N),F=Date.now();function w(){let v=Date.now()-F,j=v<n,k=j?je(x,h,v,n):h;j&&requestAnimationFrame(w),f(i)?window.scrollTo(0,k):i instanceof HTMLElement&&(i.scrollTop=k)}w()}function Ee(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 Ae(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Ne(e,r){if(!(r<=0))for(let n=0;n<r;n++)e(n)}function Me(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 Fe(){}async function Se(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 Ue(e=16){let r=E.length,n=e,t="";for(;n--;)t+=E[u(r)];return t}function C(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 Re=C;function Le(e){return e.split("")}function Be(e){return e.trim().length===0}function De(e){return e.length===0}function qe(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function He(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function Ie(e){let r=/-(\w)/g;return e.replace(r,(n,t)=>t?t.toUpperCase():"")}function Pe(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function We(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 $e(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 Ke(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function Xe(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,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
|
@@ -168,6 +168,14 @@ declare const memoize: typeof memoise;
|
|
|
168
168
|
*/
|
|
169
169
|
declare function once(fn: Fn<void>): Fn<void>;
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Executes a given function a specified number of times.
|
|
173
|
+
*
|
|
174
|
+
* @param fn - The function to execute for each iteration.
|
|
175
|
+
* @param n - The number of times to execute the function.
|
|
176
|
+
*/
|
|
177
|
+
declare function repeat(fn: (i: number) => void, n: number): void;
|
|
178
|
+
|
|
171
179
|
/**
|
|
172
180
|
* Prevents function execution for a specified time period after it was last called.
|
|
173
181
|
*
|
|
@@ -455,6 +463,15 @@ declare function toNumber(str: string, extensions?: string[]): number;
|
|
|
455
463
|
*/
|
|
456
464
|
declare function clone<T>(input: T): T;
|
|
457
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Creates a shallow copy of an object, omitting the specified keys.
|
|
468
|
+
*
|
|
469
|
+
* @param object - The object to copy.
|
|
470
|
+
* @param keysToOmit - The keys to omit from the copied object.
|
|
471
|
+
* @returns A shallow copy of the object, without the specified keys.
|
|
472
|
+
*/
|
|
473
|
+
declare function omit<T extends Record<string, any>, K extends keyof T>(object: T, keysToOmit: K[] | any[]): Pick<T, Exclude<keyof T, K>>;
|
|
474
|
+
|
|
458
475
|
/**
|
|
459
476
|
* Strict-typed, shorthand `Object.entries`
|
|
460
477
|
*
|
|
@@ -584,4 +601,4 @@ declare function truncate(str: string, length: number, suffix?: string): string;
|
|
|
584
601
|
*/
|
|
585
602
|
declare function unchars(chars: string[]): string;
|
|
586
603
|
|
|
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 };
|
|
604
|
+
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, 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
|
@@ -168,6 +168,14 @@ declare const memoize: typeof memoise;
|
|
|
168
168
|
*/
|
|
169
169
|
declare function once(fn: Fn<void>): Fn<void>;
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Executes a given function a specified number of times.
|
|
173
|
+
*
|
|
174
|
+
* @param fn - The function to execute for each iteration.
|
|
175
|
+
* @param n - The number of times to execute the function.
|
|
176
|
+
*/
|
|
177
|
+
declare function repeat(fn: (i: number) => void, n: number): void;
|
|
178
|
+
|
|
171
179
|
/**
|
|
172
180
|
* Prevents function execution for a specified time period after it was last called.
|
|
173
181
|
*
|
|
@@ -455,6 +463,15 @@ declare function toNumber(str: string, extensions?: string[]): number;
|
|
|
455
463
|
*/
|
|
456
464
|
declare function clone<T>(input: T): T;
|
|
457
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Creates a shallow copy of an object, omitting the specified keys.
|
|
468
|
+
*
|
|
469
|
+
* @param object - The object to copy.
|
|
470
|
+
* @param keysToOmit - The keys to omit from the copied object.
|
|
471
|
+
* @returns A shallow copy of the object, without the specified keys.
|
|
472
|
+
*/
|
|
473
|
+
declare function omit<T extends Record<string, any>, K extends keyof T>(object: T, keysToOmit: K[] | any[]): Pick<T, Exclude<keyof T, K>>;
|
|
474
|
+
|
|
458
475
|
/**
|
|
459
476
|
* Strict-typed, shorthand `Object.entries`
|
|
460
477
|
*
|
|
@@ -584,4 +601,4 @@ declare function truncate(str: string, length: number, suffix?: string): string;
|
|
|
584
601
|
*/
|
|
585
602
|
declare function unchars(chars: string[]): string;
|
|
586
603
|
|
|
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 };
|
|
604
|
+
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, 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
|
|
1
|
+
function L(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 P(e){return e.slice(0,e.length-1)}function $(e){return e[e.length-1]}function X(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 _(...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 Te(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 je(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 We(e){return typeof e=="boolean"}function p(){return typeof window<"u"}function Xe(e){return typeof e<"u"}function Ve(e){return s(e)&&e.length===0}function Ze(e){if(!v(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 j(e){return typeof e=="number"}function v(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,r){let n={...e};for(let t of r)delete n[t];return n}function Sr(e){return Object.entries(e)}function Rr(e){return Object.keys(e)}function Br(e){return Object.values(e)}function zr(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 Vr(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function Yr(e){return e.slice(1)}function Gr(e,r){return r<=0?[]:e.slice(0,r)}function en(e){return e?Array.isArray(e)?e:[e]:[]}function nn(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 hn(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 j(e)?t=e:f(n)?t=e.getBoundingClientRect().top+r:t=e.getBoundingClientRect().top+r-n.getBoundingClientRect().top,t}function kn({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,E=f(o)?document.documentElement.scrollHeight-window.innerHeight:o.scrollHeight-o.clientHeight,C=S(i,m,o)+r,d=l(C,0,E),A=Date.now();function T(){let g=Date.now()-A,y=g<n,h=y?F(m,d,g,n):d;y&&requestAnimationFrame(T),f(o)?window.scrollTo(0,h):o instanceof HTMLElement&&(o.scrollTop=h)}T()}function Nn(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 Fn=U;function Un(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Ln(e,r){if(!(r<=0))for(let n=0;n<r;n++)e(n)}function Dn(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 Xn(){}async function _n(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 Yn(e=16){let r=k.length,n=e,t="";for(;n--;)t+=k[u(r)];return t}function R(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 nt=R;function ot(e){return e.split("")}function ut(e){return e.trim().length===0}function mt(e){return e.length===0}function st(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function ct(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function xt(e){let r=/-(\w)/g;return e.replace(r,(n,t)=>t?t.toUpperCase():"")}function dt(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function gt(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 ht(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 vt(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function kt(e){return e.join("")}export{Y as average,R as capitalise,nt as capitalize,G as ceil,ot as chars,l as clamp,x as clone,hn as copyToClipboard,Nn as debounce,L as drop,Sr as es,re as floor,D as groups,H as head,P as init,s as isArray,ut as isBlank,We as isBoolean,p as isBrowser,Xe as isDefined,mt as isEmpty,Ve as isEmptyArray,Ze as isEmptyObject,te as isEven,Qe as isFunction,c as isNull,j as isNumber,v as isObject,a as isObjectLike,ie as isOdd,b as isString,ur as isTouchDevice,mr as isUndefined,f as isWindow,Rr as ks,$ as last,fe as max,U as memoise,Fn as memoize,le as min,Xn as noop,Mr as omit,Un as once,X as partition,pe as product,be as randomChance,u as randomNumber,_ as range,Ln as repeat,st as replaceChar,Te as round,kn as scroll,zr as shuffle,_n as sleep,Vr as splitArray,ct as splitString,w as sum,Yr as tail,Gr as take,Dn as throttle,en as toArray,xt as toCamel,we as toDp,dt as toKebab,je as toNumber,gt as toOrdinal,ht as toRomanNumerals,vt as truncate,kt as unchars,nn as uniq,Yn as uuid,Br as vs};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsu",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.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": [
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"prepublishOnly": "nr test; nr build"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@antfu/ni": "^
|
|
38
|
+
"@antfu/ni": "^23.3.0",
|
|
39
39
|
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
40
40
|
"@typescript-eslint/parser": "^7.4.0",
|
|
41
41
|
"eslint": "^8.57.0",
|
|
42
42
|
"eslint-config-prettier": "^9.1.0",
|
|
43
43
|
"eslint-plugin-prettier": "^5.1.3",
|
|
44
44
|
"prettier": "^3.2.5",
|
|
45
|
-
"tsup": "^8.
|
|
46
|
-
"typescript": "^5.
|
|
47
|
-
"vite": "^
|
|
48
|
-
"vitepress": "^1.
|
|
49
|
-
"vitest": "^
|
|
45
|
+
"tsup": "^8.3.6",
|
|
46
|
+
"typescript": "^5.7.3",
|
|
47
|
+
"vite": "^6.0.11",
|
|
48
|
+
"vitepress": "^1.6.3",
|
|
49
|
+
"vitest": "^3.0.4"
|
|
50
50
|
}
|
|
51
51
|
}
|