tsu 2.11.0 → 2.11.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/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
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 L=Object.prototype.hasOwnProperty;var R=(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))!L.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 Xe={};R(Xe,{average:()=>z,capitalise:()=>E,capitalize:()=>Se,ceil:()=>_,chars:()=>Ue,clamp:()=>m,clone:()=>a,copyToClipboard:()=>he,debounce:()=>Oe,drop:()=>q,es:()=>se,floor:()=>V,groups:()=>H,head:()=>I,init:()=>W,isArray:()=>l,isBlank:()=>Le,isBoolean:()=>te,isBrowser:()=>s,isDefined:()=>oe,isEmpty:()=>Re,isEmptyArray:()=>ie,isEmptyObject:()=>ue,isEven:()=>J,isFunction:()=>fe,isNull:()=>p,isNumber:()=>y,isObject:()=>T,isObjectLike:()=>c,isOdd:()=>K,isString:()=>b,isTouchDevice:()=>me,isUndefined:()=>le,isWindow:()=>f,ks:()=>pe,last:()=>$,max:()=>Y,memoise:()=>O,memoize:()=>Ce,min:()=>Z,noop:()=>Ne,once:()=>Ee,partition:()=>P,product:()=>G,randomChance:()=>Q,randomNumber:()=>u,range:()=>X,replaceChar:()=>Be,round:()=>ee,scroll:()=>ke,shuffle:()=>ae,sleep:()=>Me,splitArray:()=>xe,splitString:()=>De,sum:()=>g,tail:()=>be,take:()=>de,throttle:()=>Ae,toArray:()=>ge,toCamel:()=>qe,toDp:()=>re,toKebab:()=>He,toNumber:()=>ne,toOrdinal:()=>Ie,toRomanNumerals:()=>We,truncate:()=>$e,unchars:()=>Pe,uniq:()=>Te,uuid:()=>Fe,vs:()=>ce});module.exports=D(Xe);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 W(e){return e.slice(0,e.length-1)}function $(e){return e[e.length-1]}function P(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 X(...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 z(e){return e.length<1?0:g(e)/e.length}function _(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 V(e,r=1){let n=e/r;return Math.floor(n)*r}function J(e){return e%2===0}function K(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 g(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(!T(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 T(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){return Object.entries(e)}function pe(e){return Object.keys(e)}function ce(e){return Object.values(e)}function ae(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 xe(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function be(e){return e.slice(1)}function de(e,r){return r<=0?[]:e.slice(0,r)}function ge(e){return e?Array.isArray(e)?e:[e]:[]}function Te(e){return Array.from(new Set(e))}function ye(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 he(e){s()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):ye(e))}function we(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)*we(n/t)}function ve(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 ke({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=ve(o,x,i)+r,h=m(M,0,N),F=Date.now();function w(){let j=Date.now()-F,v=j<n,k=v?je(x,h,j,n):h;v&&requestAnimationFrame(w),f(i)?window.scrollTo(0,k):i instanceof HTMLElement&&(i.scrollTop=k)}w()}function Oe(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 Ee(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Ae(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 Ne(){}async function Me(e){return e<0&&console.warn("[tsu] warning: sleep durations less than 0 are set to 0."),new Promise(r=>{setTimeout(r,e)})}var C="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function Fe(e=16){let r=C.length,n=e,t="";for(;n--;)t+=C[u(r)];return t}function E(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 Se=E;function Ue(e){return e.split("")}function Le(e){return e.trim().length===0}function Re(e){return e.length===0}function Be(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function De(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function qe(e){let r=/-(\w)/g;return e.replace(r,(n,t)=>t?t.toUpperCase():"")}function He(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function Ie(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 We(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 $e(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function Pe(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,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});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function R(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 W(e){return e.slice(0,e.length-1)}function P(e){return e[e.length-1]}function z(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 V(...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 ge(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 ve(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 $e(e){return typeof e=="boolean"}function p(){return typeof window<"u"}function ze(e){return typeof e<"u"}function Je(e){return s(e)&&e.length===0}function Ze(e){if(!j(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 v(e){return typeof e=="number"}function j(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){return Object.entries(e)}function Sr(e){return Object.keys(e)}function Lr(e){return Object.values(e)}function Pr(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 zr(e,r){return r<=0?[[],[...e]]:r>e.length?[[...e],[]]:[e.slice(0,r),e.slice(r)]}function Vr(e){return e.slice(1)}function Kr(e,r){return r<=0?[]:e.slice(0,r)}function Zr(e){return e?Array.isArray(e)?e:[e]:[]}function Qr(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 gn(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 v(e)?t=e:f(n)?t=e.getBoundingClientRect().top+r:t=e.getBoundingClientRect().top+r-n.getBoundingClientRect().top,t}function wn({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,C=f(o)?document.documentElement.scrollHeight-window.innerHeight:o.scrollHeight-o.clientHeight,E=S(i,m,o)+r,d=l(E,0,C),A=Date.now();function g(){let T=Date.now()-A,y=T<n,h=y?F(m,d,T,n):d;y&&requestAnimationFrame(g),f(o)?window.scrollTo(0,h):o instanceof HTMLElement&&(o.scrollTop=h)}g()}function Cn(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 An=U;function Mn(e){let r=!1;return(...n)=>{r||(e(...n),r=!0)}}function Sn(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 Hn(){}async function Wn(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 Xn(e=16){let r=k.length,n=e,t="";for(;n--;)t+=k[u(r)];return t}function L(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 Yn=L;function Gn(e){return e.split("")}function et(e){return e.trim().length===0}function nt(e){return e.length===0}function ot(e,r,n){return r<0||r>e.length-1?e:e.slice(0,r)+n+e.slice(r+1)}function ut(e,r){return r<=0?["",e]:r>e.length?[e,""]:[e.slice(0,r),e.slice(r)]}function mt(e){let r=/-(\w)/g;return e.replace(r,(n,t)=>t?t.toUpperCase():"")}function st(e){let r=/\B([A-Z])/g;return e.replace(r,"-$1").toLowerCase()}function ct(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 xt(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 dt(e,r,n="..."){return r<=0?n:e.slice(0,r)+n}function Tt(e){return e.join("")}export{Y as average,L as capitalise,Yn as capitalize,G as ceil,Gn as chars,l as clamp,x as clone,gn as copyToClipboard,Cn as debounce,R as drop,Mr as es,re as floor,D as groups,H as head,W as init,s as isArray,et as isBlank,$e as isBoolean,p as isBrowser,ze as isDefined,nt as isEmpty,Je as isEmptyArray,Ze as isEmptyObject,te as isEven,Qe as isFunction,c as isNull,v as isNumber,j as isObject,a as isObjectLike,ie as isOdd,b as isString,ur as isTouchDevice,mr as isUndefined,f as isWindow,Sr as ks,P as last,fe as max,U as memoise,An as memoize,le as min,Hn as noop,Mn as once,z as partition,pe as product,be as randomChance,u as randomNumber,V as range,ot as replaceChar,ge as round,wn as scroll,Pr as shuffle,Wn as sleep,zr as splitArray,ut as splitString,w as sum,Vr as tail,Kr as take,Sn as throttle,Zr as toArray,mt as toCamel,we as toDp,st as toKebab,ve as toNumber,ct as toOrdinal,xt as toRomanNumerals,dt as truncate,Tt as unchars,Qr as uniq,Xn as uuid,Lr as vs};
|