tsu 2.12.0 → 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 +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -1
- package/package.json +16 -13
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var
|
|
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
|
*
|
|
@@ -601,4 +610,4 @@ declare function truncate(str: string, length: number, suffix?: string): string;
|
|
|
601
610
|
*/
|
|
602
611
|
declare function unchars(chars: string[]): string;
|
|
603
612
|
|
|
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 };
|
|
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
|
*
|
|
@@ -601,4 +610,4 @@ declare function truncate(str: string, length: number, suffix?: string): string;
|
|
|
601
610
|
*/
|
|
602
611
|
declare function unchars(chars: string[]): string;
|
|
603
612
|
|
|
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 };
|
|
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
|
|
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.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript utilities",
|
|
6
6
|
"license": "MIT",
|
|
@@ -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": "^
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"eslint-config-prettier": "^
|
|
43
|
-
"
|
|
44
|
-
"prettier": "^3.
|
|
45
|
-
"tsup": "^8.
|
|
46
|
-
"typescript": "^5.
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
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
|
}
|