ken_nogi/NodeJS/postfixconsole_org2/node_modules/side-channel-map
Kenichiro NOGI 88a402ce0f up
2026-07-10 18:13:30 +09:00
..
.github up 2026-07-10 18:13:30 +09:00
test up 2026-07-10 18:13:30 +09:00
.editorconfig up 2026-07-10 18:13:30 +09:00
.eslintrc up 2026-07-10 18:13:30 +09:00
.nycrc up 2026-07-10 18:13:30 +09:00
CHANGELOG.md up 2026-07-10 18:13:30 +09:00
index.d.ts up 2026-07-10 18:13:30 +09:00
index.js up 2026-07-10 18:13:30 +09:00
LICENSE up 2026-07-10 18:13:30 +09:00
package.json up 2026-07-10 18:13:30 +09:00
README.md up 2026-07-10 18:13:30 +09:00
tsconfig.json up 2026-07-10 18:13:30 +09:00

side-channel-map Version Badge

github actions coverage License Downloads

npm badge

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