helpyourneighbour/node_modules/side-channel
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 Version Badge

github actions coverage License Downloads

npm badge

Store information about any JS value in a side channel. Uses WeakMap if available.

Warning: in an environment that lacks WeakMap, this implementation will leak memory until you delete the key.

Getting started

npm install --save side-channel

Usage/Examples

const assert = require('assert');
const getSideChannel = require('side-channel');

const channel = getSideChannel();

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