πŸš€ Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more β†’
Sign In

@hyperfrontend/time-utils

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperfrontend/time-utils - npm Package Compare versions

Comparing version
0.0.4
to
0.0.5
+10
_dependencies/@hyp...i-utils/built-in-copy/date/index.cjs.js
'use strict';
const _Date = globalThis.Date;
const _Reflect = globalThis.Reflect;
function createDate(...args) {
return _Reflect.construct(_Date, args);
}
const dateNow = _Date.now;
exports.createDate = createDate;
exports.dateNow = dateNow;
const _Date = globalThis.Date;
const _Reflect = globalThis.Reflect;
function createDate(...args) {
return _Reflect.construct(_Date, args);
}
const dateNow = _Date.now;
export { createDate, dateNow };
'use strict';
const _Error = globalThis.Error;
const _Reflect = globalThis.Reflect;
const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
exports.createError = createError;
const _Error = globalThis.Error;
const _Reflect = globalThis.Reflect;
const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
export { createError };
'use strict';
const _Math = globalThis.Math;
const floor = _Math.floor;
exports.floor = floor;
const _Math = globalThis.Math;
const floor = _Math.floor;
export { floor };
'use strict';
const _isNaN = globalThis.isNaN;
const globalIsNaN = _isNaN;
exports.globalIsNaN = globalIsNaN;
const _isNaN = globalThis.isNaN;
const globalIsNaN = _isNaN;
export { globalIsNaN };
'use strict';
const _Object = globalThis.Object;
const freeze = _Object.freeze;
exports.freeze = freeze;
const _Object = globalThis.Object;
const freeze = _Object.freeze;
export { freeze };
'use strict';
const _Promise = globalThis.Promise;
const _Reflect = globalThis.Reflect;
const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
exports.createPromise = createPromise;
const _Promise = globalThis.Promise;
const _Reflect = globalThis.Reflect;
const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
export { createPromise };
'use strict';
const _setTimeout = globalThis.setTimeout;
const _setInterval = globalThis.setInterval;
const _clearTimeout = globalThis.clearTimeout;
const _clearInterval = globalThis.clearInterval;
const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
const clearTimeout = (id) => {
_clearTimeout(id);
};
const clearInterval = (id) => {
_clearInterval(id);
};
exports.clearInterval = clearInterval;
exports.clearTimeout = clearTimeout;
exports.setInterval = setInterval;
exports.setTimeout = setTimeout;
const _setTimeout = globalThis.setTimeout;
const _setInterval = globalThis.setInterval;
const _clearTimeout = globalThis.clearTimeout;
const _clearInterval = globalThis.clearInterval;
const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
const clearTimeout = (id) => {
_clearTimeout(id);
};
const clearInterval = (id) => {
_clearInterval(id);
};
export { clearInterval, clearTimeout, setInterval, setTimeout };
+119
-24

