qznt 1.0.21 → 1.0.22
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/README.md +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ import { obj, Loop, date } from "qznt";
|
|
|
27
27
|
const theme = qznt.obj.get(settings, "ui.theme.mode", "dark");
|
|
28
28
|
|
|
29
29
|
// Readable durations
|
|
30
|
-
const
|
|
30
|
+
const time = $.date.duration(Date.now() + 5000); // "in 5 seconds"
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## 📦 Namespaces
|
|
@@ -46,11 +46,13 @@ const timeRemaining = $.date.duration(Date.now() + 5000); // "in 5 seconds"
|
|
|
46
46
|
- **`qznt.timing` (Execution)**: `debounce`, `throttle`, and promise-based `wait`
|
|
47
47
|
- **`qznt.to` (Transformations)**: Powerful data mappers like `to.record`
|
|
48
48
|
|
|
49
|
+
_These are just the highlights, there's more inside._
|
|
50
|
+
|
|
49
51
|
## ✨ Featured Utilities
|
|
50
52
|
|
|
51
53
|
### The Smart `Loop`
|
|
52
54
|
|
|
53
|
-
`qznt.Loop` ensures async tasks never overlap. It waits for execution to finish before scheduling the next interval, and supports precise pausing/resuming.
|
|
55
|
+
`qznt.Loop` ensures async tasks never overlap. It waits for execution to finish before scheduling the next interval, and supports precise pausing/resuming. _This is usually more efficient than `node-cron` for tasks that don't need scheduling._
|
|
54
56
|
|
|
55
57
|
```ts
|
|
56
58
|
import qznt from "qznt";
|
|
@@ -70,8 +72,8 @@ heartbeat.resume(); // Resumes with the exact remaining delay
|
|
|
70
72
|
|
|
71
73
|
`qznt` provides high-performant data persistence and memory management.
|
|
72
74
|
|
|
73
|
-
- `qznt.Cache`:
|
|
74
|
-
- `qznt.Storage`:
|
|
75
|
+
- `qznt.Cache`: An in-memory TTL cache with Sampled Passive/Active Eviction. It automatically purges expired entries to prevent memory leaks without blocking the event loop.
|
|
76
|
+
- `qznt.Storage`: A persistent cache. It automatically uses `localStorage` in browsers and falls back to local JSON files in Node.js environments. Think a mini, smart-Redis cache.
|
|
75
77
|
|
|
76
78
|
```ts
|
|
77
79
|
// Cache with a 1-minute global TTL
|