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 | 185 Bytes xet | 0b65c934 | |
| .nycrc | 216 Bytes xet | 4448e85a | |
| CHANGELOG.md | 1.19 kB xet | 20ca7951 | |
| LICENSE | 1.07 kB xet | c0d5f000 | |
| README.md | 2.28 kB xet | f0be3496 | |
| index.d.ts | 367 Bytes xet | 7e9db7ce | |
| index.js | 1.98 kB xet | d608c7dd | |
| package.json | 2.34 kB xet | a3237f64 | |
| tsconfig.json | 116 Bytes xet | 46720049 |
side-channel-map
Store information about any JS value in a side channel, using a Map.
Warning: if the key is an object, this implementation will leak memory until you delete it.
Use side-channel for the best available strategy.
Getting started
npm install --save side-channel-map
Usage/Examples
const assert = require('assert');
const getSideChannelMap = require('side-channel-map');
const channel = getSideChannelMap();
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
