Buckets:
186 GB
47,027 files
Updated 3 months ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .github | 1 items | ||
| test | 1 items | ||
| .editorconfig | 145 Bytes xet | bd3328cb | |
| .eslintrc | 203 Bytes xet | e11ceb9b | |
| .nycrc | 216 Bytes xet | 4448e85a | |
| CHANGELOG.md | 1.48 kB xet | 011e719d | |
| LICENSE | 1.07 kB xet | 0bef5703 | |
| README.md | 2.34 kB xet | 3fcb964f | |
| index.d.ts | 382 Bytes xet | 06146156 | |
| index.js | 2.71 kB xet | e5218b1e | |
| package.json | 2.45 kB xet | f7517e42 | |
| tsconfig.json | 116 Bytes xet | 46720049 |
side-channel-weakmap
Store information about any JS value in a side channel. Uses WeakMap if available.
Warning: this implementation will leak memory until you delete the key.
Use side-channel for the best available strategy.
Getting started
npm install --save side-channel-weakmap
Usage/Examples
const assert = require('assert');
const getSideChannelList = require('side-channel-weakmap');
const channel = getSideChannelList();
const key = {};
assert.equal(channel.has(key), false);
assert.throws(() => channel.assert(key), TypeError);
channel.set(key, 42);
channel.assert(key); // does not throw
assert.equal(channel.has(key), true);
assert.equal(channel.get(key), 42);
channel.delete(key);
assert.equal(channel.has(key), false);
assert.throws(() => channel.assert(key), TypeError);
Tests
Clone the repo, npm install, and run npm test
- Total size
- 186 GB
- Files
- 47,027
- Last updated
- May 1
- Pre-warmed CDN
- US EU US EU
