@fluixi/utils 1.0.0-alpha.82 → 1.0.0-alpha.84

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.
Files changed (129) hide show
  1. package/dist/index.cjs +2858 -1
  2. package/dist/index.mjs +2838 -1
  3. package/dist/lib/array/advanced.cjs +2227 -1
  4. package/dist/lib/array/advanced.mjs +2204 -1
  5. package/dist/lib/array/array.cjs +57 -1
  6. package/dist/lib/array/array.mjs +36 -1
  7. package/dist/lib/array/index.cjs +2344 -1
  8. package/dist/lib/array/index.mjs +2322 -1
  9. package/dist/lib/array/utils.cjs +103 -1
  10. package/dist/lib/array/utils.mjs +82 -1
  11. package/dist/lib/color/color.cjs +2190 -1
  12. package/dist/lib/color/color.mjs +2167 -1
  13. package/dist/lib/color/constants.cjs +380 -1
  14. package/dist/lib/color/constants.mjs +359 -1
  15. package/dist/lib/color/conversions.cjs +629 -1
  16. package/dist/lib/color/conversions.mjs +608 -1
  17. package/dist/lib/color/helpers.cjs +2534 -1
  18. package/dist/lib/color/helpers.mjs +2511 -1
  19. package/dist/lib/color/index.cjs +2641 -1
  20. package/dist/lib/color/index.mjs +2619 -1
  21. package/dist/lib/color/types.cjs +18 -1
  22. package/dist/lib/color/utils.cjs +962 -1
  23. package/dist/lib/color/utils.mjs +939 -1
  24. package/dist/lib/compare/comparators.cjs +171 -1
  25. package/dist/lib/compare/comparators.mjs +150 -1
  26. package/dist/lib/compare/index.cjs +172 -1
  27. package/dist/lib/compare/index.mjs +152 -1
  28. package/dist/lib/crypto/hash.cjs +83 -1
  29. package/dist/lib/crypto/hash.mjs +62 -1
  30. package/dist/lib/crypto/index.cjs +85 -1
  31. package/dist/lib/crypto/index.mjs +62 -1
  32. package/dist/lib/dom/events.cjs +40 -1
  33. package/dist/lib/dom/events.mjs +19 -1
  34. package/dist/lib/dom/index.cjs +78 -1
  35. package/dist/lib/dom/index.mjs +56 -1
  36. package/dist/lib/dom/utils.cjs +57 -1
  37. package/dist/lib/dom/utils.mjs +36 -1
  38. package/dist/lib/functions/functions.cjs +366 -1
  39. package/dist/lib/functions/functions.mjs +345 -1
  40. package/dist/lib/functions/index.cjs +369 -1
  41. package/dist/lib/functions/index.mjs +347 -1
  42. package/dist/lib/functions/types.cjs +18 -1
  43. package/dist/lib/helpers.cjs +78 -1
  44. package/dist/lib/helpers.mjs +59 -1
  45. package/dist/lib/index.cjs +2857 -1
  46. package/dist/lib/index.mjs +2836 -1
  47. package/dist/lib/maths/constants.cjs +70 -1
  48. package/dist/lib/maths/constants.mjs +50 -1
  49. package/dist/lib/maths/fn/advanced.cjs +231 -1
  50. package/dist/lib/maths/fn/advanced.mjs +208 -1
  51. package/dist/lib/maths/fn/basic.cjs +212 -1
  52. package/dist/lib/maths/fn/basic.mjs +191 -1
  53. package/dist/lib/maths/fn/complex.cjs +268 -1
  54. package/dist/lib/maths/fn/complex.mjs +247 -1
  55. package/dist/lib/maths/fn/index.cjs +877 -1
  56. package/dist/lib/maths/fn/index.mjs +855 -1
  57. package/dist/lib/maths/fn/trigo.cjs +179 -1
  58. package/dist/lib/maths/fn/trigo.mjs +156 -1
  59. package/dist/lib/maths/fn/vector.cjs +728 -1
  60. package/dist/lib/maths/fn/vector.mjs +707 -1
  61. package/dist/lib/maths/formatter.cjs +61 -1
  62. package/dist/lib/maths/formatter.mjs +40 -1
  63. package/dist/lib/maths/guards.cjs +164 -1
  64. package/dist/lib/maths/guards.mjs +144 -1
  65. package/dist/lib/maths/index.cjs +1152 -1
  66. package/dist/lib/maths/index.mjs +1130 -1
  67. package/dist/lib/maths/parser.cjs +75 -1
  68. package/dist/lib/maths/parser.mjs +54 -1
  69. package/dist/lib/maths/random.cjs +49 -1
  70. package/dist/lib/maths/random.mjs +28 -1
  71. package/dist/lib/maths/types/advanced.cjs +18 -1
  72. package/dist/lib/maths/types/basic.cjs +18 -1
  73. package/dist/lib/maths/types/index.cjs +19 -1
  74. package/dist/lib/maths/types/index.mjs +1 -0
  75. package/dist/lib/maths/types/negative.cjs +18 -1
  76. package/dist/lib/maths/types/operations.cjs +18 -1
  77. package/dist/lib/object/clone.cjs +88 -1
  78. package/dist/lib/object/clone.mjs +65 -1
  79. package/dist/lib/object/diff.cjs +573 -1
  80. package/dist/lib/object/diff.mjs +550 -1
  81. package/dist/lib/object/getter-setter.cjs +2351 -1
  82. package/dist/lib/object/getter-setter.mjs +2330 -1
  83. package/dist/lib/object/index.cjs +3956 -6
  84. package/dist/lib/object/index.mjs +3936 -6
  85. package/dist/lib/object/merge.cjs +1029 -1
  86. package/dist/lib/object/merge.mjs +1006 -1
  87. package/dist/lib/object/object.cjs +280 -1
  88. package/dist/lib/object/object.mjs +257 -1
  89. package/dist/lib/object/omit.cjs +2022 -1
  90. package/dist/lib/object/omit.mjs +1999 -1
  91. package/dist/lib/object/reconcile.cjs +126 -1
  92. package/dist/lib/object/reconcile.mjs +105 -1
  93. package/dist/lib/object/selector.cjs +303 -1
  94. package/dist/lib/object/selector.mjs +282 -1
  95. package/dist/lib/object/sort.cjs +209 -1
  96. package/dist/lib/object/sort.mjs +186 -1
  97. package/dist/lib/object/transform.cjs +2211 -1
  98. package/dist/lib/object/transform.mjs +2190 -1
  99. package/dist/lib/object/types.cjs +18 -1
  100. package/dist/lib/object/utils.cjs +326 -6
  101. package/dist/lib/object/utils.mjs +305 -6
  102. package/dist/lib/primitive/boolean/boolean.cjs +407 -1
  103. package/dist/lib/primitive/boolean/boolean.mjs +386 -1
  104. package/dist/lib/primitive/boolean/index.cjs +382 -1
  105. package/dist/lib/primitive/boolean/index.mjs +359 -1
  106. package/dist/lib/primitive/boolean/types.cjs +18 -1
  107. package/dist/lib/primitive/date/date.cjs +1126 -1
  108. package/dist/lib/primitive/date/date.mjs +1105 -1
  109. package/dist/lib/primitive/date/index.cjs +1128 -1
  110. package/dist/lib/primitive/date/index.mjs +1105 -1
  111. package/dist/lib/primitive/date/types.cjs +18 -1
  112. package/dist/lib/primitive/index.cjs +2338 -5
  113. package/dist/lib/primitive/index.mjs +2316 -5
  114. package/dist/lib/primitive/string/index.cjs +875 -5
  115. package/dist/lib/primitive/string/index.mjs +852 -5
  116. package/dist/lib/primitive/string/parser-2.cjs +543 -8
  117. package/dist/lib/primitive/string/parser-2.mjs +522 -8
  118. package/dist/lib/primitive/string/parser.cjs +236 -3
  119. package/dist/lib/primitive/string/parser.mjs +215 -3
  120. package/dist/lib/primitive/string/string.cjs +926 -5
  121. package/dist/lib/primitive/string/string.mjs +903 -5
  122. package/dist/lib/primitive/string/types.cjs +18 -1
  123. package/dist/lib/primitive/types.cjs +18 -1
  124. package/dist/lib/url/index.cjs +327 -1
  125. package/dist/lib/url/index.mjs +304 -1
  126. package/dist/lib/url/parser.cjs +325 -1
  127. package/dist/lib/url/parser.mjs +304 -1
  128. package/dist/lib/url/types.cjs +18 -1
  129. package/package.json +5 -5
