side-channel (1.1.0)

Published 2026-02-24 14:05:05 +00:00 by atheaadmin

Installation

registry=
npm install side-channel@1.1.0
"side-channel": "1.1.0"

About this package

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

Dependencies

Dependencies

ID Version
es-errors ^1.3.0
object-inspect ^1.13.3
side-channel-list ^1.0.0
side-channel-map ^1.0.1
side-channel-weakmap ^1.0.2

Development Dependencies

ID Version
@arethetypeswrong/cli ^0.17.1
@ljharb/eslint-config ^21.1.1
@ljharb/tsconfig ^0.2.2
@types/object-inspect ^1.13.0
@types/tape ^5.6.5
auto-changelog ^2.5.0
eclint ^2.8.1
encoding ^0.1.13
eslint =8.8.0
in-publish ^2.0.1
npmignore ^0.3.1
nyc ^10.3.2
safe-publish-latest ^2.0.0
tape ^5.9.0
typescript next

Keywords

weakmap map side channel metadata
Details
npm
2026-02-24 14:05:05 +00:00
1
Jordan Harband
MIT
latest
7.6 KiB
Assets (1)
Versions (1) View all
1.1.0 2026-02-24