@tempots/std 0.16.1 → 0.18.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/array.js CHANGED
@@ -46,7 +46,7 @@ const q = (t, n) => Array.from({ length: t.length }, (e, r) => n(t[r], r)), B =
46
46
  if (a !== 0) return a;
47
47
  }
48
48
  return 0;
49
- }, C = (t, n) => t.slice().sort(n), g = (t, n) => Array.from({ length: t }, (e, r) => n(r)), L = (t, n = 0) => g(t, (e) => n + e), R = (t, n) => g(t, () => n), V = (t) => Array.from(new Set(t)), W = (t, n) => {
49
+ }, C = (t, n) => t.slice().sort(n), d = (t, n) => Array.from({ length: t }, (e, r) => n(r)), L = (t, n = 0) => d(t, (e) => n + e), R = (t, n) => d(t, () => n), V = (t) => Array.from(new Set(t)), W = (t, n) => {
50
50
  const e = {};
51
51
  return t.forEach((r) => {
52
52
  e[n(r)] = r;
@@ -98,8 +98,8 @@ const q = (t, n) => Array.from({ length: t.length }, (e, r) => n(t[r], r)), B =
98
98
  for (let s = 0; s < A.length; s++) {
99
99
  const o = e(A[s]), i = m.get(o);
100
100
  if (i == null || s === i) continue;
101
- const d = e(p[s]);
102
- m.delete(d), u.push({ from: s, to: i });
101
+ const g = e(p[s]);
102
+ m.delete(g), u.push({ from: s, to: i });
103
103
  }
104
104
  return r;
105
105
  }, U = (t, n) => {
@@ -144,7 +144,7 @@ export {
144
144
  D as flattenArray,
145
145
  P as foldLeftArray,
146
146
  T as forEachElement,
147
- g as generateArray,
147
+ d as generateArray,
148
148
  L as generateSequenceArray,
149
149
  I as isArrayEmpty,
150
150
  X as joinArrayWithConjunction,
package/deferred.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * const { promise, resolve, reject } = deferred<number>()
8
8
  *
9
9
  * promise.then((value) => {
10
- * console.log(value)
10
+ * console.warn(value)
11
11
  * })
12
12
  *
13
13
  * resolve(42)
package/function.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=e=>e,o=e=>t=>(...r)=>e(t,...r),n=e=>{let t;return()=>(t===void 0&&(t=e()),t)};exports.curryLeft=o;exports.identity=i;exports.memoize=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=e=>e,n=e=>t=>(...r)=>e(t,...r),o=e=>{let t;return()=>(t===void 0&&(t=e()),t)};exports.curryLeft=n;exports.identity=i;exports.memoize=o;
package/function.js CHANGED
@@ -1,9 +1,9 @@
1
- const n = (t) => t, o = (t) => (e) => (...r) => t(e, ...r), i = (t) => {
2
- let e;
3
- return () => (e === void 0 && (e = t()), e);
1
+ const r = (e) => e, i = (e) => (t) => (...n) => e(t, ...n), o = (e) => {
2
+ let t;
3
+ return () => (t === void 0 && (t = e()), t);
4
4
  };
5
5
  export {
6
- o as curryLeft,
7
- n as identity,
8
- i as memoize
6
+ i as curryLeft,
7
+ r as identity,
8
+ o as memoize
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/std",
3
- "version": "0.16.1",
3
+ "version": "0.18.0",
4
4
  "priority": 8,
5
5
  "description": "Std library for TypeScript. Natural complement to the Tempo libraries.",
6
6
  "keywords": [
package/timer.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=(e,t)=>{const n=setTimeout(e,t);return()=>clearTimeout(n)},w=(e,t)=>{const n=setInterval(e,t);return()=>clearInterval(n)},p=(e,t,n={})=>{const{noTrailing:s=!1,noLeading:u=!1,debounceMode:c}=n;let o,f=!1,i=0;function d(){o&&clearTimeout(o)}function b(a){const{upcomingOnly:r=!1}=a||{};d(),f=!r}function m(...a){if(f)return;const r=this,v=Date.now()-i;function l(){i=Date.now(),t.apply(r,a)}function T(){o=void 0}!u&&c&&!o&&l(),d(),c===void 0&&v>e?u?(i=Date.now(),s||(o=setTimeout(c?T:l,e))):l():s||(o=setTimeout(c?T:l,c===void 0?e-v:e))}return m.cancel=b,m},D=(e,t,{atBegin:n=!1}={})=>p(e,t,{debounceMode:n!==!1});exports.debounce=D;exports.delayed=g;exports.interval=w;exports.throttle=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=(e,t)=>{const n=setTimeout(e,t);return()=>clearTimeout(n)},w=(e,t)=>{const n=setInterval(e,t);return()=>clearInterval(n)},b=(e,t,n={})=>{const{noTrailing:s=!1,noLeading:u=!1,debounceMode:c}=n;let o,f=!1,i=0;function d(){o&&clearTimeout(o)}function g(a){const{upcomingOnly:r=!1}=a||{};d(),f=!r}function m(...a){if(f)return;const r=this,T=Date.now()-i;function l(){i=Date.now(),t.apply(r,a)}function p(){o=void 0}!u&&c&&!o&&l(),d(),c===void 0&&T>e?u?(i=Date.now(),s||(o=setTimeout(c?p:l,e))):l():s||(o=setTimeout(c?p:l,c===void 0?e-T:e))}return m.cancel=g,m},D=(e,t,{atBegin:n=!1}={})=>b(e,t,{debounceMode:n!==!1});exports.debounce=D;exports.delayed=v;exports.interval=w;exports.throttle=b;
package/timer.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * @example
7
7
  * ```ts
8
8
  * // Delay a function for 1 second
9
- * const cancel = delayed(() => console.log('Hello!'), 1000);
9
+ * const cancel = delayed(() => console.warn('Hello!'), 1000);
10
10
  *
11
11
  * // Cancel the delayed execution if needed
12
12
  * cancel();
@@ -22,7 +22,7 @@ export declare const delayed: (fn: () => void, ms: number) => () => void;
22
22
  * @example
23
23
  * ```ts
24
24
  * // Execute a function every 2 seconds
25
- * const stop = interval(() => console.log('Tick'), 2000);
25
+ * const stop = interval(() => console.warn('Tick'), 2000);
26
26
  *
27
27
  * // Stop the interval after some time
28
28
  * setTimeout(() => stop(), 10000);
@@ -102,7 +102,7 @@ export interface ThrottledFunction<T extends unknown[]> {
102
102
  * ```ts
103
103
  * // Create a throttled function that executes at most once every second
104
104
  * const throttledScroll = throttle(1000, () => {
105
- * console.log('Scroll event handled');
105
+ * console.warn('Scroll event handled');
106
106
  * });
107
107
  *
108
108
  * // Attach to scroll event
package/timer.js CHANGED
@@ -1,16 +1,16 @@
1
- const w = (e, t) => {
2
- const n = setTimeout(e, t);
3
- return () => clearTimeout(n);
4
- }, x = (e, t) => {
5
- const n = setInterval(e, t);
6
- return () => clearInterval(n);
7
- }, g = (e, t, n = {}) => {
8
- const { noTrailing: r = !1, noLeading: u = !1, debounceMode: c } = n;
1
+ const x = (e, n) => {
2
+ const t = setTimeout(e, n);
3
+ return () => clearTimeout(t);
4
+ }, D = (e, n) => {
5
+ const t = setInterval(e, n);
6
+ return () => clearInterval(t);
7
+ }, w = (e, n, t = {}) => {
8
+ const { noTrailing: r = !1, noLeading: u = !1, debounceMode: c } = t;
9
9
  let o, f = !1, l = 0;
10
10
  function d() {
11
11
  o && clearTimeout(o);
12
12
  }
13
- function v(s) {
13
+ function g(s) {
14
14
  const { upcomingOnly: a = !1 } = s || {};
15
15
  d(), f = !a;
16
16
  }
@@ -18,7 +18,7 @@ const w = (e, t) => {
18
18
  if (f) return;
19
19
  const a = this, p = Date.now() - l;
20
20
  function i() {
21
- l = Date.now(), t.apply(a, s);
21
+ l = Date.now(), n.apply(a, s);
22
22
  }
23
23
  function T() {
24
24
  o = void 0;
@@ -28,11 +28,11 @@ const w = (e, t) => {
28
28
  c === void 0 ? e - p : e
29
29
  ));
30
30
  }
31
- return m.cancel = v, m;
32
- }, D = (e, t, { atBegin: n = !1 } = {}) => g(e, t, { debounceMode: n !== !1 });
31
+ return m.cancel = g, m;
32
+ }, b = (e, n, { atBegin: t = !1 } = {}) => w(e, n, { debounceMode: t !== !1 });
33
33
  export {
34
- D as debounce,
35
- w as delayed,
36
- x as interval,
37
- g as throttle
34
+ b as debounce,
35
+ x as delayed,
36
+ D as interval,
37
+ w as throttle
38
38
  };