@@ -7,13 +7,21 @@ var HyperfrontendTimeUtils = (function (exports) {

*
* Since constructors cannot be safely captured via Object.assign, this module
* provides a factory function that uses Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/date
*/
// Capture references at module initialization time
/* eslint-disable jsdoc/require-param */
const _Date = globalThis.Date;
const _Reflect$2 = globalThis.Reflect;
/**
* (Safe copy) Creates a new Date using the captured Date constructor.
* Use this instead of `new Date()`. Accepts all standard Date constructor signatures.
*
* @returns A new Date instance.
*
* @example Creating Date instances
* ```typescript
* const now = createDate()
* const fromTimestamp = createDate(1704067200000)
* const fromString = createDate('2024-01-01T00:00:00Z')
* const fromParts = createDate(2024, 0, 1, 12, 30, 0) // Jan 1, 2024 12:30:00
* ```
*/
function createDate(...args) {

@@ -24,2 +32,8 @@ return _Reflect$2.construct(_Date, args);

* (Safe copy) Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
*
* @example
* ```typescript
* const timestamp = dateNow()
* // => 1704067200000 (example timestamp)
* ```
*/

@@ -36,3 +50,2 @@ const dateNow = _Date.now;

*/
// Capture references at module initialization time
const _Object = globalThis.Object;

@@ -53,3 +66,2 @@ /**

*/
// Capture references at module initialization time
const _setTimeout = globalThis.setTimeout;

@@ -66,2 +78,9 @@ const _setInterval = globalThis.setInterval;

* @returns A numeric ID for the timer.
*
* @example Setting a timeout
* ```typescript
* const timerId = setTimeout(() => console.log('Executed'), 1000)
* // Pass arguments to callback
* setTimeout((name, count) => console.log(name, count), 500, 'items', 5)
* ```
*/

@@ -76,2 +95,11 @@ const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);

* @returns A numeric ID for the interval.
*
* @example Setting an interval
* ```typescript
* let count = 0
* const intervalId = setInterval(() => {
* count++
* if (count >= 5) clearInterval(intervalId)
* }, 1000)
* ```
*/

@@ -83,2 +111,8 @@ const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);

* @param id - The identifier of the timeout to cancel.
*
* @example Canceling a timeout
* ```typescript
* const timerId = setTimeout(() => console.log('Never runs'), 5000)
* clearTimeout(timerId)
* ```
*/

@@ -92,2 +126,9 @@ const clearTimeout = (id) => {

* @param id - The identifier of the interval to cancel.
*
* @example Canceling an interval
* ```typescript
* const intervalId = setInterval(() => console.log('tick'), 1000)
* // Stop after some condition
* clearInterval(intervalId)
* ```
*/

@@ -107,2 +148,17 @@ const clearInterval = (id) => {

* @returns A Clock instance with start, stop, subscribe, and unsubscribe methods
*
* @example Creating interval clock
* ```typescript
* const clock = createClock(1000)
*
* const updateDisplay = (currentTime: Date) => {
* console.log(currentTime.toISOString())
* }
*
* clock.subscribe(updateDisplay)
* clock.start()
*
* // Later: stop receiving updates
* clock.stop()
* ```
*/

@@ -142,2 +198,20 @@ function createClock(interval = 1000) {

* @returns A Timer instance with pause, resume, and reset methods
*
* @example Creating pausable timer
* ```typescript
* const timer = createTimer(() => {
* console.log('Session expired')
* }, 30_000)
*
* timer.resume() // Start the 30-second countdown
*
* // User activity detected - pause the timer
* timer.pause()
*
* // User idle again - resume from where we left off
* timer.resume()
*
* // Reset to full 30 seconds on explicit action
* timer.reset()
* ```
*/

@@ -187,3 +261,2 @@ function createTimer(callback, delay) {

*/
// Capture references at module initialization time
const _Error = globalThis.Error;

@@ -198,2 +271,9 @@ const _Reflect$1 = globalThis.Reflect;

* @returns A new Error instance.
*
* @example Creating Error instances
* ```typescript
* const error = createError('Operation failed')
* // With cause for error chaining
* const wrapped = createError('Request failed', { cause: originalError })
* ```
*/

@@ -210,3 +290,2 @@ const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);

*/
// Capture references at module initialization time
const _Math = globalThis.Math;

@@ -226,7 +305,3 @@ /**

*/
// Capture references at module initialization time
const _isNaN = globalThis.isNaN;
// ============================================================================
// Global Type Checking (legacy, less strict)
// ============================================================================
/**

@@ -243,2 +318,10 @@ * (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).

* @returns A new Date object normalized to the start of the time window
*
* @example Normalizing to 15-minute buckets
* ```typescript
* // Round timestamps to 15-minute intervals for analytics bucketing
* const eventTime = new Date('2024-03-15T14:23:45Z')
* const bucketTime = normalizeToBaseTimeWindow(eventTime, 15)
* // => 2024-03-15T14:15:00.000Z
* ```
*/

@@ -264,2 +347,12 @@ function normalizeToBaseTimeWindow(time, baseTimeWindow) {

* @returns A cleanup function that stops the interval when called
*
* @example Setting interval with cleanup
* ```typescript
* const stopPolling = setIntervalCallback(() => {
* fetchLatestData()
* }, 5000)
*
* // Later: clean up when component unmounts
* stopPolling()
* ```
*/

@@ -272,13 +365,7 @@ function setIntervalCallback(callback, interval) {

/**
* Safe copies of Promise built-in methods via factory functions.
* Safe Promise factory and bound static methods.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides factory functions that use Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/promise
*/
// Capture references at module initialization time
/* eslint-disable workspace/lib-require-jsdoc-example */
const _Promise = globalThis.Promise;

@@ -330,2 +417,11 @@ const _Reflect = globalThis.Reflect;

* @returns A promise that resolves after the specified duration
*
* @example Implementing retry backoff
* ```typescript
* async function retryWithBackoff(attempt: number) {
* const backoffMs = Math.min(1000 * 2 ** attempt, 30_000)
* await sleep(backoffMs)
* return fetchResource()
* }
* ```
*/

@@ -345,2 +441,1 @@ function sleep(milliseconds) {

})({});
//# sourceMappingURL=index.iife.js.map
+0
-1
var HyperfrontendTimeUtils=function(e){"use strict";const l=globalThis.Date,t=globalThis.Reflect;function n(...e){return t.construct(l,e)}const i=l.now,o=globalThis.Object.freeze,s=globalThis.setTimeout,r=globalThis.setInterval,a=globalThis.clearTimeout,c=globalThis.clearInterval,u=(e,l,...t)=>s(e,l,...t),b=(e,l,...t)=>r(e,l,...t),T=e=>{c(e)};const f=globalThis.Error,h=globalThis.Reflect,g=(e,l)=>h.construct(f,[e,l]),m=globalThis.Math.floor,d=globalThis.isNaN;const v=globalThis.Promise,p=globalThis.Reflect;return v.resolve.bind(v),v.reject.bind(v),v.all.bind(v),v.race.bind(v),v.allSettled.bind(v),v.any.bind(v),v.withResolvers?.bind(v),e.createClock=function(e=1e3){let l=null,t=[];return o({start:()=>{null===l&&(l=b(()=>{const e=n();t.forEach(l=>l(e))},e))},stop:()=>{null!==l&&(T(l),l=null)},subscribe:e=>{t.push(e)},unsubscribe:e=>{t=t.filter(l=>l!==e)},interval:e})},e.createTimer=function(e,l){let t=null,n=null,s=l;const r=()=>{if(null!==t){a(t);const e=i();null!==n&&(s-=e-n),t=null}},c=()=>{null===t&&(n=i(),t=u(()=>{e(),t=null},s))};return o({pause:r,resume:c,reset:(e=l)=>{r(),s=e,c()}})},e.normalizeToBaseTimeWindow=function(e,l){if(!e||!(e instanceof Date)||d(e.getTime()))throw g("Invalid time input");if(l<=0)throw g("Base time window must be positive");const t=e.getTime(),i=60*l*1e3;return n(m(t/i)*i)},e.setIntervalCallback=function(e,l){const t=b(e,l);return()=>T(t)},e.sleep=function(e){return l=l=>u(l,e),p.construct(v,[l]);var l},e}({});
//# sourceMappingURL=index.iife.min.js.map

@@ -10,13 +10,21 @@ (function (global, factory) {

*
* Since constructors cannot be safely captured via Object.assign, this module
* provides a factory function that uses Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/date
*/
// Capture references at module initialization time
/* eslint-disable jsdoc/require-param */
const _Date = globalThis.Date;
const _Reflect$2 = globalThis.Reflect;
/**
* (Safe copy) Creates a new Date using the captured Date constructor.
* Use this instead of `new Date()`. Accepts all standard Date constructor signatures.
*
* @returns A new Date instance.
*
* @example Creating Date instances
* ```typescript
* const now = createDate()
* const fromTimestamp = createDate(1704067200000)
* const fromString = createDate('2024-01-01T00:00:00Z')
* const fromParts = createDate(2024, 0, 1, 12, 30, 0) // Jan 1, 2024 12:30:00
* ```
*/
function createDate(...args) {

@@ -27,2 +35,8 @@ return _Reflect$2.construct(_Date, args);

* (Safe copy) Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
*
* @example
* ```typescript
* const timestamp = dateNow()
* // => 1704067200000 (example timestamp)
* ```
*/

@@ -39,3 +53,2 @@ const dateNow = _Date.now;

*/
// Capture references at module initialization time
const _Object = globalThis.Object;

@@ -56,3 +69,2 @@ /**

*/
// Capture references at module initialization time
const _setTimeout = globalThis.setTimeout;

@@ -69,2 +81,9 @@ const _setInterval = globalThis.setInterval;

* @returns A numeric ID for the timer.
*
* @example Setting a timeout
* ```typescript
* const timerId = setTimeout(() => console.log('Executed'), 1000)
* // Pass arguments to callback
* setTimeout((name, count) => console.log(name, count), 500, 'items', 5)
* ```
*/

@@ -79,2 +98,11 @@ const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);

* @returns A numeric ID for the interval.
*
* @example Setting an interval
* ```typescript
* let count = 0
* const intervalId = setInterval(() => {
* count++
* if (count >= 5) clearInterval(intervalId)
* }, 1000)
* ```
*/

@@ -86,2 +114,8 @@ const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);

* @param id - The identifier of the timeout to cancel.
*
* @example Canceling a timeout
* ```typescript
* const timerId = setTimeout(() => console.log('Never runs'), 5000)
* clearTimeout(timerId)
* ```
*/

@@ -95,2 +129,9 @@ const clearTimeout = (id) => {

* @param id - The identifier of the interval to cancel.
*
* @example Canceling an interval
* ```typescript
* const intervalId = setInterval(() => console.log('tick'), 1000)
* // Stop after some condition
* clearInterval(intervalId)
* ```
*/

@@ -110,2 +151,17 @@ const clearInterval = (id) => {

* @returns A Clock instance with start, stop, subscribe, and unsubscribe methods
*
* @example Creating interval clock
* ```typescript
* const clock = createClock(1000)
*
* const updateDisplay = (currentTime: Date) => {
* console.log(currentTime.toISOString())
* }
*
* clock.subscribe(updateDisplay)
* clock.start()
*
* // Later: stop receiving updates
* clock.stop()
* ```
*/

@@ -145,2 +201,20 @@ function createClock(interval = 1000) {

* @returns A Timer instance with pause, resume, and reset methods
*
* @example Creating pausable timer
* ```typescript
* const timer = createTimer(() => {
* console.log('Session expired')
* }, 30_000)
*
* timer.resume() // Start the 30-second countdown
*
* // User activity detected - pause the timer
* timer.pause()
*
* // User idle again - resume from where we left off
* timer.resume()
*
* // Reset to full 30 seconds on explicit action
* timer.reset()
* ```
*/

@@ -190,3 +264,2 @@ function createTimer(callback, delay) {

*/
// Capture references at module initialization time
const _Error = globalThis.Error;

@@ -201,2 +274,9 @@ const _Reflect$1 = globalThis.Reflect;

* @returns A new Error instance.
*
* @example Creating Error instances
* ```typescript
* const error = createError('Operation failed')
* // With cause for error chaining
* const wrapped = createError('Request failed', { cause: originalError })
* ```
*/

@@ -213,3 +293,2 @@ const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);

*/
// Capture references at module initialization time
const _Math = globalThis.Math;

@@ -229,7 +308,3 @@ /**

*/
// Capture references at module initialization time
const _isNaN = globalThis.isNaN;
// ============================================================================
// Global Type Checking (legacy, less strict)
// ============================================================================
/**

@@ -246,2 +321,10 @@ * (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).

* @returns A new Date object normalized to the start of the time window
*
* @example Normalizing to 15-minute buckets
* ```typescript
* // Round timestamps to 15-minute intervals for analytics bucketing
* const eventTime = new Date('2024-03-15T14:23:45Z')
* const bucketTime = normalizeToBaseTimeWindow(eventTime, 15)
* // => 2024-03-15T14:15:00.000Z
* ```
*/

@@ -267,2 +350,12 @@ function normalizeToBaseTimeWindow(time, baseTimeWindow) {

* @returns A cleanup function that stops the interval when called
*
* @example Setting interval with cleanup
* ```typescript
* const stopPolling = setIntervalCallback(() => {
* fetchLatestData()
* }, 5000)
*
* // Later: clean up when component unmounts
* stopPolling()
* ```
*/

@@ -275,13 +368,7 @@ function setIntervalCallback(callback, interval) {

/**
* Safe copies of Promise built-in methods via factory functions.
* Safe Promise factory and bound static methods.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides factory functions that use Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/promise
*/
// Capture references at module initialization time
/* eslint-disable workspace/lib-require-jsdoc-example */
const _Promise = globalThis.Promise;

@@ -333,2 +420,11 @@ const _Reflect = globalThis.Reflect;

* @returns A promise that resolves after the specified duration
*
* @example Implementing retry backoff
* ```typescript
* async function retryWithBackoff(attempt: number) {
* const backoffMs = Math.min(1000 * 2 ** attempt, 30_000)
* await sleep(backoffMs)
* return fetchResource()
* }
* ```
*/

@@ -346,2 +442,1 @@ function sleep(milliseconds) {

}));
//# sourceMappingURL=index.umd.js.map
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HyperfrontendTimeUtils={})}(this,function(e){"use strict";const t=globalThis.Date,l=globalThis.Reflect;function n(...e){return l.construct(t,e)}const i=t.now,o=globalThis.Object.freeze,s=globalThis.setTimeout,r=globalThis.setInterval,a=globalThis.clearTimeout,u=globalThis.clearInterval,c=(e,t,...l)=>s(e,t,...l),f=(e,t,...l)=>r(e,t,...l),b=e=>{u(e)};const T=globalThis.Error,h=globalThis.Reflect,d=(e,t)=>h.construct(T,[e,t]),g=globalThis.Math.floor,m=globalThis.isNaN;const p=globalThis.Promise,v=globalThis.Reflect;p.resolve.bind(p),p.reject.bind(p),p.all.bind(p),p.race.bind(p),p.allSettled.bind(p),p.any.bind(p),p.withResolvers?.bind(p),e.createClock=function(e=1e3){let t=null,l=[];return o({start:()=>{null===t&&(t=f(()=>{const e=n();l.forEach(t=>t(e))},e))},stop:()=>{null!==t&&(b(t),t=null)},subscribe:e=>{l.push(e)},unsubscribe:e=>{l=l.filter(t=>t!==e)},interval:e})},e.createTimer=function(e,t){let l=null,n=null,s=t;const r=()=>{if(null!==l){a(l);const e=i();null!==n&&(s-=e-n),l=null}},u=()=>{null===l&&(n=i(),l=c(()=>{e(),l=null},s))};return o({pause:r,resume:u,reset:(e=t)=>{r(),s=e,u()}})},e.normalizeToBaseTimeWindow=function(e,t){if(!e||!(e instanceof Date)||m(e.getTime()))throw d("Invalid time input");if(t<=0)throw d("Base time window must be positive");const l=e.getTime(),i=60*t*1e3;return n(g(l/i)*i)},e.setIntervalCallback=function(e,t){const l=f(e,t);return()=>b(l)},e.sleep=function(e){return t=t=>c(t,e),v.construct(p,[t]);var t}});
//# sourceMappingURL=index.umd.min.js.map
# Changelog
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
All notable changes to this project will be documented in this file.
## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.3...lib-time-utils@0.0.4) (2026-03-08)
## [0.0.5](https://github.com/AndrewRedican/hyperfrontend/compare/c8db08be8b183addd26caf81fdd17fb3693f296f...466c0388c4cd516b9c704214140b4df1004098e6) - 2026-06-23
## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.2...lib-time-utils@0.0.3) (2026-03-02)
### Other
- **@hyperfrontend/workspace:** remove lib-builder and tool-package as implicit dependencies for all lib projects
## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.3...lib-time-utils@0.0.4) - 2026-03-08
## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.2...lib-time-utils@0.0.3) - 2026-03-02
### Bug Fixes
* **lib-time-utils:** correct package exports and dependencies ([3b9096b](https://github.com/AndrewRedican/hyperfrontend/commit/3b9096b54337c2c2f3e06d6b97865a772e79aad9))
- **lib-time-utils:** correct package exports and dependencies ([3b9096b](https://github.com/AndrewRedican/hyperfrontend/commit/3b9096b54337c2c2f3e06d6b97865a772e79aad9))
## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.1...lib-time-utils@0.0.2) (2026-02-26)
## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.1...lib-time-utils@0.0.2) - 2026-02-26
## 0.0.1 (2026-02-15)
## 0.0.1 - 2026-02-15
'use strict';
/**
* Safe copies of Date built-in via factory function and static methods.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides a factory function that uses Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/date
*/
// Capture references at module initialization time
const _Date = globalThis.Date;
const _Reflect$2 = globalThis.Reflect;
function createDate(...args) {
return _Reflect$2.construct(_Date, args);
}
/**
* (Safe copy) Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
*/
const dateNow = _Date.now;
const index_cjs_js$2 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js');
const index_cjs_js = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js');
const index_cjs_js$1 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.cjs.js');
const index_cjs_js$4 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
const index_cjs_js$5 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js');
const index_cjs_js$3 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js');
const index_cjs_js$6 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.cjs.js');
/**
* Safe copies of Object built-in methods.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/object
*/
// Capture references at module initialization time
const _Object = globalThis.Object;
/**
* (Safe copy) Prevents modification of existing property attributes and values,
* and prevents the addition of new properties.
*/
const freeze = _Object.freeze;
/**
* Safe copies of Timer/Scheduling built-in functions.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/timers
*/
// Capture references at module initialization time
const _setTimeout = globalThis.setTimeout;
const _setInterval = globalThis.setInterval;
const _clearTimeout = globalThis.clearTimeout;
const _clearInterval = globalThis.clearInterval;
/**
* (Safe copy) Sets a timer which executes a function once the timer expires.
*
* @param callback - Function to call when the timer elapses.
* @param delay - Time in milliseconds before executing.
* @param args - Additional arguments to pass to the callback.
* @returns A numeric ID for the timer.
*/
const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
/**
* (Safe copy) Repeatedly calls a function with a fixed time delay between each call.
*
* @param callback - Function to call at each interval.
* @param delay - Time in milliseconds between calls.
* @param args - Additional arguments to pass to the callback.
* @returns A numeric ID for the interval.
*/
const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
/**
* (Safe copy) Cancels a timeout previously established by setTimeout.
*
* @param id - The identifier of the timeout to cancel.
*/
const clearTimeout = (id) => {
_clearTimeout(id);
};
/**
* (Safe copy) Cancels a timed, repeating action previously established by setInterval.
*
* @param id - The identifier of the interval to cancel.
*/
const clearInterval = (id) => {
_clearInterval(id);
};
/**
* Creates an interval loop that invokes one or more subscribed callback functions

@@ -98,2 +20,17 @@ * at the specified internal (in milliseconds).

* @returns A Clock instance with start, stop, subscribe, and unsubscribe methods
*
* @example Creating interval clock
* ```typescript
* const clock = createClock(1000)
*
* const updateDisplay = (currentTime: Date) => {
* console.log(currentTime.toISOString())
* }
*
* clock.subscribe(updateDisplay)
* clock.start()
*
* // Later: stop receiving updates
* clock.stop()
* ```
*/

@@ -105,4 +42,4 @@ function createClock(interval = 1000) {

if (clockId === null) {
clockId = setInterval(() => {
const currentTime = createDate();
clockId = index_cjs_js$1.setInterval(() => {
const currentTime = index_cjs_js$2.createDate();
subscribers.forEach((subscriber) => subscriber(currentTime));

@@ -114,3 +51,3 @@ }, interval);

if (clockId !== null) {
clearInterval(clockId);
index_cjs_js$1.clearInterval(clockId);
clockId = null;

@@ -125,3 +62,3 @@ }

};
return freeze({ start, stop, subscribe, unsubscribe, interval });
return index_cjs_js.freeze({ start, stop, subscribe, unsubscribe, interval });
}

@@ -136,2 +73,20 @@

* @returns A Timer instance with pause, resume, and reset methods
*
* @example Creating pausable timer
* ```typescript
* const timer = createTimer(() => {
* console.log('Session expired')
* }, 30_000)
*
* timer.resume() // Start the 30-second countdown
*
* // User activity detected - pause the timer
* timer.pause()
*
* // User idle again - resume from where we left off
* timer.resume()
*
* // Reset to full 30 seconds on explicit action
* timer.reset()
* ```
*/

@@ -144,4 +99,4 @@ function createTimer(callback, delay) {

if (timerId !== null) {
clearTimeout(timerId);
const now = dateNow();
index_cjs_js$1.clearTimeout(timerId);
const now = index_cjs_js$2.dateNow();
/* istanbul ignore else - start is always set when timerId is not null */

@@ -156,4 +111,4 @@ if (start !== null) {

if (timerId === null) {
start = dateNow();
timerId = setTimeout(() => {
start = index_cjs_js$2.dateNow();
timerId = index_cjs_js$1.setTimeout(() => {
callback();

@@ -169,63 +124,6 @@ timerId = null;

};
return freeze({ pause, resume, reset });
return index_cjs_js.freeze({ pause, resume, reset });
}
/**
* Safe copies of Error built-ins via factory functions.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides factory functions that use Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/error
*/
// Capture references at module initialization time
const _Error = globalThis.Error;
const _Reflect$1 = globalThis.Reflect;
/**
* (Safe copy) Creates a new Error using the captured Error constructor.
* Use this instead of `new Error()`.
*
* @param message - Optional error message.
* @param options - Optional error options.
* @returns A new Error instance.
*/
const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
/**
* Safe copies of Math built-in methods.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/math
*/
// Capture references at module initialization time
const _Math = globalThis.Math;
/**
* (Safe copy) Returns the largest integer less than or equal to a number.
*/
const floor = _Math.floor;
/**
* Safe copies of Number built-in methods and constants.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/number
*/
// Capture references at module initialization time
const _isNaN = globalThis.isNaN;
// ============================================================================
// Global Type Checking (legacy, less strict)
// ============================================================================
/**
* (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).
*/
const globalIsNaN = _isNaN;
/**
* Normalizes a given time to the nearest base time window.

@@ -236,14 +134,22 @@ *

* @returns A new Date object normalized to the start of the time window
*
* @example Normalizing to 15-minute buckets
* ```typescript
* // Round timestamps to 15-minute intervals for analytics bucketing
* const eventTime = new Date('2024-03-15T14:23:45Z')
* const bucketTime = normalizeToBaseTimeWindow(eventTime, 15)
* // => 2024-03-15T14:15:00.000Z
* ```
*/
function normalizeToBaseTimeWindow(time, baseTimeWindow) {
if (!time || !(time instanceof Date) || globalIsNaN(time.getTime())) {
throw createError('Invalid time input');
if (!time || !(time instanceof Date) || index_cjs_js$3.globalIsNaN(time.getTime())) {
throw index_cjs_js$4.createError('Invalid time input');
}
if (baseTimeWindow <= 0) {
throw createError('Base time window must be positive');
throw index_cjs_js$4.createError('Base time window must be positive');
}
const timeInMs = time.getTime();
const windowInMs = baseTimeWindow * 60 * 1000;
const normalizedTimeInMs = floor(timeInMs / windowInMs) * windowInMs;
return createDate(normalizedTimeInMs);
const normalizedTimeInMs = index_cjs_js$5.floor(timeInMs / windowInMs) * windowInMs;
return index_cjs_js$2.createDate(normalizedTimeInMs);
}

@@ -257,62 +163,19 @@

* @returns A cleanup function that stops the interval when called
*
* @example Setting interval with cleanup
* ```typescript
* const stopPolling = setIntervalCallback(() => {
* fetchLatestData()
* }, 5000)
*
* // Later: clean up when component unmounts
* stopPolling()
* ```
*/
function setIntervalCallback(callback, interval) {
const timerId = setInterval(callback, interval);
return () => clearInterval(timerId);
const timerId = index_cjs_js$1.setInterval(callback, interval);
return () => index_cjs_js$1.clearInterval(timerId);
}
/**
* Safe copies of Promise built-in methods via factory functions.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides factory functions that use Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/promise
*/
// Capture references at module initialization time
const _Promise = globalThis.Promise;
const _Reflect = globalThis.Reflect;
/**
* (Safe copy) Creates a new Promise using the captured Promise constructor.
* Use this instead of `new Promise()`.
*
* @param executor - The executor function.
* @returns A new Promise instance.
*/
const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
/**
* (Safe copy) Returns a Promise that resolves with the given value.
*/
_Promise.resolve.bind(_Promise);
/**
* (Safe copy) Returns a Promise that rejects with the given reason.
*/
_Promise.reject.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves when all promises resolve.
*/
_Promise.all.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves/rejects with the first settled promise.
*/
_Promise.race.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves when all promises settle.
*/
_Promise.allSettled.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves with the first fulfilled promise.
*/
_Promise.any.bind(_Promise);
/**
* (Safe copy) Creates a Promise along with its resolve and reject functions.
* Note: Available only in ES2024+ environments.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
_Promise.withResolvers?.bind(_Promise);
/**
* Pauses execution for a specified duration.

@@ -322,5 +185,14 @@ *

* @returns A promise that resolves after the specified duration
*
* @example Implementing retry backoff
* ```typescript
* async function retryWithBackoff(attempt: number) {
* const backoffMs = Math.min(1000 * 2 ** attempt, 30_000)
* await sleep(backoffMs)
* return fetchResource()
* }
* ```
*/
function sleep(milliseconds) {
return createPromise((resolve) => setTimeout(resolve, milliseconds));
return index_cjs_js$6.createPromise((resolve) => index_cjs_js$1.setTimeout(resolve, milliseconds));
}

@@ -333,2 +205,1 @@

exports.sleep = sleep;
//# sourceMappingURL=index.cjs.js.map

@@ -1,6 +0,134 @@

export * from './create-clock';
export * from './create-timer';
export * from './normalize-to-base-time-window';
export * from './set-interval-callback';
export * from './sleep';
//# sourceMappingURL=index.d.ts.map
/**
* Clock interface for interval-based time updates.
*/
interface Clock {
/** Start the clock interval */
readonly start: () => void;
/** Stop the clock interval */
readonly stop: () => void;
/** Subscribe to time updates */
readonly subscribe: (callback: (currentTime: Date) => void) => void;
/** Unsubscribe from time updates */
readonly unsubscribe: (callback: (currentTime: Date) => void) => void;
/** Interval in milliseconds */
readonly interval: number;
}
/**
* Creates an interval loop that invokes one or more subscribed callback functions
* at the specified internal (in milliseconds).
*
* Allows you to start or stop the interval loop, much like a stop watch.
* Allows you to unsubscribe callback functions.
*
* @param interval - Time in milliseconds between each callback invocation (default: 1000ms)
* @returns A Clock instance with start, stop, subscribe, and unsubscribe methods
*
* @example Creating interval clock
* ```typescript
* const clock = createClock(1000)
*
* const updateDisplay = (currentTime: Date) => {
* console.log(currentTime.toISOString())
* }
*
* clock.subscribe(updateDisplay)
* clock.start()
*
* // Later: stop receiving updates
* clock.stop()
* ```
*/
declare function createClock(interval?: number): Clock;
/** Timer interface with pause, resume, and reset capabilities. */
interface Timer {
/** Stops the progression of tracked time until further notice. */
readonly pause: () => void;
/** Reinstates the progression of tracked time. */
readonly resume: () => void;
/** Assigns a new wait time before function is invoked. */
readonly reset: (newDelay?: number) => void;
}
/**
* Invokes callback function after the designated time has passed, much like a timer.
* Allows you to pause, resume, or reset the progress of time tracked.
*
* @param callback - The function to invoke after the delay
* @param delay - Time in milliseconds to wait until callback is invoked
* @returns A Timer instance with pause, resume, and reset methods
*
* @example Creating pausable timer
* ```typescript
* const timer = createTimer(() => {
* console.log('Session expired')
* }, 30_000)
*
* timer.resume() // Start the 30-second countdown
*
* // User activity detected - pause the timer
* timer.pause()
*
* // User idle again - resume from where we left off
* timer.resume()
*
* // Reset to full 30 seconds on explicit action
* timer.reset()
* ```
*/
declare function createTimer(callback: () => void, delay: number): Timer;
/**
* Normalizes a given time to the nearest base time window.
*
* @param time - The Date object to normalize to the nearest time window
* @param baseTimeWindow - The size of the time window in minutes for normalization
* @returns A new Date object normalized to the start of the time window
*
* @example Normalizing to 15-minute buckets
* ```typescript
* // Round timestamps to 15-minute intervals for analytics bucketing
* const eventTime = new Date('2024-03-15T14:23:45Z')
* const bucketTime = normalizeToBaseTimeWindow(eventTime, 15)
* // => 2024-03-15T14:15:00.000Z
* ```
*/
declare function normalizeToBaseTimeWindow(time: Date, baseTimeWindow: number): Date;
/**
* Creates a repeating interval that invokes a callback function at regular intervals.
*
* @param callback - The function to invoke at each interval
* @param interval - Time in milliseconds between each callback invocation
* @returns A cleanup function that stops the interval when called
*
* @example Setting interval with cleanup
* ```typescript
* const stopPolling = setIntervalCallback(() => {
* fetchLatestData()
* }, 5000)
*
* // Later: clean up when component unmounts
* stopPolling()
* ```
*/
declare function setIntervalCallback(callback: () => void, interval: number): () => void;
/**
* Pauses execution for a specified duration.
*
* @param milliseconds - The duration to sleep in milliseconds
* @returns A promise that resolves after the specified duration
*
* @example Implementing retry backoff
* ```typescript
* async function retryWithBackoff(attempt: number) {
* const backoffMs = Math.min(1000 * 2 ** attempt, 30_000)
* await sleep(backoffMs)
* return fetchResource()
* }
* ```
*/
declare function sleep(milliseconds: number): Promise<void>;
export { createClock, createTimer, normalizeToBaseTimeWindow, setIntervalCallback, sleep };
export type { Clock, Timer };

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/time/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yBAAyB,CAAA;AACvC,cAAc,SAAS,CAAA"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/time/src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA"}

@@ -1,88 +0,10 @@

/**
* Safe copies of Date built-in via factory function and static methods.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides a factory function that uses Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/date
*/
// Capture references at module initialization time
const _Date = globalThis.Date;
const _Reflect$2 = globalThis.Reflect;
function createDate(...args) {
return _Reflect$2.construct(_Date, args);
}
/**
* (Safe copy) Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
*/
const dateNow = _Date.now;
import { createDate, dateNow } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js';
import { freeze } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js';
import { setInterval, clearInterval, setTimeout, clearTimeout } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.esm.js';
import { createError } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
import { floor } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js';
import { globalIsNaN } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.esm.js';
import { createPromise } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.esm.js';
/**
* Safe copies of Object built-in methods.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/object
*/
// Capture references at module initialization time
const _Object = globalThis.Object;
/**
* (Safe copy) Prevents modification of existing property attributes and values,
* and prevents the addition of new properties.
*/
const freeze = _Object.freeze;
/**
* Safe copies of Timer/Scheduling built-in functions.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/timers
*/
// Capture references at module initialization time
const _setTimeout = globalThis.setTimeout;
const _setInterval = globalThis.setInterval;
const _clearTimeout = globalThis.clearTimeout;
const _clearInterval = globalThis.clearInterval;
/**
* (Safe copy) Sets a timer which executes a function once the timer expires.
*
* @param callback - Function to call when the timer elapses.
* @param delay - Time in milliseconds before executing.
* @param args - Additional arguments to pass to the callback.
* @returns A numeric ID for the timer.
*/
const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
/**
* (Safe copy) Repeatedly calls a function with a fixed time delay between each call.
*
* @param callback - Function to call at each interval.
* @param delay - Time in milliseconds between calls.
* @param args - Additional arguments to pass to the callback.
* @returns A numeric ID for the interval.
*/
const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
/**
* (Safe copy) Cancels a timeout previously established by setTimeout.
*
* @param id - The identifier of the timeout to cancel.
*/
const clearTimeout = (id) => {
_clearTimeout(id);
};
/**
* (Safe copy) Cancels a timed, repeating action previously established by setInterval.
*
* @param id - The identifier of the interval to cancel.
*/
const clearInterval = (id) => {
_clearInterval(id);
};
/**
* Creates an interval loop that invokes one or more subscribed callback functions

@@ -96,2 +18,17 @@ * at the specified internal (in milliseconds).

* @returns A Clock instance with start, stop, subscribe, and unsubscribe methods
*
* @example Creating interval clock
* ```typescript
* const clock = createClock(1000)
*
* const updateDisplay = (currentTime: Date) => {
* console.log(currentTime.toISOString())
* }
*
* clock.subscribe(updateDisplay)
* clock.start()
*
* // Later: stop receiving updates
* clock.stop()
* ```
*/

@@ -131,2 +68,20 @@ function createClock(interval = 1000) {

* @returns A Timer instance with pause, resume, and reset methods
*
* @example Creating pausable timer
* ```typescript
* const timer = createTimer(() => {
* console.log('Session expired')
* }, 30_000)
*
* timer.resume() // Start the 30-second countdown
*
* // User activity detected - pause the timer
* timer.pause()
*
* // User idle again - resume from where we left off
* timer.resume()
*
* // Reset to full 30 seconds on explicit action
* timer.reset()
* ```
*/

@@ -166,59 +121,2 @@ function createTimer(callback, delay) {

/**
* Safe copies of Error built-ins via factory functions.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides factory functions that use Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/error
*/
// Capture references at module initialization time
const _Error = globalThis.Error;
const _Reflect$1 = globalThis.Reflect;
/**
* (Safe copy) Creates a new Error using the captured Error constructor.
* Use this instead of `new Error()`.
*
* @param message - Optional error message.
* @param options - Optional error options.
* @returns A new Error instance.
*/
const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
/**
* Safe copies of Math built-in methods.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/math
*/
// Capture references at module initialization time
const _Math = globalThis.Math;
/**
* (Safe copy) Returns the largest integer less than or equal to a number.
*/
const floor = _Math.floor;
/**
* Safe copies of Number built-in methods and constants.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/number
*/
// Capture references at module initialization time
const _isNaN = globalThis.isNaN;
// ============================================================================
// Global Type Checking (legacy, less strict)
// ============================================================================
/**
* (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).
*/
const globalIsNaN = _isNaN;
/**
* Normalizes a given time to the nearest base time window.

@@ -229,2 +127,10 @@ *

* @returns A new Date object normalized to the start of the time window
*
* @example Normalizing to 15-minute buckets
* ```typescript
* // Round timestamps to 15-minute intervals for analytics bucketing
* const eventTime = new Date('2024-03-15T14:23:45Z')
* const bucketTime = normalizeToBaseTimeWindow(eventTime, 15)
* // => 2024-03-15T14:15:00.000Z
* ```
*/

@@ -250,2 +156,12 @@ function normalizeToBaseTimeWindow(time, baseTimeWindow) {

* @returns A cleanup function that stops the interval when called
*
* @example Setting interval with cleanup
* ```typescript
* const stopPolling = setIntervalCallback(() => {
* fetchLatestData()
* }, 5000)
*
* // Later: clean up when component unmounts
* stopPolling()
* ```
*/

@@ -258,55 +174,2 @@ function setIntervalCallback(callback, interval) {

/**
* Safe copies of Promise built-in methods via factory functions.
*
* Since constructors cannot be safely captured via Object.assign, this module
* provides factory functions that use Reflect.construct internally.
*
* These references are captured at module initialization time to protect against
* prototype pollution attacks. Import only what you need for tree-shaking.
*
* @module @hyperfrontend/immutable-api-utils/built-in-copy/promise
*/
// Capture references at module initialization time
const _Promise = globalThis.Promise;
const _Reflect = globalThis.Reflect;
/**
* (Safe copy) Creates a new Promise using the captured Promise constructor.
* Use this instead of `new Promise()`.
*
* @param executor - The executor function.
* @returns A new Promise instance.
*/
const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
/**
* (Safe copy) Returns a Promise that resolves with the given value.
*/
_Promise.resolve.bind(_Promise);
/**
* (Safe copy) Returns a Promise that rejects with the given reason.
*/
_Promise.reject.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves when all promises resolve.
*/
_Promise.all.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves/rejects with the first settled promise.
*/
_Promise.race.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves when all promises settle.
*/
_Promise.allSettled.bind(_Promise);
/**
* (Safe copy) Returns a Promise that resolves with the first fulfilled promise.
*/
_Promise.any.bind(_Promise);
/**
* (Safe copy) Creates a Promise along with its resolve and reject functions.
* Note: Available only in ES2024+ environments.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
_Promise.withResolvers?.bind(_Promise);
/**
* Pauses execution for a specified duration.

@@ -316,2 +179,11 @@ *

* @returns A promise that resolves after the specified duration
*
* @example Implementing retry backoff
* ```typescript
* async function retryWithBackoff(attempt: number) {
* const backoffMs = Math.min(1000 * 2 ** attempt, 30_000)
* await sleep(backoffMs)
* return fetchResource()
* }
* ```
*/

@@ -323,2 +195,1 @@ function sleep(milliseconds) {

export { createClock, createTimer, normalizeToBaseTimeWindow, setIntervalCallback, sleep };
//# sourceMappingURL=index.esm.js.map
{
"name": "@hyperfrontend/time-utils",
"version": "0.0.4",
"version": "0.0.5",
"description": "Functional time utilities for async operations, intervals, and time normalization.",

@@ -35,6 +35,2 @@ "license": "MIT",

"require": "./index.cjs.js"
},
"./bundle": {
"import": "./bundle/index.iife.min.js",
"require": "./bundle/index.iife.min.js"
}

@@ -58,3 +54,12 @@ },

"unpkg": "./bundle/index.umd.min.js",
"jsdelivr": "./bundle/index.umd.min.js"
}
"jsdelivr": "./bundle/index.umd.min.js",
"files": [
"**/index.*",
"**/index.d.ts",
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"SECURITY.md",
"!**/*.js.map"
]
}

@@ -38,2 +38,4 @@ # @hyperfrontend/time-utils

β€’ πŸ‘‰ See [**documentation**](https://www.hyperfrontend.dev/docs/libraries/utils/time/)
## What is @hyperfrontend/time-utils?

@@ -261,2 +263,2 @@

MIT
[MIT](https://github.com/AndrewRedican/hyperfrontend/blob/main/LICENSE.md)
{"version":3,"file":"index.iife.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":";;;IAAA;;;;;;;;;;IAUG;IAEH;IACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;IAC7B,MAAMA,UAAQ,GAAG,UAAU,CAAC,OAAO;IAoB7B,SAAU,UAAU,CAAC,GAAG,IAAe,EAAA;QAC3C,OAAaA,UAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC;IAC9C;IAEA;;IAEG;IACI,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG;;ICzChC;;;;;;;IAOG;IAEH;IACA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM;IAMjC;;;IAGG;IACI,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;;ICpBpC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;;;;;;IAMG;IACG,SAAU,mBAAmB,CAAC,QAAoB,EAAE,QAAgB,EAAA;QACxE,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC/C,IAAA,OAAO,MAAY,aAAa,CAAC,OAAO,CAAC;IAC3C;;ICZA;;;;;;;;;;IAUG;IAEH;IACA,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;IACnC,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;IAGnC;;;;;;IAMG;IACI,MAAM,aAAa,GAAG,CAC3B,QAAoG,KACzE,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;IAErE;;IAEG;IAC2B,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ;IAE5D;;IAEG;IAC0B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ;IAE1D;;IAEG;IACuB,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;IAEpD;;IAEG;IACwB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;IAEtD;;IAEG;IAC8B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;IAElE;;IAEG;IACuB,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;IAEpD;;;IAGG;IACH;IAC0C,QAAS,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ;;IC5DhF;;;;;IAKG;IACG,SAAU,KAAK,CAAC,YAAoB,EAAA;IACxC,IAAA,OAAO,aAAa,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACtE;;;;;;;;;;;;;;"}
{"version":3,"file":"index.iife.min.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/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/immutable-api/src/built-in-copy/promise/index.ts","../../../../../../../../../../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,null,null,null,null,null,null,null],"names":["_Date","globalThis","Date","_Reflect","Reflect","createDate","args","construct","dateNow","now","freeze","Object","_setTimeout","setTimeout","_setInterval","setInterval","_clearTimeout","clearTimeout","_clearInterval","clearInterval","callback","delay","id","_Error","Error","createError","message","options","floor","Math","globalIsNaN","isNaN","_Promise","Promise","resolve","bind","reject","all","race","allSettled","any","withResolvers","interval","clockId","subscribers","start","currentTime","forEach","subscriber","stop","subscribe","push","unsubscribe","filter","timerId","remaining","pause","resume","reset","newDelay","time","baseTimeWindow","getTime","timeInMs","windowInMs","milliseconds","executor"],"mappings":"oDAaA,MAAMA,EAAQC,WAAWC,KACnBC,EAAWF,WAAWG,QAoBtB,SAAUC,KAAcC,GAC5B,OAAaH,EAASI,UAAUP,EAAOM,EACzC,CAKO,MAAME,EAAUR,EAAMS,ICrBhBC,EAVGT,WAAWU,OAUGD,OCVxBE,EAAcX,WAAWY,WACzBC,EAAeb,WAAWc,YAC1BC,EAAgBf,WAAWgB,aAC3BC,EAAiBjB,WAAWkB,cAcrBN,EAAa,CACxBO,EACAC,KACGf,IAC0CM,EAAYQ,EAAUC,KAAUf,GAUlES,EAAc,CACzBK,EACAC,KACGf,IAC2CQ,EAAaM,EAAUC,KAAUf,GAgBpEa,EAAiBG,IAC5BJ,EAAeI,ICjDjB,MAAMC,EAAStB,WAAWuB,MAQpBrB,EAAWF,WA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D,OAAS4B,EAAY8B,EAAKE,WACvD,MAAMrC,EAAY,sBAGpB,GAAIoC,GAAkB,EACpB,MAAMpC,EAAY,qCAGpB,MAAMsC,EAAWH,EAAKE,UAChBE,EAA8B,GAAjBH,EAAsB,IAEzC,OAAOxD,EADoBuB,EAAMmC,EAAWC,GAAcA,EAE5D,wBChBM,SAA8B5C,EAAsBsB,GACxD,MAAMY,EAAUvC,EAAYK,EAAUsB,GACtC,MAAO,IAAYvB,EAAcmC,EACnC,UCHM,SAAgBW,GACpB,OLeAC,EKfsBhC,GAAYrB,EAAWqB,EAAS+B,GLgB3B9D,EAASI,UAAUyB,EAAU,CAACkC,IAF9B,IAC3BA,CKdF"}
{"version":3,"file":"index.umd.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":";;;;;;IAAA;;;;;;;;;;IAUG;IAEH;IACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;IAC7B,MAAMA,UAAQ,GAAG,UAAU,CAAC,OAAO;IAoB7B,SAAU,UAAU,CAAC,GAAG,IAAe,EAAA;QAC3C,OAAaA,UAAQ,CAAC,SAAS,CAAC,KAAK,E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Y,CAAC,CAAC;IACtE;;;;;;;;;;;;"}
{"version":3,"file":"index.umd.min.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/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/immutable-api/src/built-in-copy/promise/index.ts","../../../../../../../../../../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,null,null,null,null,null,null,null],"names":["_Date","globalThis","Date","_Reflect","Reflect","createDate","args","construct","dateNow","now","freeze","Object","_setTimeout","setTimeout","_setInterval","setInterval","_clearTimeout","clearTimeout","_clearInterval","clearInterval","callback","delay","id","_Error","Error","createError","message","options","floor","Math","globalIsNaN","isNaN","_Promise","Promise","resolve","bind","reject","all","race","allSettled","any","withResolvers","interval","clockId","subscribers","start","currentTime","forEach","subscriber","stop","subscribe","push","unsubscribe","filter","timerId","remaining","pause","resume","reset","newDelay","time","baseTimeWindow","getTime","timeInMs","windowInMs","milliseconds","executor"],"mappings":"6PAaA,MAAMA,EAAQC,WAAWC,KACnBC,EAAWF,WAAWG,QAoBtB,SAAUC,KAAcC,GAC5B,OAAaH,EAASI,UAAUP,EAAOM,EACzC,CAKO,MAAME,EAAUR,EAAMS,ICrBhBC,EAVGT,WAAWU,OAUGD,OCVxBE,EAAcX,WAAWY,WACzBC,EAAeb,WAAWc,YAC1BC,EAAgBf,WAAWgB,aAC3BC,EAAiBjB,WAAWkB,cAcr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,EAAQrC,IACR8C,EAAUzC,EAAW,KACnBO,IACAkC,EAAU,MACTC,KAUP,OAAO7C,EAAO,CAAE8C,QAAOC,SAAQC,MANjB,CAACC,EAAmBtC,KAChCmC,IACAD,EAAYI,EACZF,MAIJ,8BC3CM,SAAoCG,EAAYC,GACpD,IAAKD,KAAUA,aAAgB1D,OAAS4B,EAAY8B,EAAKE,WACvD,MAAMrC,EAAY,sBAGpB,GAAIoC,GAAkB,EACpB,MAAMpC,EAAY,qCAGpB,MAAMsC,EAAWH,EAAKE,UAChBE,EAA8B,GAAjBH,EAAsB,IAEzC,OAAOxD,EADoBuB,EAAMmC,EAAWC,GAAcA,EAE5D,wBChBM,SAA8B5C,EAAsBsB,GACxD,MAAMY,EAAUvC,EAAYK,EAAUsB,GACtC,MAAO,IAAYvB,EAAcmC,EACnC,UCHM,SAAgBW,GACpB,OLeAC,EKfsBhC,GAAYrB,EAAWqB,EAAS+B,GLgB3B9D,EAASI,UAAUyB,EAAU,CAACkC,IAF9B,IAC3BA,CKdF"}
export interface Clock {
readonly start: () => void;
readonly stop: () => void;
readonly subscribe: (callback: (currentTime: Date) => void) => void;
readonly unsubscribe: (callback: (currentTime: Date) => void) => void;
/** Interval in milliseconds */
readonly interval: number;
}
/**
* Creates an interval loop that invokes one or more subscribed callback functions
* at the specified internal (in milliseconds).
*
* Allows you to start or stop the interval loop, much like a stop watch.
* Allows you to unsubscribe callback functions.
*
* @param interval - Time in milliseconds between each callback invocation (default: 1000ms)
* @returns A Clock instance with start, stop, subscribe, and unsubscribe methods
*/
export declare function createClock(interval?: number): Clock;
//# sourceMappingURL=create-clock.d.ts.map
{"version":3,"file":"create-clock.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/time/src/create-clock.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,KAAK,IAAI,CAAA;IACnE,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,KAAK,IAAI,CAAA;IACrE,+BAA+B;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,QAAQ,SAAO,GAAG,KAAK,CA6BlD"}
export interface Timer {
/** Stops the progression of tracked time until further notice. */
readonly pause: () => void;
/** Reinstates the progression of tracked time. */
readonly resume: () => void;
/** Assigns a new wait time before function is invoked. */
readonly reset: (newDelay?: number) => void;
}
/**
* Invokes callback function after the designated time has passed, much like a timer.
* Allows you to pause, resume, or reset the progress of time tracked.
*
* @param callback - The function to invoke after the delay
* @param delay - Time in milliseconds to wait until callback is invoked
* @returns A Timer instance with pause, resume, and reset methods
*/
export declare function createTimer(callback: () => void, delay: number): Timer;
//# sourceMappingURL=create-timer.d.ts.map
{"version":3,"file":"create-timer.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/time/src/create-timer.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,KAAK;IACpB,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAkCtE"}
{"version":3,"file":"index.cjs.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,IAAI;AAC7B,MAAMA,UAAQ,GAAG,UAAU,CAAC,OAAO;AAoB7B,SAAU,UAAU,CAAC,GAAG,IAAe,EAAA;IAC3C,OAAaA,UAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC;AAC9C;AAEA;;AAEG;AACI,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG;;ACzChC;;;;;;;AAOG;AAEH;AACA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM;AAMjC;;;AAGG;AACI,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;;ACpBpC;;;;;;;AAOG;AAEH;AACA,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU;AACzC,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW;AAC3C,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY;AAC7C,MAAM,cAAc,GAAG,UAAU,CAAC,aAAa;AAM/C;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,CACxB,QAAkC,EAClC,KAAc,EACd,GAAG,IAAW,KAC+B,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;AAE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AoG,KACzE,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;AAErE;;AAEG;AAC2B,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ;AAE5D;;AAEG;AAC0B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ;AAE1D;;AAEG;AACuB,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;AAEpD;;AAEG;AACwB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;AAEtD;;AAEG;AAC8B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;AAElE;;AAEG;AACuB,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;AAEpD;;;AAGG;AACH;AAC0C,QAAS,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ;;AC5DhF;;;;;AAKG;AACG,SAAU,KAAK,CAAC,YAAoB,EAAA;AACxC,IAAA,OAAO,aAAa,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtE;;;;;;;;"}
{"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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AC,IAAI,CAAC,QAAQ;AAEpD;;;AAGG;AACH;AAC0C,QAAS,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ;;AC5DhF;;;;;AAKG;AACG,SAAU,KAAK,CAAC,YAAoB,EAAA;AACxC,IAAA,OAAO,aAAa,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtE;;;;"}
/**
* Normalizes a given time to the nearest base time window.
*
* @param time - The Date object to normalize to the nearest time window
* @param baseTimeWindow - The size of the time window in minutes for normalization
* @returns A new Date object normalized to the start of the time window
*/
export declare function normalizeToBaseTimeWindow(time: Date, baseTimeWindow: number): Date;
//# sourceMappingURL=normalize-to-base-time-window.d.ts.map
{"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"}
/**
* Creates a repeating interval that invokes a callback function at regular intervals.
*
* @param callback - The function to invoke at each interval
* @param interval - Time in milliseconds between each callback invocation
* @returns A cleanup function that stops the interval when called
*/
export declare function setIntervalCallback(callback: () => void, interval: number): () => void;
//# sourceMappingURL=set-interval-callback.d.ts.map
{"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"}
/**
* Pauses execution for a specified duration.
*
* @param milliseconds - The duration to sleep in milliseconds
* @returns A promise that resolves after the specified duration
*/
export declare function sleep(milliseconds: number): Promise<void>;
//# sourceMappingURL=sleep.d.ts.map
{"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"}