tsu 2.7.0 → 2.8.1
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/README.md +21 -7
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +17 -10
- package/dist/index.d.ts +17 -10
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://gitlab.com/happytiptoe/tsu">
|
|
3
|
+
<img src="https://gitlab.com/happytiptoe/tsu/-/raw/main/assets/logo.png" alt="tsu - opinionated project scaffolder" width="251">
|
|
4
|
+
<br>
|
|
5
|
+
</a>
|
|
6
|
+
<h1>tsu</h1>
|
|
7
|
+
<h3>✨ TypeScript Utilities ✨</h3>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div align="center">
|
|
11
|
+
<a href="https://www.npmjs.com/package/tsu" target="__blank">
|
|
12
|
+
<img src="https://img.shields.io/npm/v/tsu?color=3eaa47&label=" alt="NPM version">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://tsu.pages.dev" target="__blank">
|
|
15
|
+
<img src="https://img.shields.io/static/v1?label=&message=View%20documentation&color=3eaa47" alt="view documentation">
|
|
16
|
+
</a>
|
|
17
|
+
<br>
|
|
18
|
+
<a href="https://gitlab.com/happytiptoe/tsu" target="__blank">
|
|
19
|
+
<img src="https://img.shields.io/gitlab/stars/happytiptoe/tsu?style=flat&color=131514" alt="gitlab stars">
|
|
7
20
|
</a>
|
|
8
21
|
<a href="https://npmjs.com/package/tsu">
|
|
9
|
-
<img src="https://img.shields.io/npm/l/tsu" alt="license">
|
|
22
|
+
<img src="https://img.shields.io/npm/l/tsu?color=131514" alt="license">
|
|
10
23
|
</a>
|
|
24
|
+
</div>
|
|
11
25
|
|
|
12
26
|
## Installation
|
|
13
27
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var b=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var F=(n,e)=>{for(var t in e)b(n,t,{get:e[t],enumerable:!0})},M=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N(e))!U.call(n,o)&&o!==t&&b(n,o,{get:()=>e[o],enumerable:!(r=A(e,o))||r.enumerable});return n};var S=n=>M(b({},"__esModule",{value:!0}),n);var Fn={};F(Fn,{capitalise:()=>yn,ceil:()=>E,chars:()=>hn,clamp:()=>C,clone:()=>m,debounce:()=>dn,deepMerge:()=>v,drop:()=>Q,floor:()=>q,groupsOf:()=>X,head:()=>nn,init:()=>en,isArray:()=>s,isBlank:()=>wn,isBoolean:()=>H,isBrowser:()=>j,isDefined:()=>_,isEmpty:()=>jn,isEmptyObject:()=>$,isEven:()=>I,isFunction:()=>z,isNull:()=>c,isNumber:()=>d,isObject:()=>f,isObjectLike:()=>a,isOdd:()=>V,isString:()=>p,isTouchDevice:()=>J,isWindow:()=>K,last:()=>tn,max:()=>L,memoize:()=>xn,min:()=>R,noop:()=>Y,once:()=>Tn,partition:()=>rn,product:()=>B,randomChance:()=>D,randomNumber:()=>l,range:()=>on,round:()=>P,scroll:()=>an,shuffle:()=>un,sleep:()=>Z,splitAt:()=>ln,splitStrAt:()=>On,sum:()=>W,tail:()=>sn,take:()=>cn,throttle:()=>gn,toArray:()=>fn,toCamel:()=>vn,toKebab:()=>kn,toNumber:()=>An,toOrdinal:()=>Nn,truncate:()=>Un,uniq:()=>x,uuid:()=>G});module.exports=S(Fn);function E(n,e=1){let t=n/e;return Math.ceil(t)*e}function C(n,e,t){return Math.min(t,Math.max(e,n))}function q(n,e=1){let t=n/e;return Math.floor(t)*e}function I(n){return n%2===0}function V(n){return n%2!==0}function L(...n){let e;return n.length===1&&Array.isArray(n[0])?e=n[0]:e=n,Math.max(...e)}function R(...n){let e;return n.length===1&&Array.isArray(n[0])?e=n[0]:e=n,Math.min(...e)}function B(n){let e=1;for(let t=0;t<n.length;t++)e*=n[t];return e}function D(n){return l(n)===0}function l(...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 P(n,e=1){let t=n/e;return Math.round(t)*e}function W(n){let e=0;for(let t=0;t<n.length;t++)e+=n[t];return e}function s(n){return Array.isArray(n)}function H(n){return typeof n=="boolean"}function j(){return typeof window<"u"}function _(n){return typeof n<"u"}function $(n){if(!f(n))return!1;for(let e in n)return!1;return!0}function z(n){return typeof n=="function"}function c(n){return Object.prototype.toString.call(n)==="[object Null]"}function d(n){return typeof n=="number"}function f(n){return Object.prototype.toString.call(n)==="[object Object]"}function a(n){return typeof n=="object"}function p(n){return typeof n=="string"}function J(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function K(n){return j()&&Object.prototype.toString.call(n)==="[object Window]"}function m(n){if(s(n)){let e=[];for(let t=0;t<n.length;t++)a(n[t])&&!c(n[t])?e[t]=m(n[t]):e[t]=n[t];return e}if(a(n)&&!c(n)){let e={};for(let t in n)a(n[t])&&!c(n[t])?e[t]=m(n[t]):e[t]=n[t];return e}return n}function Y(){}async function Z(n){return n<0&&console.warn("[tsu] warning: a sleep duration less than 0ms will be treated as 0ms."),new Promise(e=>{setTimeout(e,n)})}var O="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function G(n=16){let e=O.length,t=n,r="";for(;t--;)r+=O[l(e)];return r}function Q(n,e){return n<=0?[...e]:e.slice(n)}function X(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 nn(n){return n[0]}function en(n){return n.slice(0,n.length-1)}function tn(n){return n[n.length-1]}function rn(n,e){let t=[],r=[];for(let o=0;o<n.length;o++){let i=n[o];e(i,o,n)?t.push(i):r.push(i)}return[t,r]}function on(...n){let e,t,r;n.length===1?(t=n[0],e=0,r=1):(e=n[0],t=n[1],r=n[2]||1),r<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),r=1);let o=[],i=e;for(;i<t;)o.push(i),i+=r||1;return o}function un(n){let e=m(n),t,r,o;for(t=e.length;t;t-=1)r=l(t),o=e[t-1],e[t-1]=e[r],e[r]=o;return e}function ln(n,e){return n<=0?[[],[...e]]:n>e.length?[[...e],[]]:[e.slice(0,n),e.slice(n)]}function sn(n){return n.slice(1)}function cn(n,e){return n<=0?[]:e.slice(0,n)}function fn(n){return n?Array.isArray(n)?n:[n]:[]}function x(n){return Array.from(new Set(n))}function an({to:n,offset:e=0,duration:t=1e3,container:r=null}){let o=p(n)?document.querySelector(n):n,i=p(r)?document.querySelector(r):r,u=i?.scrollTop||window?.pageYOffset||0,T=(d(o)?o:bn(o,u))+e,k=Date.now();function g(){let y=Date.now()-k,h=y<t,w=h?pn(u,T,y,t):T;h&&requestAnimationFrame(g),i?i.scrollTop=w:window.scrollTo(0,w)}g()}function mn(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function pn(n,e,t,r){return n+(e-n)*mn(t/r)}function bn(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function dn(n,e){e<0&&console.warn("[tsu] warning: a debounce delay less than 0ms will be treated as 0ms.");let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),n(...r)},e)}}function xn(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 Tn(n){let e=!1;return(...t)=>{e||(n(...t),e=!0)}}function gn(n,e){e<0&&console.warn("[tsu] warning: a throttle limit less than 0ms will be treated as 0ms.");let t=!1;return function(...r){t||(n(...r),t=!0,setTimeout(()=>{t=!1},e))}}function v(...n){let e={};for(let t=0;t<n.length;t++){let r=n[t],o=Object.keys(r);for(let i=0;i<o.length;i++){let u=o[i];s(e[u])&&s(r[u])?e[u]=x(e[u].concat(r[u])):f(e[u])&&f(r[u])?e[u]=v(e[u],r[u]):e[u]=r[u]}}return e}function yn(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 hn(n){return n.split("")}function wn(n){return n.trim().length===0}function jn(n){return n.length===0}function On(n,e){return n<=0?["",e]:n>e.length?[e,""]:[e.slice(0,n),e.slice(n)]}function vn(n){let e=/-(\w)/g;return n.replace(e,(t,r)=>r?r.toUpperCase():"")}function kn(n){let e=/\B([A-Z])/g;return n.replace(e,"-$1").toLowerCase()}function An(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function Nn(n){let t=["st","nd","rd"][(n/10%10^1&&n%10)-1]||"th";return`${n}${t}`}function Un(n,e,t="..."){return e<=0?t:n.slice(0,e)+t}0&&(module.exports={capitalise,ceil,chars,clamp,clone,debounce,deepMerge,drop,floor,groupsOf,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyObject,isEven,isFunction,isNull,isNumber,isObject,isObjectLike,isOdd,isString,isTouchDevice,isWindow,last,max,memoize,min,noop,once,partition,product,randomChance,randomNumber,range,round,scroll,shuffle,sleep,splitAt,splitStrAt,sum,tail,take,throttle,toArray,toCamel,toKebab,toNumber,toOrdinal,truncate,uniq,uuid});
|
package/dist/index.d.cts
CHANGED
|
@@ -4,18 +4,11 @@ type Fn<T = any> = (...args: any[]) => T;
|
|
|
4
4
|
type VoidFn = Fn<void>;
|
|
5
5
|
type Obj<V = unknown> = Record<string | symbol | number, V>;
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Clones an array.
|
|
9
|
-
*
|
|
10
|
-
* @param array - The array.
|
|
11
|
-
* @returns A clone of the array.
|
|
12
|
-
*/
|
|
13
|
-
declare function clone<T>(array: readonly T[]): T[];
|
|
14
7
|
/**
|
|
15
8
|
* Removes the first `n` items of an array.
|
|
16
9
|
*
|
|
17
10
|
* @param n - The number of items to remove.
|
|
18
|
-
* @param array - The array.
|
|
11
|
+
* @param array - The array.z
|
|
19
12
|
* @returns The remaining items.
|
|
20
13
|
*/
|
|
21
14
|
declare function drop<T>(n: number, array: readonly T[]): T[];
|
|
@@ -74,7 +67,7 @@ declare function range(start: number, stop: number, step?: number): number[];
|
|
|
74
67
|
* @param array - The array.
|
|
75
68
|
* @returns A copy of the array with its items randomly shuffled.
|
|
76
69
|
*/
|
|
77
|
-
declare function shuffle<T>(array:
|
|
70
|
+
declare function shuffle<T>(array: T[]): T[];
|
|
78
71
|
/**
|
|
79
72
|
* Splits an array into two at a specified index.
|
|
80
73
|
*
|
|
@@ -223,6 +216,13 @@ declare function isNumber(val: unknown): val is number;
|
|
|
223
216
|
* @returns If the value is an object.
|
|
224
217
|
*/
|
|
225
218
|
declare function isObject(val: unknown): val is Obj;
|
|
219
|
+
/**
|
|
220
|
+
* Identifies if a value is an array, an object, a date, or null.
|
|
221
|
+
*
|
|
222
|
+
* @param val - The value.
|
|
223
|
+
* @returns If the value is an array, an object, a date, or null.
|
|
224
|
+
*/
|
|
225
|
+
declare function isObjectLike(val: unknown): val is object;
|
|
226
226
|
/**
|
|
227
227
|
* Identifies if a value is a string.
|
|
228
228
|
*
|
|
@@ -336,6 +336,13 @@ declare function round(n: number, factor?: number): number;
|
|
|
336
336
|
*/
|
|
337
337
|
declare function sum(ns: readonly number[]): number;
|
|
338
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Deep clones an array or object.
|
|
341
|
+
*
|
|
342
|
+
* @param input - The array or object to clone.
|
|
343
|
+
* @returns A deep clone of the input array or object.
|
|
344
|
+
*/
|
|
345
|
+
declare function clone<T>(input: T): T;
|
|
339
346
|
/**
|
|
340
347
|
* Does nothing.
|
|
341
348
|
*
|
|
@@ -442,4 +449,4 @@ declare function toOrdinal(n: number): string;
|
|
|
442
449
|
*/
|
|
443
450
|
declare function truncate(str: string, length: number, suffix?: string): string;
|
|
444
451
|
|
|
445
|
-
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, 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, product, randomChance, randomNumber, range, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq, uuid };
|
|
452
|
+
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, debounce, deepMerge, drop, floor, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq, uuid };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,18 +4,11 @@ type Fn<T = any> = (...args: any[]) => T;
|
|
|
4
4
|
type VoidFn = Fn<void>;
|
|
5
5
|
type Obj<V = unknown> = Record<string | symbol | number, V>;
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Clones an array.
|
|
9
|
-
*
|
|
10
|
-
* @param array - The array.
|
|
11
|
-
* @returns A clone of the array.
|
|
12
|
-
*/
|
|
13
|
-
declare function clone<T>(array: readonly T[]): T[];
|
|
14
7
|
/**
|
|
15
8
|
* Removes the first `n` items of an array.
|
|
16
9
|
*
|
|
17
10
|
* @param n - The number of items to remove.
|
|
18
|
-
* @param array - The array.
|
|
11
|
+
* @param array - The array.z
|
|
19
12
|
* @returns The remaining items.
|
|
20
13
|
*/
|
|
21
14
|
declare function drop<T>(n: number, array: readonly T[]): T[];
|
|
@@ -74,7 +67,7 @@ declare function range(start: number, stop: number, step?: number): number[];
|
|
|
74
67
|
* @param array - The array.
|
|
75
68
|
* @returns A copy of the array with its items randomly shuffled.
|
|
76
69
|
*/
|
|
77
|
-
declare function shuffle<T>(array:
|
|
70
|
+
declare function shuffle<T>(array: T[]): T[];
|
|
78
71
|
/**
|
|
79
72
|
* Splits an array into two at a specified index.
|
|
80
73
|
*
|
|
@@ -223,6 +216,13 @@ declare function isNumber(val: unknown): val is number;
|
|
|
223
216
|
* @returns If the value is an object.
|
|
224
217
|
*/
|
|
225
218
|
declare function isObject(val: unknown): val is Obj;
|
|
219
|
+
/**
|
|
220
|
+
* Identifies if a value is an array, an object, a date, or null.
|
|
221
|
+
*
|
|
222
|
+
* @param val - The value.
|
|
223
|
+
* @returns If the value is an array, an object, a date, or null.
|
|
224
|
+
*/
|
|
225
|
+
declare function isObjectLike(val: unknown): val is object;
|
|
226
226
|
/**
|
|
227
227
|
* Identifies if a value is a string.
|
|
228
228
|
*
|
|
@@ -336,6 +336,13 @@ declare function round(n: number, factor?: number): number;
|
|
|
336
336
|
*/
|
|
337
337
|
declare function sum(ns: readonly number[]): number;
|
|
338
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Deep clones an array or object.
|
|
341
|
+
*
|
|
342
|
+
* @param input - The array or object to clone.
|
|
343
|
+
* @returns A deep clone of the input array or object.
|
|
344
|
+
*/
|
|
345
|
+
declare function clone<T>(input: T): T;
|
|
339
346
|
/**
|
|
340
347
|
* Does nothing.
|
|
341
348
|
*
|
|
@@ -442,4 +449,4 @@ declare function toOrdinal(n: number): string;
|
|
|
442
449
|
*/
|
|
443
450
|
declare function truncate(str: string, length: number, suffix?: string): string;
|
|
444
451
|
|
|
445
|
-
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, 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, product, randomChance, randomNumber, range, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq, uuid };
|
|
452
|
+
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, debounce, deepMerge, drop, floor, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq, uuid };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(n,e=1){let t=n/e;return Math.ceil(t)*e}function F(n,e,t){return Math.min(t,Math.max(e,n))}function M(n,e=1){let t=n/e;return Math.floor(t)*e}function S(n){return n%2===0}function E(n){return n%2!==0}function C(...n){let e;return n.length===1&&Array.isArray(n[0])?e=n[0]:e=n,Math.max(...e)}function q(...n){let e;return n.length===1&&Array.isArray(n[0])?e=n[0]:e=n,Math.min(...e)}function I(n){let e=1;for(let t=0;t<n.length;t++)e*=n[t];return e}function V(n){return l(n)===0}function l(...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 L(n,e=1){let t=n/e;return Math.round(t)*e}function R(n){let e=0;for(let t=0;t<n.length;t++)e+=n[t];return e}function s(n){return Array.isArray(n)}function D(n){return typeof n=="boolean"}function O(){return typeof window<"u"}function P(n){return typeof n<"u"}function W(n){if(!f(n))return!1;for(let e in n)return!1;return!0}function H(n){return typeof n=="function"}function c(n){return Object.prototype.toString.call(n)==="[object Null]"}function y(n){return typeof n=="number"}function f(n){return Object.prototype.toString.call(n)==="[object Object]"}function a(n){return typeof n=="object"}function p(n){return typeof n=="string"}function _(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function $(n){return O()&&Object.prototype.toString.call(n)==="[object Window]"}function m(n){if(s(n)){let e=[];for(let t=0;t<n.length;t++)a(n[t])&&!c(n[t])?e[t]=m(n[t]):e[t]=n[t];return e}if(a(n)&&!c(n)){let e={};for(let t in n)a(n[t])&&!c(n[t])?e[t]=m(n[t]):e[t]=n[t];return e}return n}function Y(){}async function Z(n){return n<0&&console.warn("[tsu] warning: a sleep duration less than 0ms will be treated as 0ms."),new Promise(e=>{setTimeout(e,n)})}var h="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function G(n=16){let e=h.length,t=n,r="";for(;t--;)r+=h[l(e)];return r}function en(n,e){return n<=0?[...e]:e.slice(n)}function tn(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 rn(n){return n[0]}function on(n){return n.slice(0,n.length-1)}function un(n){return n[n.length-1]}function ln(n,e){let t=[],r=[];for(let o=0;o<n.length;o++){let i=n[o];e(i,o,n)?t.push(i):r.push(i)}return[t,r]}function sn(...n){let e,t,r;n.length===1?(t=n[0],e=0,r=1):(e=n[0],t=n[1],r=n[2]||1),r<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),r=1);let o=[],i=e;for(;i<t;)o.push(i),i+=r||1;return o}function cn(n){let e=m(n),t,r,o;for(t=e.length;t;t-=1)r=l(t),o=e[t-1],e[t-1]=e[r],e[r]=o;return e}function fn(n,e){return n<=0?[[],[...e]]:n>e.length?[[...e],[]]:[e.slice(0,n),e.slice(n)]}function an(n){return n.slice(1)}function mn(n,e){return n<=0?[]:e.slice(0,n)}function pn(n){return n?Array.isArray(n)?n:[n]:[]}function w(n){return Array.from(new Set(n))}function xn({to:n,offset:e=0,duration:t=1e3,container:r=null}){let o=p(n)?document.querySelector(n):n,i=p(r)?document.querySelector(r):r,u=i?.scrollTop||window?.pageYOffset||0,b=(y(o)?o:A(o,u))+e,j=Date.now();function d(){let x=Date.now()-j,T=x<t,g=T?k(u,b,x,t):b;T&&requestAnimationFrame(d),i?i.scrollTop=g:window.scrollTo(0,g)}d()}function v(n){return n<.5?4*Math.pow(n,3):(n-1)*(2*n-2)*(2*n-2)+1}function k(n,e,t,r){return n+(e-n)*v(t/r)}function A(n,e){return n.nodeName==="HTML"?-e:n.getBoundingClientRect().top+e}function gn(n,e){e<0&&console.warn("[tsu] warning: a debounce delay less than 0ms will be treated as 0ms.");let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),n(...r)},e)}}function yn(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 hn(n){let e=!1;return(...t)=>{e||(n(...t),e=!0)}}function wn(n,e){e<0&&console.warn("[tsu] warning: a throttle limit less than 0ms will be treated as 0ms.");let t=!1;return function(...r){t||(n(...r),t=!0,setTimeout(()=>{t=!1},e))}}function N(...n){let e={};for(let t=0;t<n.length;t++){let r=n[t],o=Object.keys(r);for(let i=0;i<o.length;i++){let u=o[i];s(e[u])&&s(r[u])?e[u]=w(e[u].concat(r[u])):f(e[u])&&f(r[u])?e[u]=N(e[u],r[u]):e[u]=r[u]}}return e}function An(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 Nn(n){return n.split("")}function Un(n){return n.trim().length===0}function Fn(n){return n.length===0}function Mn(n,e){return n<=0?["",e]:n>e.length?[e,""]:[e.slice(0,n),e.slice(n)]}function Sn(n){let e=/-(\w)/g;return n.replace(e,(t,r)=>r?r.toUpperCase():"")}function En(n){let e=/\B([A-Z])/g;return n.replace(e,"-$1").toLowerCase()}function Cn(n){return n.length?Number(n.replace(/[#£€$,%]/g,"")):NaN}function qn(n){let t=["st","nd","rd"][(n/10%10^1&&n%10)-1]||"th";return`${n}${t}`}function In(n,e,t="..."){return e<=0?t:n.slice(0,e)+t}export{An as capitalise,U as ceil,Nn as chars,F as clamp,m as clone,gn as debounce,N as deepMerge,en as drop,M as floor,tn as groupsOf,rn as head,on as init,s as isArray,Un as isBlank,D as isBoolean,O as isBrowser,P as isDefined,Fn as isEmpty,W as isEmptyObject,S as isEven,H as isFunction,c as isNull,y as isNumber,f as isObject,a as isObjectLike,E as isOdd,p as isString,_ as isTouchDevice,$ as isWindow,un as last,C as max,yn as memoize,q as min,Y as noop,hn as once,ln as partition,I as product,V as randomChance,l as randomNumber,sn as range,L as round,xn as scroll,cn as shuffle,Z as sleep,fn as splitAt,Mn as splitStrAt,R as sum,an as tail,mn as take,wn as throttle,pn as toArray,Sn as toCamel,En as toKebab,Cn as toNumber,qn as toOrdinal,In as truncate,w as uniq,G as uuid};
|