tsu 2.0.0 → 2.1.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 s=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var N=(n,e)=>{for(var r in e)s(n,r,{get:e[r],enumerable:!0})},E=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of O(e))!j.call(n,o)&&o!==r&&s(n,o,{get:()=>e[o],enumerable:!(t=v(e,o))||t.enumerable});return n};var F=n=>E(s({},"__esModule",{value:!0}),n);var Tn={};N(Tn,{capitalise:()=>fn,chars:()=>ln,debounce:()=>Z,deepMerge:()=>w,drop:()=>A,groupsOf:()=>S,head:()=>C,init:()=>M,isArray:()=>f,isBlank:()=>sn,isBoolean:()=>k,isBrowser:()=>g,isDefined:()=>D,isEmpty:()=>pn,isEmptyObject:()=>L,isEven:()=>X,isFunction:()=>P,isNull:()=>W,isNumber:()=>m,isObject:()=>u,isOdd:()=>nn,isString:()=>l,isTouchDevice:()=>$,isWindow:()=>H,last:()=>U,max:()=>en,memoize:()=>_,min:()=>rn,noop:()=>un,once:()=>G,partition:()=>V,randomChance:()=>tn,randomNumber:()=>y,scroll:()=>z,sleep:()=>cn,splitAt:()=>I,sum:()=>on,tail:()=>q,take:()=>B,throttle:()=>Q,toArray:()=>R,toCamel:()=>mn,toKebab:()=>an,toNumber:()=>bn,toOrdinal:()=>xn,truncate:()=>dn,uniq:()=>p});module.exports=F(Tn);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 r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function C(n){return n[0]}function M(n){return n.slice(0,n.length-1)}function U(n){return n[n.length-1]}function V(n,e){return e.reduce(([r,t],o,i,c)=>n(o,i,c)?[[...r,o],t]:[r,[...t,o]],[[],[]])}function I(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function q(n){return n.slice(1)}function B(n,e){return n<=0?[]:e.slice(0,n)}function R(n){return n?Array.isArray(n)?n:[n]:[]}function p(n){return Array.from(new Set(n))}function f(n){return Array.isArray(n)}function k(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function D(n){return typeof n<"u"}function L(n){if(!u(n))return!1;for(let e in n)return!1;return!0}function P(n){return typeof n=="function"}function W(n){return Object.prototype.toString.call(n)==="[object Null]"}function m(n){return typeof n=="number"}function u(n){return Object.prototype.toString.call(n)==="[object Object]"}function l(n){return typeof n=="string"}function $(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function H(n){return g()&&Object.prototype.toString.call(n)==="[object Window]"}function z({to:n,offset:e=0,duration:r=1e3,container:t=null}){let o=l(n)?document.querySelector(n):n,i=l(t)?document.querySelector(t):t,c=(i==null?void 0:i.scrollTop)||(window==null?void 0:window.pageYOffset)||0,a=(m(o)?o:Y(o,c))+e,h=Date.now();function b(){let x=Date.now()-h,d=x<r,T=d?K(c,a,x,r):a;d&&requestAnimationFrame(b),i?i.scrollTop=T:window.scrollTo(0,T)}b()}function J(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function K(n,e,r,t){return n+(e-n)*J(r/t)}function Y(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function Z(n,e){let r;return function(...t){clearTimeout(r),r=setTimeout(()=>{clearTimeout(r),n(...t)},e)}}function _(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 G(n){let e=!1;return(...r)=>{e||(n(...r),e=!0)}}function Q(n,e){let r=!1;return function(...t){r||(n(...t),r=!0,setTimeout(()=>{r=!1},e))}}function X(n){return n%2===0}function nn(n){return n%2!==0}function en(n){if(!!n.length)return Math.max(...n)}function rn(n){if(!!n.length)return Math.min(...n)}function tn(n){return y(n)===0}function y(...n){let e,r;return n.length===1?(e=0,r=n[0]):(e=n[0],r=n[1]),Math.floor(Math.random()*(r-e))+e}function on(n){return n.reduce((e,r)=>e+r,0)}function un(){}async function cn(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]=p(e[t].concat(r[t])):u(e[t])&&u(r[t])?e[t]=w(e[t],r[t]):e[t]=r[t]}),e),{})}function fn(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 ln(n){return n.split("")}function sn(n){return n.trim().length===0}function pn(n){return n.length===0}function mn(n){let e=/-(\w)/g;return n.replace(e,(r,t)=>t?t.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 xn(n){let r=["st","nd","rd"][(n/10%10^1&&n%10)-1]||"th";return`${n}${r}`}function dn(n,e,r="..."){return e<=0?r:n.slice(0,e)+r}0&&(module.exports={capitalise,chars,debounce,deepMerge,drop,groupsOf,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyObject,isEven,isFunction,isNull,isNumber,isObject,isOdd,isString,isTouchDevice,isWindow,last,max,memoize,min,noop,once,partition,randomChance,randomNumber,scroll,sleep,splitAt,sum,tail,take,throttle,toArray,toCamel,toKebab,toNumber,toOrdinal,truncate,uniq});
1
+ "use strict";var s=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var N=(n,e)=>{for(var t in e)s(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))!j.call(n,o)&&o!==t&&s(n,o,{get:()=>e[o],enumerable:!(r=v(e,o))||r.enumerable});return n};var F=n=>E(s({},"__esModule",{value:!0}),n);var hn={};N(hn,{capitalise:()=>pn,ceil:()=>X,chars:()=>mn,debounce:()=>Y,deepMerge:()=>h,drop:()=>A,floor:()=>nn,groupsOf:()=>S,head:()=>M,init:()=>C,isArray:()=>f,isBlank:()=>an,isBoolean:()=>k,isBrowser:()=>g,isDefined:()=>D,isEmpty:()=>bn,isEmptyObject:()=>L,isEven:()=>en,isFunction:()=>P,isNull:()=>W,isNumber:()=>m,isObject:()=>u,isOdd:()=>tn,isString:()=>l,isTouchDevice:()=>$,isWindow:()=>H,last:()=>q,max:()=>rn,memoize:()=>Z,min:()=>on,noop:()=>ln,once:()=>G,partition:()=>U,randomChance:()=>un,randomNumber:()=>y,round:()=>cn,scroll:()=>_,sleep:()=>sn,splitAt:()=>V,sum:()=>fn,tail:()=>I,take:()=>B,throttle:()=>Q,toArray:()=>R,toCamel:()=>xn,toKebab:()=>dn,toNumber:()=>Tn,toOrdinal:()=>gn,truncate:()=>yn,uniq:()=>p});module.exports=F(hn);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 q(n){return n[n.length-1]}function U(n,e){return e.reduce(([t,r],o,i,c)=>n(o,i,c)?[[...t,o],r]:[t,[...r,o]],[[],[]])}function V(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function I(n){return n.slice(1)}function B(n,e){return n<=0?[]:e.slice(0,n)}function R(n){return n?Array.isArray(n)?n:[n]:[]}function p(n){return Array.from(new Set(n))}function f(n){return Array.isArray(n)}function k(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function D(n){return typeof n<"u"}function L(n){if(!u(n))return!1;for(let e in n)return!1;return!0}function P(n){return typeof n=="function"}function W(n){return Object.prototype.toString.call(n)==="[object Null]"}function m(n){return typeof n=="number"}function u(n){return Object.prototype.toString.call(n)==="[object Object]"}function l(n){return typeof n=="string"}function $(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function H(n){return g()&&Object.prototype.toString.call(n)==="[object Window]"}function _({to:n,offset:e=0,duration:t=1e3,container:r=null}){let o=l(n)?document.querySelector(n):n,i=l(r)?document.querySelector(r):r,c=i?.scrollTop||window?.pageYOffset||0,a=(m(o)?o:K(o,c))+e,w=Date.now();function b(){let x=Date.now()-w,d=x<t,T=d?J(c,a,x,t):a;d&&requestAnimationFrame(b),i?i.scrollTop=T:window.scrollTo(0,T)}b()}function z(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function J(n,e,t,r){return n+(e-n)*z(t/r)}function K(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function Y(n,e){let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),n(...r)},e)}}function Z(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 G(n){let e=!1;return(...t)=>{e||(n(...t),e=!0)}}function Q(n,e){let t=!1;return function(...r){t||(n(...r),t=!0,setTimeout(()=>{t=!1},e))}}function X(n,e=1){let t=n/e;return Math.ceil(t)*e}function nn(n,e=1){let t=n/e;return Math.floor(t)*e}function en(n){return n%2===0}function tn(n){return n%2!==0}function rn(n){if(n.length)return Math.max(...n)}function on(n){if(n.length)return Math.min(...n)}function un(n){return y(n)===0}function y(...n){let e,t;return n.length===1?(e=0,t=n[0]):(e=n[0],t=n[1]),Math.floor(Math.random()*(t-e))+e}function cn(n,e=1){let t=n/e;return Math.round(t)*e}function fn(n){return n.reduce((e,t)=>e+t,0)}function ln(){}async function sn(n){return new Promise(e=>setTimeout(e,n))}function h(...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]=h(e[r],t[r]):e[r]=t[r]}),e),{})}function pn(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 mn(n){return n.split("")}function an(n){return n.trim().length===0}function bn(n){return n.length===0}function xn(n){let e=/-(\w)/g;return n.replace(e,(t,r)=>r?r.toUpperCase():"")}function dn(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 gn(n){let t=["st","nd","rd"][(n/10%10^1&&n%10)-1]||"th";return`${n}${t}`}function yn(n,e,t="..."){return e<=0?t:n.slice(0,e)+t}0&&(module.exports={capitalise,ceil,chars,debounce,deepMerge,drop,floor,groupsOf,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyObject,isEven,isFunction,isNull,isNumber,isObject,isOdd,isString,isTouchDevice,isWindow,last,max,memoize,min,noop,once,partition,randomChance,randomNumber,round,scroll,sleep,splitAt,sum,tail,take,throttle,toArray,toCamel,toKebab,toNumber,toOrdinal,truncate,uniq});
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- declare type Arrayable<T> = T | Array<T>;
2
- declare type Nullable<T> = T | null | undefined;
3
- declare type Fn<T = any> = (...args: any[]) => T;
4
- declare type VoidFn = Fn<void>;
5
- declare type Obj<V = unknown> = Record<string | symbol | number, V>;
1
+ type Arrayable<T> = T | Array<T>;
2
+ type Nullable<T> = T | null | undefined;
3
+ type Fn<T = any> = (...args: any[]) => T;
4
+ type VoidFn = Fn<void>;
5
+ type Obj<V = unknown> = Record<string | symbol | number, V>;
6
6
 
7
7
  /**
8
8
  * Removes the first `n` items of an array.
@@ -218,6 +218,22 @@ declare function isTouchDevice(): boolean;
218
218
  */
219
219
  declare function isWindow(val: unknown): val is Window;
220
220
 
221
+ /**
222
+ * Rounds a number up to the nearest multiple of the specified factor.
223
+ *
224
+ * @param n - The number to round up.
225
+ * @param factor - The factor used for rounding.
226
+ * @returns The rounded number.
227
+ */
228
+ declare function ceil(n: number, factor?: number): number;
229
+ /**
230
+ * Rounds a number down to the nearest multiple of the specified factor.
231
+ *
232
+ * @param n - The number to round down.
233
+ * @param factor - The factor used for rounding.
234
+ * @returns The rounded number.
235
+ */
236
+ declare function floor(n: number, factor?: number): number;
221
237
  /**
222
238
  * Identifies if a number is even.
223
239
  *
@@ -264,6 +280,14 @@ declare function randomChance(n: number): boolean;
264
280
  */
265
281
  declare function randomNumber(max: number): number;
266
282
  declare function randomNumber(min: number, max: number): number;
283
+ /**
284
+ * Rounds a number to the nearest multiple of the specified factor.
285
+ *
286
+ * @param n - The number to round.
287
+ * @param factor - The factor used for rounding.
288
+ * @returns The rounded number.
289
+ */
290
+ declare function round(n: number, factor?: number): number;
267
291
  /**
268
292
  * Returns the sum of a number array.
269
293
  *
@@ -286,7 +310,7 @@ declare function noop(): void;
286
310
  */
287
311
  declare function sleep(duration: number): Promise<void>;
288
312
 
289
- declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
313
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
290
314
  /**
291
315
  * Recursively merges multiple objects into one.
292
316
  *
@@ -363,4 +387,4 @@ declare function toOrdinal(n: number): string;
363
387
  */
364
388
  declare function truncate(str: string, length: number, suffix?: string): string;
365
389
 
366
- export { Arrayable, Fn, Nullable, Obj, VoidFn, capitalise, chars, debounce, deepMerge, drop, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, noop, once, partition, randomChance, randomNumber, scroll, sleep, splitAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq };
390
+ export { Arrayable, Fn, Nullable, Obj, VoidFn, capitalise, ceil, chars, debounce, deepMerge, drop, floor, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, noop, once, partition, randomChance, randomNumber, round, 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 N(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 F(n){return n.slice(0,n.length-1)}function A(n){return n[n.length-1]}function S(n,e){return e.reduce(([r,t],o,i,u)=>n(o,i,u)?[[...r,o],t]:[r,[...t,o]],[[],[]])}function C(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function M(n){return n.slice(1)}function U(n,e){return n<=0?[]:e.slice(0,n)}function V(n){return n?Array.isArray(n)?n:[n]:[]}function x(n){return Array.from(new Set(n))}function f(n){return Array.isArray(n)}function q(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function B(n){return typeof n<"u"}function R(n){if(!c(n))return!1;for(let e in n)return!1;return!0}function k(n){return typeof n=="function"}function D(n){return Object.prototype.toString.call(n)==="[object Null]"}function d(n){return typeof n=="number"}function c(n){return Object.prototype.toString.call(n)==="[object Object]"}function l(n){return typeof n=="string"}function L(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function P(n){return g()&&Object.prototype.toString.call(n)==="[object Window]"}function H({to:n,offset:e=0,duration:r=1e3,container:t=null}){let o=l(n)?document.querySelector(n):n,i=l(t)?document.querySelector(t):t,u=(i==null?void 0:i.scrollTop)||(window==null?void 0:window.pageYOffset)||0,s=(d(o)?o:h(o,u))+e,T=Date.now();function p(){let m=Date.now()-T,a=m<r,b=a?w(u,s,m,r):s;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 w(n,e,r,t){return n+(e-n)*y(r/t)}function h(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function J(n,e){let r;return function(...t){clearTimeout(r),r=setTimeout(()=>{clearTimeout(r),n(...t)},e)}}function K(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 Y(n){let e=!1;return(...r)=>{e||(n(...r),e=!0)}}function Z(n,e){let r=!1;return function(...t){r||(n(...t),r=!0,setTimeout(()=>{r=!1},e))}}function G(n){return n%2===0}function Q(n){return n%2!==0}function X(n){if(!!n.length)return Math.max(...n)}function nn(n){if(!!n.length)return Math.min(...n)}function en(n){return v(n)===0}function v(...n){let e,r;return n.length===1?(e=0,r=n[0]):(e=n[0],r=n[1]),Math.floor(Math.random()*(r-e))+e}function rn(n){return n.reduce((e,r)=>e+r,0)}function on(){}async function un(n){return new Promise(e=>setTimeout(e,n))}function O(...n){return n.reduce((e,r)=>(Object.keys(r).forEach(t=>{f(e[t])&&f(r[t])?e[t]=x(e[t].concat(r[t])):c(e[t])&&c(r[t])?e[t]=O(e[t],r[t]):e[t]=r[t]}),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 xn(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 Tn(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function gn(n){let r=["st","nd","rd"][(n/10%10^1&&n%10)-1]||"th";return`${n}${r}`}function yn(n,e,r="..."){return e<=0?r:n.slice(0,e)+r}export{pn as capitalise,mn as chars,J as debounce,O as deepMerge,j as drop,N as groupsOf,E as head,F as init,f as isArray,an as isBlank,q as isBoolean,g as isBrowser,B as isDefined,bn as isEmpty,R as isEmptyObject,G as isEven,k as isFunction,D as isNull,d as isNumber,c as isObject,Q as isOdd,l as isString,L as isTouchDevice,P as isWindow,A as last,X as max,K as memoize,nn as min,on as noop,Y as once,S as partition,en as randomChance,v as randomNumber,H as scroll,un as sleep,C as splitAt,rn as sum,M as tail,U as take,Z as throttle,V as toArray,xn as toCamel,dn as toKebab,Tn as toNumber,gn as toOrdinal,yn as truncate,x as uniq};
1
+ function j(n,e){return n<=0?[...e]:e.slice(n)}function N(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 E(n){return n[0]}function F(n){return n.slice(0,n.length-1)}function A(n){return n[n.length-1]}function S(n,e){return e.reduce(([t,r],o,i,u)=>n(o,i,u)?[[...t,o],r]:[t,[...r,o]],[[],[]])}function M(n,e){return n<=0?[[],[...e]]:[e.slice(0,n),e.slice(n)]}function C(n){return n.slice(1)}function q(n,e){return n<=0?[]:e.slice(0,n)}function U(n){return n?Array.isArray(n)?n:[n]:[]}function x(n){return Array.from(new Set(n))}function f(n){return Array.isArray(n)}function I(n){return typeof n=="boolean"}function g(){return typeof window<"u"}function B(n){return typeof n<"u"}function R(n){if(!c(n))return!1;for(let e in n)return!1;return!0}function k(n){return typeof n=="function"}function D(n){return Object.prototype.toString.call(n)==="[object Null]"}function d(n){return typeof n=="number"}function c(n){return Object.prototype.toString.call(n)==="[object Object]"}function l(n){return typeof n=="string"}function L(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function P(n){return g()&&Object.prototype.toString.call(n)==="[object Window]"}function H({to:n,offset:e=0,duration:t=1e3,container:r=null}){let o=l(n)?document.querySelector(n):n,i=l(r)?document.querySelector(r):r,u=i?.scrollTop||window?.pageYOffset||0,s=(d(o)?o:w(o,u))+e,T=Date.now();function p(){let m=Date.now()-T,a=m<t,b=a?h(u,s,m,t):s;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 h(n,e,t,r){return n+(e-n)*y(t/r)}function w(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function z(n,e){let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),n(...r)},e)}}function J(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 Y(n,e){let t=!1;return function(...r){t||(n(...r),t=!0,setTimeout(()=>{t=!1},e))}}function G(n,e=1){let t=n/e;return Math.ceil(t)*e}function Q(n,e=1){let t=n/e;return Math.floor(t)*e}function X(n){return n%2===0}function nn(n){return n%2!==0}function en(n){if(n.length)return Math.max(...n)}function tn(n){if(n.length)return Math.min(...n)}function rn(n){return v(n)===0}function v(...n){let e,t;return n.length===1?(e=0,t=n[0]):(e=n[0],t=n[1]),Math.floor(Math.random()*(t-e))+e}function on(n,e=1){let t=n/e;return Math.round(t)*e}function un(n){return n.reduce((e,t)=>e+t,0)}function fn(){}async function ln(n){return new Promise(e=>setTimeout(e,n))}function O(...n){return n.reduce((e,t)=>(Object.keys(t).forEach(r=>{f(e[r])&&f(t[r])?e[r]=x(e[r].concat(t[r])):c(e[r])&&c(t[r])?e[r]=O(e[r],t[r]):e[r]=t[r]}),e),{})}function bn(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 xn(n){return n.split("")}function dn(n){return n.trim().length===0}function Tn(n){return n.length===0}function gn(n){let e=/-(\w)/g;return n.replace(e,(t,r)=>r?r.toUpperCase():"")}function yn(n){let e=/\B([A-Z])/g;return n.replace(e,"-$1").toLowerCase()}function hn(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function wn(n){let t=["st","nd","rd"][(n/10%10^1&&n%10)-1]||"th";return`${n}${t}`}function vn(n,e,t="..."){return e<=0?t:n.slice(0,e)+t}export{bn as capitalise,G as ceil,xn as chars,z as debounce,O as deepMerge,j as drop,Q as floor,N as groupsOf,E as head,F as init,f as isArray,dn as isBlank,I as isBoolean,g as isBrowser,B as isDefined,Tn as isEmpty,R as isEmptyObject,X as isEven,k as isFunction,D as isNull,d as isNumber,c as isObject,nn as isOdd,l as isString,L as isTouchDevice,P as isWindow,A as last,en as max,J as memoize,tn as min,fn as noop,K as once,S as partition,rn as randomChance,v as randomNumber,on as round,H as scroll,ln as sleep,M as splitAt,un as sum,C as tail,q as take,Y as throttle,U as toArray,gn as toCamel,yn as toKebab,hn as toNumber,wn as toOrdinal,vn as truncate,x as uniq};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsu",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript utilities",
6
6
  "license": "MIT",
@@ -44,6 +44,7 @@
44
44
  "prettier": "^2.7.1",
45
45
  "tsup": "^6.2.2",
46
46
  "typescript": "^4.7.4",
47
+ "vite": "^4.3.8",
47
48
  "vitepress": "1.0.0-alpha.35",
48
49
  "vitest": "^0.26.3"
49
50
  }