helpyourneighbour/node_modules/side-channel-map
BibaBot bfd432d094
Some checks are pending
Docker Test / test (push) Waiting to run
Add comprehensive tests for role middleware and fix package dependencies
2026-03-16 20:07:22 +00:00
..
.github Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
test Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
.editorconfig Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
.eslintrc Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
.nycrc Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
CHANGELOG.md Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
index.d.ts Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
index.js Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
LICENSE Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
package.json Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
README.md Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00:00
tsconfig.json Add comprehensive tests for role middleware and fix package dependencies 2026-03-16 20:07:22 +00: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