tsu 1.2.1 → 1.3.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 l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var E=(n,e)=>{for(var t in e)l(n,t,{get:e[t],enumerable:!0})},F=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of O(e))!j.call(n,o)&&o!==t&&l(n,o,{get:()=>e[o],enumerable:!(r=v(e,o))||r.enumerable});return n};var N=n=>F(l({},"__esModule",{value:!0}),n);var xn={};E(xn,{capitalise:()=>fn,chars:()=>cn,debounce:()=>W,deepMerge:()=>w,drop:()=>A,groupsOf:()=>S,head:()=>M,init:()=>C,isArray:()=>f,isBlank:()=>ln,isBoolean:()=>z,isBrowser:()=>g,isDefined:()=>J,isEmpty:()=>pn,isEmptyObject:()=>K,isEven:()=>G,isFunction:()=>Y,isNumber:()=>m,isObject:()=>u,isOdd:()=>Q,isString:()=>c,isTouchDevice:()=>Z,isWindow:()=>_,last:()=>U,max:()=>I,memoize:()=>$,min:()=>q,modulo:()=>X,noop:()=>en,once:()=>k,partition:()=>B,randomChance:()=>nn,randomNumber:()=>h,scroll:()=>rn,sleep:()=>tn,splitAt:()=>D,sum:()=>R,tail:()=>L,take:()=>P,throttle:()=>H,toArray:()=>V,toCamel:()=>mn,toKebab:()=>an,toNumber:()=>bn,toOrdinal:()=>Tn,truncate:()=>dn,uniq:()=>p});module.exports=N(xn);function A(n,e){return n<=0?[...e]:e.slice(n)}function S(n,e){if(n<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(n>=e.length)return[[...e]];let t=[];for(let r=0;r<e.length;r+=n)t.push(e.slice(r,r+n));return t}function M(n){return n[0]}function C(n){return n.slice(0,n.length-1)}function U(n){return n[n.length-1]}function I(n){if(!!n.length)return Math.max(...n)}function q(n){if(!!n.length)return Math.min(...n)}function B(n,e){return e.reduce(([t,r],o,i,s)=>n(o,i,s)?[[...t,o],r]:[t,[...r,o]],[[],[]])}function D(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function R(n){return n.length?n.reduce((e,t)=>e+t,0):0}function L(n){return n.slice(1)}function P(n,e){return n<=0?[]:e.slice(0,n)}function V(n){return n?Array.isArray(n)?n:[n]:[]}function p(n){return Array.from(new Set(n))}function W(n,e){let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),n(...r)},e)}}function $(n){let e={};return function(...t){let r=JSON.stringify(t);if(r in e)return e[r];let o=n(...t);return e[r]=o,o}}function k(n){let e=!1;return(...t)=>{e||(n(...t),e=!0)}}function H(n,e){let t=!1;return function(...r){t||(n(...r),t=!0,setTimeout(()=>{t=!1},e))}}function f(n){return Array.isArray(n)}function z(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function J(n){return typeof n<"u"}function K(n){if(!u(n))return!1;for(let e in n)return!1;return!0}function Y(n){return typeof n=="function"}function m(n){return typeof n=="number"}function u(n){return Object.prototype.toString.call(n)==="[object Object]"}function c(n){return typeof n=="string"}function Z(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function _(n){return g()&&toString.call(n)==="[object Window]"}function G(n){return n%2===0}function Q(n){return n%2!==0}function X(n,e){return n-Math.floor(n/e)*e}function h(n,e=0){return Math.floor(Math.random()*(n-e))+e}function nn(n){return h(n)===0}function en(){}async function tn(n){return new Promise(e=>setTimeout(e,n))}function w(...n){return n.reduce((e,t)=>(Object.keys(t).forEach(r=>{f(e[r])&&f(t[r])?e[r]=p(e[r].concat(t[r])):u(e[r])&&u(t[r])?e[r]=w(e[r],t[r]):e[r]=t[r]}),e),{})}function rn({to:n,offset:e=0,duration:t=1e3,container:r=null}){let o=c(n)?document.querySelector(n):n,i=c(r)?document.querySelector(r):r,s=(i==null?void 0:i.scrollTop)||(window==null?void 0:window.pageYOffset)||0,a=(m(o)?o:sn(o,s))+e,y=Date.now();function b(){let T=Date.now()-y,d=T<t,x=d?un(s,a,T,t):a;d&&requestAnimationFrame(b),i?i.scrollTop=x:window.scrollTo(0,x)}b()}function on(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function un(n,e,t,r){return n+(e-n)*on(t/r)}function sn(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function fn(n,e=!1,t=" "){return e?n.split(t).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(t):n.charAt(0).toUpperCase()+n.slice(1)}function cn(n){return n.split("")}function ln(n){return n.trim().length===0}function pn(n){return n.length===0}function mn(n){let e=/-(\w)/g;return n.replace(e,(t,r)=>r?r.toUpperCase():"")}function an(n){let e=/\B([A-Z])/g;return n.replace(e,"-$1").toLowerCase()}function bn(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function Tn(n){if(typeof n=="string"&&(n.trim()===""||isNaN(parseFloat(n))))throw new Error("[tsu] invalid string. Does it contain only a number?");let r=["st","nd","rd"][(Number(n)/10%10^1&&Number(n)%10)-1]||"th";return`${n}${r}`}function dn(n,e,t="..."){return e<=0?t:n.slice(0,e)+t}0&&(module.exports={capitalise,chars,debounce,deepMerge,drop,groupsOf,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyObject,isEven,isFunction,isNumber,isObject,isOdd,isString,isTouchDevice,isWindow,last,max,memoize,min,modulo,noop,once,partition,randomChance,randomNumber,scroll,sleep,splitAt,sum,tail,take,throttle,toArray,toCamel,toKebab,toNumber,toOrdinal,truncate,uniq});
1
+ "use strict";var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var j=(n,e)=>{for(var t in e)l(n,t,{get:e[t],enumerable:!0})},E=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of O(e))!F.call(n,o)&&o!==t&&l(n,o,{get:()=>e[o],enumerable:!(r=v(e,o))||r.enumerable});return n};var N=n=>E(l({},"__esModule",{value:!0}),n);var gn={};j(gn,{capitalise:()=>cn,chars:()=>ln,debounce:()=>W,deepMerge:()=>w,delay:()=>$,drop:()=>A,groupsOf:()=>S,head:()=>M,init:()=>C,isArray:()=>f,isBlank:()=>pn,isBoolean:()=>J,isBrowser:()=>g,isDefined:()=>K,isEmpty:()=>mn,isEmptyObject:()=>Y,isEven:()=>Q,isFunction:()=>Z,isNumber:()=>m,isObject:()=>u,isOdd:()=>X,isString:()=>c,isTouchDevice:()=>_,isWindow:()=>G,last:()=>U,max:()=>I,memoize:()=>k,min:()=>q,modulo:()=>nn,noop:()=>tn,once:()=>H,partition:()=>B,randomChance:()=>en,randomNumber:()=>h,scroll:()=>on,sleep:()=>rn,splitAt:()=>D,sum:()=>R,tail:()=>L,take:()=>P,throttle:()=>z,toArray:()=>V,toCamel:()=>an,toKebab:()=>bn,toNumber:()=>Tn,toOrdinal:()=>dn,truncate:()=>xn,uniq:()=>p});module.exports=N(gn);function A(n,e){return n<=0?[...e]:e.slice(n)}function S(n,e){if(n<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(n>=e.length)return[[...e]];let t=[];for(let r=0;r<e.length;r+=n)t.push(e.slice(r,r+n));return t}function M(n){return n[0]}function C(n){return n.slice(0,n.length-1)}function U(n){return n[n.length-1]}function I(n){if(!!n.length)return Math.max(...n)}function q(n){if(!!n.length)return Math.min(...n)}function B(n,e){return e.reduce(([t,r],o,i,s)=>n(o,i,s)?[[...t,o],r]:[t,[...r,o]],[[],[]])}function D(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function R(n){return n.length?n.reduce((e,t)=>e+t,0):0}function L(n){return n.slice(1)}function P(n,e){return n<=0?[]:e.slice(0,n)}function V(n){return n?Array.isArray(n)?n:[n]:[]}function p(n){return Array.from(new Set(n))}function W(n,e){let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),n(...r)},e)}}function $(n,e){setTimeout(()=>{n()},e)}function k(n){let e={};return function(...t){let r=JSON.stringify(t);if(r in e)return e[r];let o=n(...t);return e[r]=o,o}}function H(n){let e=!1;return(...t)=>{e||(n(...t),e=!0)}}function z(n,e){let t=!1;return function(...r){t||(n(...r),t=!0,setTimeout(()=>{t=!1},e))}}function f(n){return Array.isArray(n)}function J(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function K(n){return typeof n<"u"}function Y(n){if(!u(n))return!1;for(let e in n)return!1;return!0}function Z(n){return typeof n=="function"}function m(n){return typeof n=="number"}function u(n){return Object.prototype.toString.call(n)==="[object Object]"}function c(n){return typeof n=="string"}function _(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function G(n){return g()&&toString.call(n)==="[object Window]"}function Q(n){return n%2===0}function X(n){return n%2!==0}function nn(n,e){return n-Math.floor(n/e)*e}function h(n,e=0){return Math.floor(Math.random()*(n-e))+e}function en(n){return h(n)===0}function tn(){}async function rn(n){return new Promise(e=>setTimeout(e,n))}function w(...n){return n.reduce((e,t)=>(Object.keys(t).forEach(r=>{f(e[r])&&f(t[r])?e[r]=p(e[r].concat(t[r])):u(e[r])&&u(t[r])?e[r]=w(e[r],t[r]):e[r]=t[r]}),e),{})}function on({to:n,offset:e=0,duration:t=1e3,container:r=null}){let o=c(n)?document.querySelector(n):n,i=c(r)?document.querySelector(r):r,s=(i==null?void 0:i.scrollTop)||(window==null?void 0:window.pageYOffset)||0,a=(m(o)?o:fn(o,s))+e,y=Date.now();function b(){let T=Date.now()-y,d=T<t,x=d?sn(s,a,T,t):a;d&&requestAnimationFrame(b),i?i.scrollTop=x:window.scrollTo(0,x)}b()}function un(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function sn(n,e,t,r){return n+(e-n)*un(t/r)}function fn(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function cn(n,e=!1,t=" "){return e?n.split(t).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(t):n.charAt(0).toUpperCase()+n.slice(1)}function ln(n){return n.split("")}function pn(n){return n.trim().length===0}function mn(n){return n.length===0}function an(n){let e=/-(\w)/g;return n.replace(e,(t,r)=>r?r.toUpperCase():"")}function bn(n){let e=/\B([A-Z])/g;return n.replace(e,"-$1").toLowerCase()}function Tn(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function dn(n){if(typeof n=="string"&&(n.trim()===""||isNaN(parseFloat(n))))throw new Error("[tsu] invalid string. Does it contain only a number?");let r=["st","nd","rd"][(Number(n)/10%10^1&&Number(n)%10)-1]||"th";return`${n}${r}`}function xn(n,e,t="..."){return e<=0?t:n.slice(0,e)+t}0&&(module.exports={capitalise,chars,debounce,deepMerge,delay,drop,groupsOf,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyObject,isEven,isFunction,isNumber,isObject,isOdd,isString,isTouchDevice,isWindow,last,max,memoize,min,modulo,noop,once,partition,randomChance,randomNumber,scroll,sleep,splitAt,sum,tail,take,throttle,toArray,toCamel,toKebab,toNumber,toOrdinal,truncate,uniq});
package/dist/index.d.ts CHANGED
@@ -109,13 +109,20 @@ declare function toArray<T>(maybeArray: Nullable<Arrayable<T>>): T[];
109
109
  declare function uniq<T>(array: readonly T[]): T[];
110
110
 
111
111
  /**
112
- * Prevents a function from running until it hasn't been called for a certain time period.
112
+ * Prevents function execution until it hasn't been called for a stated time period.
113
113
  *
114
114
  * @param fn - The function.
115
115
  * @param delay - The time period (in ms).
116
116
  * @returns The debounced function.
117
117
  */
118
118
  declare function debounce(fn: Fn, delay: number): VoidFn;
119
+ /**
120
+ * Delays function execution until after a stated time period has passed.
121
+ *
122
+ * @param fn - The function.
123
+ * @param delay - The time period (in ms).
124
+ */
125
+ declare function delay(fn: Fn, delay: number): void;
119
126
  /**
120
127
  * Optimises subsequent calls of a function by caching return values.
121
128
  *
@@ -131,7 +138,7 @@ declare function memoize<T>(fn: Fn<T>): Fn<T>;
131
138
  */
132
139
  declare function once(fn: Fn): VoidFn;
133
140
  /**
134
- * Prevents a function from running for some time period after it was last called.
141
+ * Prevents function execution for a stated time period after it was last called.
135
142
  *
136
143
  * @param fn - The function.
137
144
  * @param limit - The time period.
@@ -260,9 +267,9 @@ declare function randomChance(n: number): boolean;
260
267
  */
261
268
  declare function noop(): void;
262
269
  /**
263
- * Halts program execution for a specified time.
270
+ * Halts thread execution for a stated time period.
264
271
  *
265
- * @param duration - The time to wait (in ms).
272
+ * @param duration - The time period (in ms).
266
273
  * @returns The halting promise.
267
274
  */
268
275
  declare function sleep(duration: number): Promise<void>;
@@ -361,4 +368,4 @@ declare function toOrdinal(n: number | string): string;
361
368
  */
362
369
  declare function truncate(str: string, length: number, truncateStr?: string): string;
363
370
 
364
- export { Arrayable, Fn, Nullable, Obj, VoidFn, capitalise, chars, debounce, deepMerge, drop, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNumber, isObject, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, modulo, noop, once, partition, randomChance, randomNumber, scroll, sleep, splitAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq };
371
+ export { Arrayable, Fn, Nullable, Obj, VoidFn, capitalise, chars, debounce, deepMerge, delay, drop, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNumber, isObject, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, modulo, noop, once, partition, randomChance, randomNumber, scroll, sleep, splitAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function j(n,e){return n<=0?[...e]:e.slice(n)}function E(n,e){if(n<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(n>=e.length)return[[...e]];let r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function F(n){return n[0]}function N(n){return n.slice(0,n.length-1)}function A(n){return n[n.length-1]}function S(n){if(!!n.length)return Math.max(...n)}function M(n){if(!!n.length)return Math.min(...n)}function C(n,e){return e.reduce(([r,t],o,i,u)=>n(o,i,u)?[[...r,o],t]:[r,[...t,o]],[[],[]])}function U(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function I(n){return n.length?n.reduce((e,r)=>e+r,0):0}function q(n){return n.slice(1)}function B(n,e){return n<=0?[]:e.slice(0,n)}function D(n){return n?Array.isArray(n)?n:[n]:[]}function T(n){return Array.from(new Set(n))}function L(n,e){let r;return function(...t){clearTimeout(r),r=setTimeout(()=>{clearTimeout(r),n(...t)},e)}}function P(n){let e={};return function(...r){let t=JSON.stringify(r);if(t in e)return e[t];let o=n(...r);return e[t]=o,o}}function V(n){let e=!1;return(...r)=>{e||(n(...r),e=!0)}}function W(n,e){let r=!1;return function(...t){r||(n(...t),r=!0,setTimeout(()=>{r=!1},e))}}function f(n){return Array.isArray(n)}function k(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function H(n){return typeof n<"u"}function z(n){if(!s(n))return!1;for(let e in n)return!1;return!0}function J(n){return typeof n=="function"}function d(n){return typeof n=="number"}function s(n){return Object.prototype.toString.call(n)==="[object Object]"}function c(n){return typeof n=="string"}function K(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function Y(n){return g()&&toString.call(n)==="[object Window]"}function _(n){return n%2===0}function G(n){return n%2!==0}function Q(n,e){return n-Math.floor(n/e)*e}function h(n,e=0){return Math.floor(Math.random()*(n-e))+e}function X(n){return h(n)===0}function en(){}async function tn(n){return new Promise(e=>setTimeout(e,n))}function w(...n){return n.reduce((e,r)=>(Object.keys(r).forEach(t=>{f(e[t])&&f(r[t])?e[t]=T(e[t].concat(r[t])):s(e[t])&&s(r[t])?e[t]=w(e[t],r[t]):e[t]=r[t]}),e),{})}function cn({to:n,offset:e=0,duration:r=1e3,container:t=null}){let o=c(n)?document.querySelector(n):n,i=c(t)?document.querySelector(t):t,u=(i==null?void 0:i.scrollTop)||(window==null?void 0:window.pageYOffset)||0,l=(d(o)?o:O(o,u))+e,x=Date.now();function p(){let m=Date.now()-x,a=m<r,b=a?v(u,l,m,r):l;a&&requestAnimationFrame(p),i?i.scrollTop=b:window.scrollTo(0,b)}p()}function y(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function v(n,e,r,t){return n+(e-n)*y(r/t)}function O(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function pn(n,e=!1,r=" "){return e?n.split(r).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(r):n.charAt(0).toUpperCase()+n.slice(1)}function mn(n){return n.split("")}function an(n){return n.trim().length===0}function bn(n){return n.length===0}function Tn(n){let e=/-(\w)/g;return n.replace(e,(r,t)=>t?t.toUpperCase():"")}function dn(n){let e=/\B([A-Z])/g;return n.replace(e,"-$1").toLowerCase()}function xn(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function gn(n){if(typeof n=="string"&&(n.trim()===""||isNaN(parseFloat(n))))throw new Error("[tsu] invalid string. Does it contain only a number?");let t=["st","nd","rd"][(Number(n)/10%10^1&&Number(n)%10)-1]||"th";return`${n}${t}`}function hn(n,e,r="..."){return e<=0?r:n.slice(0,e)+r}export{pn as capitalise,mn as chars,L as debounce,w as deepMerge,j as drop,E as groupsOf,F as head,N as init,f as isArray,an as isBlank,k as isBoolean,g as isBrowser,H as isDefined,bn as isEmpty,z as isEmptyObject,_ as isEven,J as isFunction,d as isNumber,s as isObject,G as isOdd,c as isString,K as isTouchDevice,Y as isWindow,A as last,S as max,P as memoize,M as min,Q as modulo,en as noop,V as once,C as partition,X as randomChance,h as randomNumber,cn as scroll,tn as sleep,U as splitAt,I as sum,q as tail,B as take,W as throttle,D as toArray,Tn as toCamel,dn as toKebab,xn as toNumber,gn as toOrdinal,hn as truncate,T as uniq};
1
+ function F(n,e){return n<=0?[...e]:e.slice(n)}function j(n,e){if(n<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(n>=e.length)return[[...e]];let r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function E(n){return n[0]}function N(n){return n.slice(0,n.length-1)}function A(n){return n[n.length-1]}function S(n){if(!!n.length)return Math.max(...n)}function M(n){if(!!n.length)return Math.min(...n)}function C(n,e){return e.reduce(([r,t],o,i,u)=>n(o,i,u)?[[...r,o],t]:[r,[...t,o]],[[],[]])}function U(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function I(n){return n.length?n.reduce((e,r)=>e+r,0):0}function q(n){return n.slice(1)}function B(n,e){return n<=0?[]:e.slice(0,n)}function D(n){return n?Array.isArray(n)?n:[n]:[]}function T(n){return Array.from(new Set(n))}function L(n,e){let r;return function(...t){clearTimeout(r),r=setTimeout(()=>{clearTimeout(r),n(...t)},e)}}function P(n,e){setTimeout(()=>{n()},e)}function V(n){let e={};return function(...r){let t=JSON.stringify(r);if(t in e)return e[t];let o=n(...r);return e[t]=o,o}}function W(n){let e=!1;return(...r)=>{e||(n(...r),e=!0)}}function $(n,e){let r=!1;return function(...t){r||(n(...t),r=!0,setTimeout(()=>{r=!1},e))}}function f(n){return Array.isArray(n)}function H(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function z(n){return typeof n<"u"}function J(n){if(!s(n))return!1;for(let e in n)return!1;return!0}function K(n){return typeof n=="function"}function d(n){return typeof n=="number"}function s(n){return Object.prototype.toString.call(n)==="[object Object]"}function c(n){return typeof n=="string"}function Y(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function Z(n){return g()&&toString.call(n)==="[object Window]"}function G(n){return n%2===0}function Q(n){return n%2!==0}function X(n,e){return n-Math.floor(n/e)*e}function h(n,e=0){return Math.floor(Math.random()*(n-e))+e}function nn(n){return h(n)===0}function tn(){}async function rn(n){return new Promise(e=>setTimeout(e,n))}function w(...n){return n.reduce((e,r)=>(Object.keys(r).forEach(t=>{f(e[t])&&f(r[t])?e[t]=T(e[t].concat(r[t])):s(e[t])&&s(r[t])?e[t]=w(e[t],r[t]):e[t]=r[t]}),e),{})}function ln({to:n,offset:e=0,duration:r=1e3,container:t=null}){let o=c(n)?document.querySelector(n):n,i=c(t)?document.querySelector(t):t,u=(i==null?void 0:i.scrollTop)||(window==null?void 0:window.pageYOffset)||0,l=(d(o)?o:O(o,u))+e,x=Date.now();function p(){let m=Date.now()-x,a=m<r,b=a?v(u,l,m,r):l;a&&requestAnimationFrame(p),i?i.scrollTop=b:window.scrollTo(0,b)}p()}function y(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function v(n,e,r,t){return n+(e-n)*y(r/t)}function O(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function mn(n,e=!1,r=" "){return e?n.split(r).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(r):n.charAt(0).toUpperCase()+n.slice(1)}function an(n){return n.split("")}function bn(n){return n.trim().length===0}function Tn(n){return n.length===0}function dn(n){let e=/-(\w)/g;return n.replace(e,(r,t)=>t?t.toUpperCase():"")}function xn(n){let e=/\B([A-Z])/g;return n.replace(e,"-$1").toLowerCase()}function gn(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function hn(n){if(typeof n=="string"&&(n.trim()===""||isNaN(parseFloat(n))))throw new Error("[tsu] invalid string. Does it contain only a number?");let t=["st","nd","rd"][(Number(n)/10%10^1&&Number(n)%10)-1]||"th";return`${n}${t}`}function wn(n,e,r="..."){return e<=0?r:n.slice(0,e)+r}export{mn as capitalise,an as chars,L as debounce,w as deepMerge,P as delay,F as drop,j as groupsOf,E as head,N as init,f as isArray,bn as isBlank,H as isBoolean,g as isBrowser,z as isDefined,Tn as isEmpty,J as isEmptyObject,G as isEven,K as isFunction,d as isNumber,s as isObject,Q as isOdd,c as isString,Y as isTouchDevice,Z as isWindow,A as last,S as max,V as memoize,M as min,X as modulo,tn as noop,W as once,C as partition,nn as randomChance,h as randomNumber,ln as scroll,rn as sleep,U as splitAt,I as sum,q as tail,B as take,$ as throttle,D as toArray,dn as toCamel,xn as toKebab,gn as toNumber,hn as toOrdinal,wn as truncate,T as uniq};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsu",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "description": "A collection of TypeScript utilities.",
6
6
  "license": "MIT",