@hyperfrontend/time-utils 0.0.1 → 0.0.3

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/index.esm.js CHANGED
@@ -1,3 +1,89 @@
1
+ /**
2
+ * Safe copies of Date built-in via factory function and static methods.
3
+ *
4
+ * Since constructors cannot be safely captured via Object.assign, this module
5
+ * provides a factory function that uses Reflect.construct internally.
6
+ *
7
+ * These references are captured at module initialization time to protect against
8
+ * prototype pollution attacks. Import only what you need for tree-shaking.
9
+ *
10
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/date
11
+ */
12
+ // Capture references at module initialization time
13
+ const _Date = globalThis.Date;
14
+ const _Reflect$2 = globalThis.Reflect;
15
+ function createDate(...args) {
16
+ return _Reflect$2.construct(_Date, args);
17
+ }
18
+ /**
19
+ * (Safe copy) Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
20
+ */
21
+ const dateNow = _Date.now;
22
+
23
+ /**
24
+ * Safe copies of Object built-in methods.
25
+ *
26
+ * These references are captured at module initialization time to protect against
27
+ * prototype pollution attacks. Import only what you need for tree-shaking.
28
+ *
29
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/object
30
+ */
31
+ // Capture references at module initialization time
32
+ const _Object = globalThis.Object;
33
+ /**
34
+ * (Safe copy) Prevents modification of existing property attributes and values,
35
+ * and prevents the addition of new properties.
36
+ */
37
+ const freeze = _Object.freeze;
38
+
39
+ /**
40
+ * Safe copies of Timer/Scheduling built-in functions.
41
+ *
42
+ * These references are captured at module initialization time to protect against
43
+ * prototype pollution attacks. Import only what you need for tree-shaking.
44
+ *
45
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/timers
46
+ */
47
+ // Capture references at module initialization time
48
+ const _setTimeout = globalThis.setTimeout;
49
+ const _setInterval = globalThis.setInterval;
50
+ const _clearTimeout = globalThis.clearTimeout;
51
+ const _clearInterval = globalThis.clearInterval;
52
+ /**
53
+ * (Safe copy) Sets a timer which executes a function once the timer expires.
54
+ *
55
+ * @param callback - Function to call when the timer elapses.
56
+ * @param delay - Time in milliseconds before executing.
57
+ * @param args - Additional arguments to pass to the callback.
58
+ * @returns A numeric ID for the timer.
59
+ */
60
+ const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
61
+ /**
62
+ * (Safe copy) Repeatedly calls a function with a fixed time delay between each call.
63
+ *
64
+ * @param callback - Function to call at each interval.
65
+ * @param delay - Time in milliseconds between calls.
66
+ * @param args - Additional arguments to pass to the callback.
67
+ * @returns A numeric ID for the interval.
68
+ */
69
+ const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
70
+ /**
71
+ * (Safe copy) Cancels a timeout previously established by setTimeout.
72
+ *
73
+ * @param id - The identifier of the timeout to cancel.
74
+ */
75
+ const clearTimeout = (id) => {
76
+ _clearTimeout(id);
77
+ };
78
+ /**
79
+ * (Safe copy) Cancels a timed, repeating action previously established by setInterval.
80
+ *
81
+ * @param id - The identifier of the interval to cancel.
82
+ */
83
+ const clearInterval = (id) => {
84
+ _clearInterval(id);
85
+ };
86
+
1
87
  /**
2
88
  * Creates an interval loop that invokes one or more subscribed callback functions
3
89
  * at the specified internal (in milliseconds).
@@ -14,7 +100,7 @@ function createClock(interval = 1000) {
14
100
  const start = () => {
15
101
  if (clockId === null) {
16
102
  clockId = setInterval(() => {
17
- const currentTime = new Date();
103
+ const currentTime = createDate();
18
104
  subscribers.forEach((subscriber) => subscriber(currentTime));
19
105
  }, interval);
20
106
  }
@@ -31,7 +117,7 @@ function createClock(interval = 1000) {
31
117
  const unsubscribe = (callback) => {
32
118
  subscribers = subscribers.filter((subscriber) => subscriber !== callback);
33
119
  };
34
- return Object.freeze({ start, stop, subscribe, unsubscribe, interval });
120
+ return freeze({ start, stop, subscribe, unsubscribe, interval });
35
121
  }
36
122
 
37
123
  /**
@@ -49,7 +135,7 @@ function createTimer(callback, delay) {
49
135
  const pause = () => {
50
136
  if (timerId !== null) {
51
137
  clearTimeout(timerId);
52
- const now = Date.now();
138
+ const now = dateNow();
53
139
  /* istanbul ignore else - start is always set when timerId is not null */