@@ -1 +1,347 @@
1
- import{isClass as F}from"@fluixi/utils/object";function I(e){return typeof e=="function"&&!F(e)}function L(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}function z(e){return I(e)&&e.constructor.name==="AsyncFunction"}function j(e,n){let t=new Map,r=function(...a){let i=n?n(...a):JSON.stringify(a);if(t.has(i))return t.get(i);let o=e.apply(this,a);return t.set(i,o),o};return r.cache=t,r}function M(e,n,t={}){let{leading:r=!1,trailing:a=!0,maxWait:i}=t,o,c,s,y=0,p,f,l;function x(u){let T=p,d=f;return p=f=void 0,y=u,l=e.apply(d,T),l}function m(u,T){return setTimeout(u,T)}function R(u){u!==void 0&&clearTimeout(u)}function w(u){return y=u,o=m(g,n),r?x(u):l}function k(u){let T=u-s,d=u-y,v=n-T;return i!==void 0?Math.min(v,i-d):v}function b(u){let T=u-s,d=u-y;return s===void 0||T>=n||T<0||i!==void 0&&d>=i}function g(){let u=Date.now();if(b(u)){P(u);return}o=m(g,k(u))}function P(u){return o=void 0,a&&p?x(u):(p=f=void 0,l)}function A(){R(o),R(c),y=0,p=s=f=o=c=void 0}function E(){return o===void 0?l:P(Date.now())}function C(){return o!==void 0}function h(...u){let T=Date.now(),d=b(T);if(p=u,f=this,s=T,d){if(o===void 0)return w(s);if(i!==void 0)return o=m(g,n),x(s)}return o===void 0&&(o=m(g,n)),l}return h.cancel=A,h.flush=E,h.pending=C,h}function O(e,n,t={}){let{leading:r=!0,trailing:a=!0}=t;return M(e,n,{leading:r,trailing:a,maxWait:n})}function J(e){let n=!1,t,r=function(...a){return n||(n=!0,t=e.apply(this,a)),t};return Object.defineProperty(r,"called",{get(){return n}}),r}function N(e,...n){return function(...t){let r=n.map(a=>t[a]);return e.apply(this,r)}}function _(e,n=e.length){return function t(...r){return r.length>=n?e.apply(this,r):function(...a){return t.apply(this,[...r,...a])}}}function S(...e){return e.reduceRight((n,t)=>r=>t(n(r)),n=>n)}function W(...e){return e.reduce((n,t)=>r=>t(n(r)),n=>n)}function $(e){return function(...n){return!e.apply(this,n)}}function q(e,...n){return function(...t){let r=t.map((a,i)=>n[i]?n[i](a):a);return e.apply(this,r)}}function B(e,...n){return function(...t){return e.apply(this,[...n,...t])}}function G(e,...n){return function(...t){return e.apply(this,[...t,...n])}}function H(e,n,...t){return function(...r){return e.apply(n,[...t,...r])}}function K(e){return function(...n){return e.apply(this,n.reverse())}}function Q(e,n){return function(...t){return e.apply(this,t.slice(0,n))}}function U(e){return function(n){return e.call(this,n)}}function V(e,...n){return setTimeout(e,1,...n)}function X(e,n,...t){return setTimeout(e,n,...t)}function Y(e,n,t){let r=new Map,a=function(...i){let o=t?t(...i):JSON.stringify(i),c=Date.now(),s=r.get(o);if(s&&s.expires>c)return s.value;let y=e.apply(this,i);r.set(o,{value:y,expires:c+n});for(let[p,f]of r.entries())f.expires<=c&&r.delete(p);return y};return a.cache=r,a}function Z(e,n){let t,r=0;return function(...a){return++r<n&&(t=e.apply(this,a)),r>=n&&(e=void 0),t}}function ee(e,n){let t=0;return function(...r){if(++t>=n)return e.apply(this,r)}}function ne(e,n){return function(...t){try{return e.apply(this,t)}catch(r){return n(r,...t)}}}function te(...e){return W(...e)}function re(...e){return S(...e)}function ae(e,n={}){let{retries:t=3,delay:r=1e3,backoff:a=2,onRetry:i}=n;return async function(...o){let c,s=r;for(let y=0;y<=t;y++)try{return await e.apply(this,o)}catch(p){c=p,y<t&&(i&&i(c,y+1),await new Promise(f=>setTimeout(f,s)),s*=a)}throw c}}function ue(e,n,t){return async function(...r){return Promise.race([e.apply(this,r),new Promise((a,i)=>setTimeout(()=>{t&&t(),i(new Error(`Function timed out after ${n}ms`))},n))])}}export{ee as after,Q as ary,Z as before,H as bind,S as compose,_ as curry,M as debounce,V as defer,X as delay,K as flip,te as flow,re as flowRight,z as isAsyncFunction,I as isFunction,L as isPromise,j as memoize,Y as memoizeWithTTL,$ as negate,J as once,q as overArgs,B as partial,G as partialRight,W as pipe,N as rearg,ae as retry,O as throttle,ne as tryCatch,U as unary,ue as withTimeout};
1
+ /*! @fluixi/utils v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+
3
+ // src/lib/functions/functions.ts
4
+ import { isClass } from "@fluixi/utils/object";
5
+ function isFunction(v) {
6
+ return typeof v === "function" && !isClass(v);
7
+ }
8
+ function isPromise(v) {
9
+ return v instanceof Promise || !!v && (typeof v === "object" || typeof v === "function") && "then" in v;
10
+ }
11
+ function isAsyncFunction(v) {
12
+ return isFunction(v) && v.constructor.name === "AsyncFunction";
13
+ }
14
+ function memoize(fn, resolver) {
15
+ const cache = /* @__PURE__ */ new Map();
16
+ const memoized = function(...args) {
17
+ const key = resolver ? resolver(...args) : JSON.stringify(args);
18
+ if (cache.has(key)) {
19
+ return cache.get(key);
20
+ }
21
+ const result = fn.apply(this, args);
22
+ cache.set(key, result);
23
+ return result;
24
+ };
25
+ memoized.cache = cache;
26
+ return memoized;
27
+ }
28
+ function debounce(fn, wait, options = {}) {
29
+ const { leading = false, trailing = true, maxWait } = options;
30
+ let timerId;
31
+ let maxTimerId;
32
+ let lastCallTime;
33
+ let lastInvokeTime = 0;
34
+ let lastArgs;
35
+ let lastThis;
36
+ let result;
37
+ function invokeFunc(time) {
38
+ const args = lastArgs;
39
+ const thisArg = lastThis;
40
+ lastArgs = lastThis = void 0;
41
+ lastInvokeTime = time;
42
+ result = fn.apply(thisArg, args);
43
+ return result;
44
+ }
45
+ function startTimer(pendingFunc, wait2) {
46
+ return setTimeout(pendingFunc, wait2);
47
+ }
48
+ function cancelTimer(id) {
49
+ if (id !== void 0) {
50
+ clearTimeout(id);
51
+ }
52
+ }
53
+ function leadingEdge(time) {
54
+ lastInvokeTime = time;
55
+ timerId = startTimer(timerExpired, wait);
56
+ return leading ? invokeFunc(time) : result;
57
+ }
58
+ function remainingWait(time) {
59
+ const timeSinceLastCall = time - lastCallTime;
60
+ const timeSinceLastInvoke = time - lastInvokeTime;
61
+ const timeWaiting = wait - timeSinceLastCall;
62
+ return maxWait !== void 0 ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
63
+ }
64
+ function shouldInvoke(time) {
65
+ const timeSinceLastCall = time - lastCallTime;
66
+ const timeSinceLastInvoke = time - lastInvokeTime;
67
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxWait !== void 0 && timeSinceLastInvoke >= maxWait;
68
+ }
69
+ function timerExpired() {
70
+ const time = Date.now();
71
+ if (shouldInvoke(time)) {
72
+ trailingEdge(time);
73
+ return;
74
+ }
75
+ timerId = startTimer(timerExpired, remainingWait(time));
76
+ }
77
+ function trailingEdge(time) {
78
+ timerId = void 0;
79
+ if (trailing && lastArgs) {
80
+ return invokeFunc(time);
81
+ }
82
+ lastArgs = lastThis = void 0;
83
+ return result;
84
+ }
85
+ function cancel() {
86
+ cancelTimer(timerId);
87
+ cancelTimer(maxTimerId);
88
+ lastInvokeTime = 0;
89
+ lastArgs = lastCallTime = lastThis = timerId = maxTimerId = void 0;
90
+ }
91
+ function flush() {
92
+ return timerId === void 0 ? result : trailingEdge(Date.now());
93
+ }
94
+ function pending() {
95
+ return timerId !== void 0;
96
+ }
97
+ function debounced(...args) {
98
+ const time = Date.now();
99
+ const isInvoking = shouldInvoke(time);
100
+ lastArgs = args;
101
+ lastThis = this;
102
+ lastCallTime = time;
103
+ if (isInvoking) {
104
+ if (timerId === void 0) {
105
+ return leadingEdge(lastCallTime);
106
+ }
107
+ if (maxWait !== void 0) {
108
+ timerId = startTimer(timerExpired, wait);
109
+ return invokeFunc(lastCallTime);
110
+ }
111
+ }
112
+ if (timerId === void 0) {
113
+ timerId = startTimer(timerExpired, wait);
114
+ }
115
+ return result;
116
+ }
117
+ debounced.cancel = cancel;
118
+ debounced.flush = flush;
119
+ debounced.pending = pending;
120
+ return debounced;
121
+ }
122
+ function throttle(fn, wait, options = {}) {
123
+ const { leading = true, trailing = true } = options;
124
+ return debounce(fn, wait, {
125
+ leading,
126
+ trailing,
127
+ maxWait: wait
128
+ });
129
+ }
130
+ function once(fn) {
131
+ let called = false;
132
+ let result;
133
+ const wrapped = function(...args) {
134
+ if (!called) {
135
+ called = true;
136
+ result = fn.apply(this, args);
137
+ }
138
+ return result;
139
+ };
140
+ Object.defineProperty(wrapped, "called", {
141
+ get() {
142
+ return called;
143
+ }
144
+ });
145
+ return wrapped;
146
+ }
147
+ function rearg(fn, ...indexes) {
148
+ return function(...args) {
149
+ const reordered = indexes.map((i) => args[i]);
150
+ return fn.apply(this, reordered);
151
+ };
152
+ }
153
+ function curry(fn, arity = fn.length) {
154
+ return function curried(...args) {
155
+ if (args.length >= arity) {
156
+ return fn.apply(this, args);
157
+ }
158
+ return function(...nextArgs) {
159
+ return curried.apply(this, [...args, ...nextArgs]);
160
+ };
161
+ };
162
+ }
163
+ function compose(...fns) {
164
+ return fns.reduceRight(
165
+ (prevFn, nextFn) => (value) => nextFn(prevFn(value)),
166
+ (value) => value
167
+ );
168
+ }
169
+ function pipe(...fns) {
170
+ return fns.reduce(
171
+ (prevFn, nextFn) => (value) => nextFn(prevFn(value)),
172
+ (value) => value
173
+ );
174
+ }
175
+ function negate(predicate) {
176
+ return function(...args) {
177
+ return !predicate.apply(this, args);
178
+ };
179
+ }
180
+ function overArgs(fn, ...transforms) {
181
+ return function(...args) {
182
+ const transformedArgs = args.map(
183
+ (arg, index) => transforms[index] ? transforms[index](arg) : arg
184
+ );
185
+ return fn.apply(this, transformedArgs);
186
+ };
187
+ }
188
+ function partial(fn, ...partials) {
189
+ return function(...args) {
190
+ return fn.apply(this, [...partials, ...args]);
191
+ };
192
+ }
193
+ function partialRight(fn, ...partials) {
194
+ return function(...args) {
195
+ return fn.apply(this, [...args, ...partials]);
196
+ };
197
+ }
198
+ function bind(fn, thisArg, ...partials) {
199
+ return function(...args) {
200
+ return fn.apply(thisArg, [...partials, ...args]);
201
+ };
202
+ }
203
+ function flip(fn) {
204
+ return function(...args) {
205
+ return fn.apply(this, args.reverse());
206
+ };
207
+ }
208
+ function ary(fn, n) {
209
+ return function(...args) {
210
+ return fn.apply(this, args.slice(0, n));
211
+ };
212
+ }
213
+ function unary(fn) {
214
+ return function(arg) {
215
+ return fn.call(this, arg);
216
+ };
217
+ }
218
+ function defer(fn, ...args) {
219
+ return setTimeout(fn, 1, ...args);
220
+ }
221
+ function delay(fn, wait, ...args) {
222
+ return setTimeout(fn, wait, ...args);
223
+ }
224
+ function memoizeWithTTL(fn, ttl, resolver) {
225
+ const cache = /* @__PURE__ */ new Map();
226
+ const memoized = function(...args) {
227
+ const key = resolver ? resolver(...args) : JSON.stringify(args);
228
+ const now = Date.now();
229
+ const cached = cache.get(key);
230
+ if (cached && cached.expires > now) {
231
+ return cached.value;
232
+ }
233
+ const result = fn.apply(this, args);
234
+ cache.set(key, { value: result, expires: now + ttl });
235
+ for (const [k, v] of cache.entries()) {
236
+ if (v.expires <= now) {
237
+ cache.delete(k);
238
+ }
239
+ }
240
+ return result;
241
+ };
242
+ memoized.cache = cache;
243
+ return memoized;
244
+ }
245
+ function before(fn, n) {
246
+ let result;
247
+ let callCount = 0;
248
+ return function(...args) {
249
+ if (++callCount < n) {
250
+ result = fn.apply(this, args);
251
+ }
252
+ if (callCount >= n) {
253
+ fn = void 0;
254
+ }
255
+ return result;
256
+ };
257
+ }
258
+ function after(fn, n) {
259
+ let callCount = 0;
260
+ return function(...args) {
261
+ if (++callCount >= n) {
262
+ return fn.apply(this, args);
263
+ }
264
+ return void 0;
265
+ };
266
+ }
267
+ function tryCatch(fn, errorHandler) {
268
+ return function(...args) {
269
+ try {
270
+ return fn.apply(this, args);
271
+ } catch (error) {
272
+ return errorHandler(error, ...args);
273
+ }
274
+ };
275
+ }
276
+ function flow(...fns) {
277
+ return pipe(...fns);
278
+ }
279
+ function flowRight(...fns) {
280
+ return compose(...fns);
281
+ }
282
+ function retry(fn, options = {}) {
283
+ const { retries = 3, delay: delay2 = 1e3, backoff = 2, onRetry } = options;
284
+ return async function(...args) {
285
+ let lastError;
286
+ let currentDelay = delay2;
287
+ for (let attempt = 0; attempt <= retries; attempt++) {
288
+ try {
289
+ return await fn.apply(this, args);
290
+ } catch (error) {
291
+ lastError = error;
292
+ if (attempt < retries) {
293
+ if (onRetry) {
294
+ onRetry(lastError, attempt + 1);
295
+ }
296
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
297
+ currentDelay *= backoff;
298
+ }
299
+ }
300
+ }
301
+ throw lastError;
302
+ };
303
+ }
304
+ function withTimeout(fn, timeout, onTimeout) {
305
+ return async function(...args) {
306
+ return Promise.race([
307
+ fn.apply(this, args),
308
+ new Promise(
309
+ (_, reject) => setTimeout(() => {
310
+ if (onTimeout) onTimeout();
311
+ reject(new Error(`Function timed out after ${timeout}ms`));
312
+ }, timeout)
313
+ )
314
+ ]);
315
+ };
316
+ }
317
+ export {
318
+ after,
319
+ ary,
320
+ before,
321
+ bind,
322
+ compose,
323
+ curry,
324
+ debounce,
325
+ defer,
326
+ delay,
327
+ flip,
328
+ flow,
329
+ flowRight,
330
+ isAsyncFunction,
331
+ isFunction,
332
+ isPromise,
333
+ memoize,
334
+ memoizeWithTTL,
335
+ negate,
336
+ once,
337
+ overArgs,
338
+ partial,
339
+ partialRight,
340
+ pipe,
341
+ rearg,
342
+ retry,
343
+ throttle,
344
+ tryCatch,
345
+ unary,
346
+ withTimeout
347
+ };
@@ -1 +1,18 @@
1
- "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(o,e,x,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of b(e))!c.call(o,p)&&p!==x&&t(o,p,{get:()=>e[p],enumerable:!(r=a(e,p))||r.enumerable});return o};var f=o=>d(t({},"__esModule",{value:!0}),o);var g={};module.exports=f(g);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/lib/functions/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
@@ -1 +1,78 @@
1
- "use strict";var u=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(n,e)=>{for(var r in e)u(n,r,{get:e[r],enumerable:!0})},m=(n,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!c.call(n,t)&&t!==r&&u(n,t,{get:()=>e[t],enumerable:!(o=s(e,t))||o.enumerable});return n};var y=n=>m(u({},"__esModule",{value:!0}),n);var w={};a(w,{generateID:()=>k,generateUUID:()=>U,getKind:()=>T,isDefined:()=>b,isNull:()=>g,isPrimitive:()=>d,isUndefined:()=>v,isUndefinedOrNull:()=>O});module.exports=y(w);var x=require("@fluixi/utils/primitive"),i=require("@fluixi/utils/object"),f=require("@fluixi/utils/array"),l=require("@fluixi/utils/functions");function g(n){return n===null}function v(n){return n===void 0}var O=n=>typeof n>"u"||n===null;function d(n){let e=typeof n;return n===null||e==="string"||e==="number"||e==="boolean"||e==="symbol"||e==="bigint"||e==="undefined"||(0,x.isDate)(n)}function b(n){return n!=null}function T(n){return n===null?"null":n===void 0?"undefined":(0,x.isDate)(n)?"date":(0,i.isClass)(n)?"class":(0,l.isFunction)(n)?"function":(0,f.isArray)(n)?"array":d(n)?"primitive":(0,i.isObject)(n)?"object":"primitive"}var U=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),k=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(n){let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lib/helpers.ts
21
+ var helpers_exports = {};
22
+ __export(helpers_exports, {
23
+ generateID: () => generateID,
24
+ generateUUID: () => generateUUID,
25
+ getKind: () => getKind,
26
+ isDefined: () => isDefined,
27
+ isNull: () => isNull,
28
+ isPrimitive: () => isPrimitive,
29
+ isUndefined: () => isUndefined,
30
+ isUndefinedOrNull: () => isUndefinedOrNull
31
+ });
32
+ module.exports = __toCommonJS(helpers_exports);
33
+ var import_primitive = require("@fluixi/utils/primitive");
34
+ var import_object = require("@fluixi/utils/object");
35
+ var import_array = require("@fluixi/utils/array");
36
+ var import_functions = require("@fluixi/utils/functions");
37
+ function isNull(v) {
38
+ return v === null;
39
+ }
40
+ function isUndefined(v) {
41
+ return v === void 0;
42
+ }
43
+ var isUndefinedOrNull = (element) => {
44
+ if (typeof element === "undefined" || element === null) return true;
45
+ return false;
46
+ };
47
+ function isPrimitive(v) {
48
+ const type = typeof v;
49
+ return v === null || type === "string" || type === "number" || type === "boolean" || type === "symbol" || type === "bigint" || type === "undefined" || (0, import_primitive.isDate)(v);
50
+ }
51
+ function isDefined(obj) {
52
+ return obj !== void 0 && obj !== null;
53
+ }
54
+ function getKind(obj) {
55
+ if (obj === null) return "null";
56
+ if (obj === void 0) return "undefined";
57
+ if ((0, import_primitive.isDate)(obj)) return "date";
58
+ if ((0, import_object.isClass)(obj)) return "class";
59
+ if ((0, import_functions.isFunction)(obj)) return "function";
60
+ if ((0, import_array.isArray)(obj)) return "array";
61
+ if (isPrimitive(obj)) return "primitive";
62
+ if ((0, import_object.isObject)(obj)) return "object";
63
+ return "primitive";
64
+ }
65
+ var generateUUID = () => {
66
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
67
+ let r = Math.random() * 16 | 0;
68
+ let v = c === "x" ? r : r & 3 | 8;
69
+ return v.toString(16);
70
+ });
71
+ };
72
+ var generateID = () => {
73
+ return "xxyxxxxxxy-4xx8".replace(/[xy]/g, function(c) {
74
+ let r = Math.random() * 16 | 0;
75
+ let v = c === "x" ? r : r & 3 | 8;
76
+ return v.toString(16);
77
+ });
78
+ };
@@ -1 +1,59 @@
1
- import{isDate as r}from"@fluixi/utils/primitive";import{isClass as i,isObject as u}from"@fluixi/utils/object";import{isArray as x}from"@fluixi/utils/array";import{isFunction as o}from"@fluixi/utils/functions";function y(n){return n===null}function g(n){return n===void 0}var v=n=>typeof n>"u"||n===null;function f(n){let e=typeof n;return n===null||e==="string"||e==="number"||e==="boolean"||e==="symbol"||e==="bigint"||e==="undefined"||r(n)}function O(n){return n!=null}function b(n){return n===null?"null":n===void 0?"undefined":r(n)?"date":i(n)?"class":o(n)?"function":x(n)?"array":f(n)?"primitive":u(n)?"object":"primitive"}var T=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),U=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(n){let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)});export{U as generateID,T as generateUUID,b as getKind,O as isDefined,y as isNull,f as isPrimitive,g as isUndefined,v as isUndefinedOrNull};
1
+ // src/lib/helpers.ts
2
+ import {
3
+ isDate
4
+ } from "@fluixi/utils/primitive";
5
+ import { isClass, isObject } from "@fluixi/utils/object";
6
+ import { isArray } from "@fluixi/utils/array";
7
+ import { isFunction } from "@fluixi/utils/functions";
8
+ function isNull(v) {
9
+ return v === null;
10
+ }
11
+ function isUndefined(v) {
12
+ return v === void 0;
13
+ }
14
+ var isUndefinedOrNull = (element) => {
15
+ if (typeof element === "undefined" || element === null) return true;
16
+ return false;
17
+ };
18
+ function isPrimitive(v) {
19
+ const type = typeof v;
20
+ return v === null || type === "string" || type === "number" || type === "boolean" || type === "symbol" || type === "bigint" || type === "undefined" || isDate(v);
21
+ }
22
+ function isDefined(obj) {
23
+ return obj !== void 0 && obj !== null;
24
+ }
25
+ function getKind(obj) {
26
+ if (obj === null) return "null";
27
+ if (obj === void 0) return "undefined";
28
+ if (isDate(obj)) return "date";
29
+ if (isClass(obj)) return "class";
30
+ if (isFunction(obj)) return "function";
31
+ if (isArray(obj)) return "array";
32
+ if (isPrimitive(obj)) return "primitive";
33
+ if (isObject(obj)) return "object";
34
+ return "primitive";
35
+ }
36
+ var generateUUID = () => {
37
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
38
+ let r = Math.random() * 16 | 0;
39
+ let v = c === "x" ? r : r & 3 | 8;
40
+ return v.toString(16);
41
+ });
42
+ };
43
+ var generateID = () => {
44
+ return "xxyxxxxxxy-4xx8".replace(/[xy]/g, function(c) {
45
+ let r = Math.random() * 16 | 0;
46
+ let v = c === "x" ? r : r & 3 | 8;
47
+ return v.toString(16);
48
+ });
49
+ };
50
+ export {
51
+ generateID,
52
+ generateUUID,
53
+ getKind,
54
+ isDefined,
55
+ isNull,
56
+ isPrimitive,
57
+ isUndefined,
58
+ isUndefinedOrNull
59
+ };