codigo0/backend/node_modules/side-channel-map
planetazuzu 0201f16cf4
Some checks are pending
Auto Deploy to Server / deploy (push) Waiting to run
Update lab configuration 2026-03-22
2026-03-22 22:50:29 +01:00
..
.github Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
test Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
.editorconfig Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
.eslintrc Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
.nycrc Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
CHANGELOG.md Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
index.d.ts Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
index.js Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
LICENSE Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
package.json Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
README.md Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01:00
tsconfig.json Update lab configuration 2026-03-22 2026-03-22 22:50:29 +01: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