safe-memory-layer 1.1.2 → 1.2.2

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.
Files changed (2) hide show
  1. package/README.md +41 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -537,6 +537,42 @@ store.set("user:1", { id: "1", name: "Alice", email: "alice@example.com" });
537
537
  const user = store.get("user:1"); // Type: User | undefined
538
538
  ```
539
539
 
540
+ ## JavaScript Support
541
+
542
+ The library works seamlessly with plain JavaScript (no TypeScript required). Since it's compiled to both ESM and CommonJS, you can use it in any JavaScript project.
543
+
544
+ ### ESM (Modern JavaScript)
545
+
546
+ ```javascript
547
+ import { MemoryStore, WeakMemoryStore } from "safe-memory-layer";
548
+
549
+ const cache = new MemoryStore();
550
+ cache.set("key", "value", { ttl: 60000 });
551
+ const value = cache.get("key");
552
+ cache.dispose();
553
+ ```
554
+
555
+ ### CommonJS (Node.js)
556
+
557
+ ```javascript
558
+ const { MemoryStore, WeakMemoryStore } = require("safe-memory-layer");
559
+
560
+ const cache = new MemoryStore();
561
+ cache.set("key", "value", { ttl: 60000 });
562
+ const value = cache.get("key");
563
+ cache.dispose();
564
+ ```
565
+
566
+ ### JavaScript Features
567
+
568
+ - No TypeScript required
569
+ - Works with ESM and CommonJS
570
+ - Full API access (same as TypeScript)
571
+ - No type annotations needed
572
+ - Dynamic typing support
573
+
574
+ See `examples/javascript-usage.js` for a complete JavaScript example.
575
+
540
576
  ## License
541
577
 
542
578
  MIT
@@ -565,4 +601,8 @@ npm test
565
601
 
566
602
  ### 1.1.2
567
603
 
568
- - support Electron desktop (Framework)
604
+ - support Electron desktop (Framework)
605
+
606
+ ### 1.2.2
607
+
608
+ - support JS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safe-memory-layer",
3
- "version": "1.1.2",
3
+ "version": "1.2.2",
4
4
  "description": "Secure, lightweight, dependency-free in-memory storage with TTL support, automatic cleanup, and memory leak prevention for Node.js and browsers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",