side-channel-weakmap (1.0.2)

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

Installation

registry=
npm install side-channel-weakmap@1.0.2
"side-channel-weakmap": "1.0.2"

About this package

side-channel-weakmap Version Badge

github actions coverage License Downloads

npm badge

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

Warning: this implementation will leak memory until you delete the key. Use side-channel for the best available strategy.

Getting started

npm install --save side-channel-weakmap

Usage/Examples

const assert = require('assert');
const getSideChannelList = require('side-channel-weakmap');

const channel = getSideChannelList();

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
call-bound ^1.0.2
es-errors ^1.3.0
get-intrinsic ^1.2.5
object-inspect ^1.13.3
side-channel-map ^1.0.1

Development Dependencies

ID Version
@arethetypeswrong/cli ^0.17.1
@ljharb/eslint-config ^21.1.1
@ljharb/tsconfig ^0.2.2
@types/call-bind ^1.0.5
@types/get-intrinsic ^1.2.3
@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
0
Jordan Harband
MIT
latest
5.3 KiB
Assets (1)
Versions (1) View all
1.0.2 2026-02-24