Detalhes do pacote

side-channel

ljharb246.3mMIT1.1.0

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

weakmap, map, side, channel

readme (leia-me)

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

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.1.0 - 2024-12-11

Commits

  • [Refactor] extract implementations to side-channel-weakmap, side-channel-map, side-channel-list ada5955
  • [New] add channel.delete c01d2d3
  • [types] improve types 0c54356
  • [readme] add content be24868
  • [actions] split out node 10-20, and 20+ c4488e2
  • [types] use shared tsconfig 0e0d57c
  • [Dev Deps] update @ljharb/eslint-config, @ljharb/tsconfig, @types/get-intrinsic, @types/object-inspect, @types/tape, auto-changelog, tape fb4f622
  • [Deps] update call-bind, get-intrinsic, object-inspect b78336b
  • [Tests] replace aud with npm audit ee3ab46
  • [Dev Deps] add missing peer dep c03e21a

v1.0.6 - 2024-02-29

Commits

v1.0.5 - 2024-02-06

Commits

  • [actions] reuse common workflows 3d2e1ff
  • [meta] use npmignore to autogenerate an npmignore file 04296ea
  • [meta] add .editorconfig; add eclint 130f0a6
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, safe-publish-latest, tape d480c2f
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape ecbe70e
  • [actions] update rebase action 75240b9
  • [Dev Deps] update @ljharb/eslint-config, aud, npmignore, tape ae8d281
  • [Dev Deps] update @ljharb/eslint-config, aud, tape 7125b88
  • [Deps] update call-bind, get-intrinsic, object-inspect 82577c9
  • [Deps] update call-bind, get-intrinsic, object-inspect 550aadf
  • [Tests] increase coverage 5130877
  • [Deps] update get-intrinsic, object-inspect ba0194c
  • [meta] add missing engines.node 985fd24
  • [Refactor] use es-errors, so things that only need those do not need get-intrinsic 40227a8
  • [Deps] update get-intrinsic a989b40
  • [Deps] update object-inspect aec42d2

v1.0.4 - 2020-12-29

Commits

  • [Tests] migrate tests to Github Actions 10909cb
  • [Refactor] Use a linked list rather than an array, and move accessed nodes to the beginning 195613f
  • [meta] do not publish github action workflow files 290ec29
  • [Tests] run nyc on all tests; use tape runner ea6d030
  • [actions] add "Allow Edits" workflow d464d8f
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog 02daca8
  • [Refactor] use call-bind and get-intrinsic instead of es-abstract e09d481
  • [Deps] update object.assign ee83aa8
  • [actions] update rebase action to use checkout v2 7726b0b

v1.0.3 - 2020-08-23

Commits

  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape 1f10561
  • [Deps] update es-abstract, object-inspect bc20159
  • [Dev Deps] update @ljharb/eslint-config, tape b9b2b22
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 7055ab4
  • [Dev Deps] update auto-changelog; add aud d278c37
  • [actions] switch Automatic Rebase workflow to pull_request_target event 3bcf982
  • [Tests] only audit prod deps 18d01c4
  • [Deps] update es-abstract 6ab096d
  • [Dev Deps] update tape 9dc174c
  • [Deps] update es-abstract 431d0f0
  • [Deps] update es-abstract 49869fd
  • [meta] Add package.json to package's exports 77d9cdc

v1.0.2 - 2019-12-20

Commits

  • [Dev Deps] update @ljharb/eslint-config, tape 4a526df
  • [Deps] update es-abstract d4f6e62

v1.0.1 - 2019-12-01

Commits

  • [Fix] add missing "exports" d212907

v1.0.0 - 2019-12-01

Commits

  • Initial implementation dbebd3a
  • Initial tests 73bdefe
  • Initial commit 43c03e1
  • npm init 5c090a7
  • [meta] add auto-changelog a5c4e56
  • [actions] add automatic rebasing / merge commit blocking bab1683
  • [meta] add funding field; create FUNDING.yml 63d7aea
  • [Tests] add npm run lint 46a5a81
  • Only apps should have lockfiles 8b16b03
  • [meta] add safe-publish-latest 2f098ef