54
140
  if (start !== null) {
55
141
  remaining -= now - start;
@@ -59,7 +145,7 @@ function createTimer(callback, delay) {
59
145
  };
60
146
  const resume = () => {
61
147
  if (timerId === null) {
62
- start = Date.now();
148
+ start = dateNow();
63
149
  timerId = setTimeout(() => {
64
150
  callback();
65
151
  timerId = null;
@@ -71,9 +157,66 @@ function createTimer(callback, delay) {
71
157
  remaining = newDelay;
72
158
  resume();
73
159
  };
74
- return Object.freeze({ pause, resume, reset });
160
+ return freeze({ pause, resume, reset });
75
161
  }
76
162
 
163
+ /**
164
+ * Safe copies of Error built-ins via factory functions.
165
+ *
166
+ * Since constructors cannot be safely captured via Object.assign, this module
167
+ * provides factory functions that use Reflect.construct internally.
168
+ *
169
+ * These references are captured at module initialization time to protect against
170
+ * prototype pollution attacks. Import only what you need for tree-shaking.
171
+ *
172
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/error
173
+ */
174
+ // Capture references at module initialization time
175
+ const _Error = globalThis.Error;
176
+ const _Reflect$1 = globalThis.Reflect;
177
+ /**
178
+ * (Safe copy) Creates a new Error using the captured Error constructor.
179
+ * Use this instead of `new Error()`.
180
+ *
181
+ * @param message - Optional error message.
182
+ * @param options - Optional error options.
183
+ * @returns A new Error instance.
184
+ */
185
+ const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
186
+
187
+ /**
188
+ * Safe copies of Math built-in methods.
189
+ *
190
+ * These references are captured at module initialization time to protect against
191
+ * prototype pollution attacks. Import only what you need for tree-shaking.
192
+ *
193
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/math
194
+ */
195
+ // Capture references at module initialization time
196
+ const _Math = globalThis.Math;
197
+ /**
198
+ * (Safe copy) Returns the largest integer less than or equal to a number.
199
+ */
200
+ const floor = _Math.floor;
201
+
202
+ /**
203
+ * Safe copies of Number built-in methods and constants.
204
+ *
205
+ * These references are captured at module initialization time to protect against
206
+ * prototype pollution attacks. Import only what you need for tree-shaking.
207
+ *
208
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/number
209
+ */
210
+ // Capture references at module initialization time
211
+ const _isNaN = globalThis.isNaN;
212
+ // ============================================================================
213
+ // Global Type Checking (legacy, less strict)
214
+ // ============================================================================
215
+ /**
216
+ * (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).
217
+ */
218
+ const globalIsNaN = _isNaN;
219
+
77
220
  /**
78
221
  * Normalizes a given time to the nearest base time window.
79
222
  *
@@ -82,16 +225,16 @@ function createTimer(callback, delay) {
82
225
  * @returns A new Date object normalized to the start of the time window
83
226
  */
84
227
  function normalizeToBaseTimeWindow(time, baseTimeWindow) {
85
- if (!time || !(time instanceof Date) || isNaN(time.getTime())) {
86
- throw new Error('Invalid time input');
228
+ if (!time || !(time instanceof Date) || globalIsNaN(time.getTime())) {
229
+ throw createError('Invalid time input');
87
230
  }
88
231
  if (baseTimeWindow <= 0) {
89
- throw new Error('Base time window must be positive');
232
+ throw createError('Base time window must be positive');
90
233
  }
91
234
  const timeInMs = time.getTime();
92
235
  const windowInMs = baseTimeWindow * 60 * 1000;
93
- const normalizedTimeInMs = Math.floor(timeInMs / windowInMs) * windowInMs;
94
- return new Date(normalizedTimeInMs);
236
+ const normalizedTimeInMs = floor(timeInMs / windowInMs) * windowInMs;
237
+ return createDate(normalizedTimeInMs);
95
238
  }
96
239
 
97
240
  /**
@@ -106,6 +249,59 @@ function setIntervalCallback(callback, interval) {
106
249
  return () => clearInterval(timerId);
107
250
  }
108
251
 
252
+ /**
253
+ * Safe copies of Promise built-in methods via factory functions.
254
+ *
255
+ * Since constructors cannot be safely captured via Object.assign, this module
256
+ * provides factory functions that use Reflect.construct internally.
257
+ *
258
+ * These references are captured at module initialization time to protect against
259
+ * prototype pollution attacks. Import only what you need for tree-shaking.
260
+ *
261
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/promise
262
+ */
263
+ // Capture references at module initialization time
264
+ const _Promise = globalThis.Promise;
265
+ const _Reflect = globalThis.Reflect;
266
+ /**
267
+ * (Safe copy) Creates a new Promise using the captured Promise constructor.
268
+ * Use this instead of `new Promise()`.
269
+ *
270
+ * @param executor - The executor function.
271
+ * @returns A new Promise instance.
272
+ */
273
+ const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
274
+ /**
275
+ * (Safe copy) Returns a Promise that resolves with the given value.
276
+ */
277
+ _Promise.resolve.bind(_Promise);
278
+ /**
279
+ * (Safe copy) Returns a Promise that rejects with the given reason.
280
+ */
281
+ _Promise.reject.bind(_Promise);
282
+ /**
283
+ * (Safe copy) Returns a Promise that resolves when all promises resolve.
284
+ */
285
+ _Promise.all.bind(_Promise);
286
+ /**
287
+ * (Safe copy) Returns a Promise that resolves/rejects with the first settled promise.
288
+ */
289
+ _Promise.race.bind(_Promise);
290
+ /**
291
+ * (Safe copy) Returns a Promise that resolves when all promises settle.
292
+ */
293
+ _Promise.allSettled.bind(_Promise);
294
+ /**
295
+ * (Safe copy) Returns a Promise that resolves with the first fulfilled promise.
296
+ */
297
+ _Promise.any.bind(_Promise);
298
+ /**
299
+ * (Safe copy) Creates a Promise along with its resolve and reject functions.
300
+ * Note: Available only in ES2024+ environments.
301
+ */
302
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
303
+ _Promise.withResolvers?.bind(_Promise);
304
+
109
305
  /**
110
306
  * Pauses execution for a specified duration.
111
307
  *
@@ -113,7 +309,7 @@ function setIntervalCallback(callback, interval) {
113
309
  * @returns A promise that resolves after the specified duration
114
310
  */
115
311
  function sleep(milliseconds) {
116
- return new Promise((resolve) => setTimeout(resolve, milliseconds));
312
+ return createPromise((resolve) => setTimeout(resolve, milliseconds));
117
313
  }
118
314
 
119
315
  export { createClock, createTimer, normalizeToBaseTimeWindow, setIntervalCallback, sleep };
package/index.esm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../libs/utils/time/src/create-clock.ts","../../../../libs/utils/time/src/create-timer.ts","../../../../libs/utils/time/src/normalize-to-base-time-window.ts","../../../../libs/utils/time/src/set-interval-callback.ts","../../../../libs/utils/time/src/sleep.ts"],"sourcesContent":[null,null,null,null,null],"names":[],"mappings":"AASA;;;;;;;;;AASG;AACG,SAAU,WAAW,CAAC,QAAQ,GAAG,IAAI,EAAA;IACzC,IAAI,OAAO,GAA0B,IAAI;IACzC,IAAI,WAAW,GAAoC,EAAE;IAErD,MAAM,KAAK,GAAG,MAAW;AACvB,QAAA,IAAI,OAAO,KAAK,IAAI,EAAE;AACpB,YAAA,OAAO,GAAG,WAAW,CAAC,MAAK;AACzB,gBAAA,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE;AAC9B,gBAAA,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,WAAW,CAAC,CAAC;YAC9D,CAAC,EAAE,QAAQ,CAAC;QACd;AACF,IAAA,CAAC;IAED,MAAM,IAAI,GAAG,MAAW;AACtB,QAAA,IAAI,OAAO,KAAK,IAAI,EAAE;YACpB,aAAa,CAAC,OAAO,CAAC;YACtB,OAAO,GAAG,IAAI;QAChB;AACF,IAAA,CAAC;AAED,IAAA,MAAM,SAAS,GAAG,CAAC,QAAqC,KAAU;AAChE,QAAA,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC5B,IAAA,CAAC;AAED,IAAA,MAAM,WAAW,GAAG,CAAC,QAAqC,KAAU;AAClE,QAAA,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,KAAK,UAAU,KAAK,QAAQ,CAAC;AAC3E,IAAA,CAAC;AAED,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACzE;;ACvCA;;;;;;;AAOG;AACG,SAAU,WAAW,CAAC,QAAoB,EAAE,KAAa,EAAA;IAC7D,IAAI,OAAO,GAA0B,IAAI;IACzC,IAA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,GAAG,IAAI,CAAC,OAAO,EAAE;AAC/B,IAAA,MAAM,UAAU,GAAG,cAAc,GAAG,EAAE,GAAG,IAAI;AAC7C,IAAA,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,UAAU;AACzE,IAAA,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACrC;;ACpBA;;;;;;AAMG;AACG,SAAU,mBAAmB,CAAC,QAAoB,EAAE,QAAgB,EAAA;IACxE,MAAM,OAAO,GAAmB,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAC/D,IAAA,OAAO,MAAY,aAAa,CAAC,OAAO,CAAC;AAC3C;;ACVA;;;;;AAKG;AACG,SAAU,KAAK,CAAC,YAAoB,EAAA;AACxC,IAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACpE;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../../../../../libs/utils/immutable-api/src/built-in-copy/date/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/object/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/timers/index.ts","../../../../../../../../libs/utils/time/src/create-clock.ts","../../../../../../../../libs/utils/time/src/create-timer.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/number/index.ts","../../../../../../../../libs/utils/time/src/normalize-to-base-time-window.ts","../../../../../../../../libs/utils/time/src/set-interval-callback.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/promise/index.ts","../../../../../../../../libs/utils/time/src/sleep.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":["_Reflect"],"mappings":"AAAA;;;;;;;;;;AAUG;AAEH;AACA,MAAM,KAAK,GAAG,UAAU,CAAC,IA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AC5DhF;;;;;AAKG;AACG,SAAU,KAAK,CAAC,YAAoB,EAAA;AACxC,IAAA,OAAO,aAAa,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-to-base-time-window.d.ts","sourceRoot":"","sources":["../../../../libs/utils/time/src/normalize-to-base-time-window.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAalF"}
1
+ {"version":3,"file":"normalize-to-base-time-window.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/time/src/normalize-to-base-time-window.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAalF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperfrontend/time-utils",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Functional time utilities for async operations, intervals, and time normalization.",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
@@ -26,19 +26,6 @@
26
26
  "functional",
27
27
  "immutable"
28
28
  ],
29
- "main": "./index.cjs.js",
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/AndrewRedican/hyperfrontend.git"
33
- },
34
- "bugs": {
35
- "url": "https://github.com/AndrewRedican/hyperfrontend/issues"
36
- },
37
- "homepage": "https://github.com/AndrewRedican/hyperfrontend#readme",
38
- "author": {
39
- "name": "andrew.redican.mejia@gmail.com",
40
- "url": "https://hyperfrontend.dev"
41
- },
42
29
  "exports": {
43
30
  "./package.json": "./package.json",
44
31
  ".": {
@@ -51,6 +38,19 @@
51
38
  "require": "./bundle/index.iife.min.js"
52
39
  }
53
40
  },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/AndrewRedican/hyperfrontend.git"
44
+ },
45
+ "bugs": {
46
+ "url": "https://github.com/AndrewRedican/hyperfrontend/issues"
47
+ },
48
+ "homepage": "https://github.com/AndrewRedican/hyperfrontend#readme",
49
+ "author": {
50
+ "name": "andrew.redican.mejia@gmail.com",
51
+ "url": "https://hyperfrontend.dev"
52
+ },
53
+ "main": "./index.cjs.js",
54
54
  "module": "./index.esm.js",
55
55
  "types": "./index.d.ts",
56
56
  "unpkg": "./bundle/index.umd.min.js",
@@ -1 +1 @@
1
- {"version":3,"file":"set-interval-callback.d.ts","sourceRoot":"","sources":["../../../../libs/utils/time/src/set-interval-callback.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,IAAI,CAGtF"}
1
+ {"version":3,"file":"set-interval-callback.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/time/src/set-interval-callback.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,IAAI,CAGtF"}
package/sleep.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../libs/utils/time/src/sleep.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzD"}
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/time/src/sleep.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzD"}