@bouko/ts 0.3.8 → 0.3.9

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.
@@ -1,3 +1,5 @@
1
1
  export declare function mmSS(timestamp: number): string;
2
2
  export declare const secToMs: (sec: number) => number;
3
3
  export declare function isoToMs(duration: string): number;
4
+ export declare const sleep: (ms: number) => Promise<unknown>;
5
+ export declare const isExpired: (date: Date | string) => boolean;
@@ -25,3 +25,11 @@ export function isoToMs(duration) {
25
25
  parseFloat(seconds || "0")) * 1000;
26
26
  return ms;
27
27
  }
28
+ export const sleep = (ms) => {
29
+ return new Promise((res) => setTimeout(res, ms));
30
+ };
31
+ export const isExpired = (date) => {
32
+ if (typeof date === "string")
33
+ date = new Date(date);
34
+ return new Date() > date;
35
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  "name": "@bouko/ts",
4
4
 
5
- "version": "0.3.8",
5
+ "version": "0.3.9",
6
6
 
7
7
  "main": "./dist/index.js",
8
8
 
@@ -40,7 +40,7 @@
40
40
 
41
41
  "chalk": "^5.6.0",
42
42
 
43
- "zod": "^4.1.5"
43
+ "zod": "^4.3.5"
44
44
 
45
45
  },
46
46
 
File without changes
@@ -1 +0,0 @@
1
- "use strict";
package/dist/types.d.ts DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * Type definitions for common data structures.
3
- *
4
- * - `StringMap`: Map of string keys to string values.
5
- * - `JsonMap`: Object of primitives, arrays, or nested maps.
6
- * - `JsonValue`: Union type representing a valid JSON value.
7
- *
8
- * They are intended to facilitate type-safe handling
9
- * of generic objects (ex. forms)
10
- **/
11
- export type StringMap = Record<string, string>;
12
- export type JsonMap = {
13
- [key: string]: JsonValue | JsonValue[];
14
- };
15
- export type JsonValue = string | number | boolean | null | undefined | JsonMap;
package/dist/types.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * Type definitions for common data structures.
3
- *
4
- * - `StringMap`: Map of string keys to string values.
5
- * - `JsonMap`: Object of primitives, arrays, or nested maps.
6
- * - `JsonValue`: Union type representing a valid JSON value.
7
- *
8
- * They are intended to facilitate type-safe handling
9
- * of generic objects (ex. forms)
10
- **/
11
- export {};
12
- // clean