side-channel-weakmap
Store information about any JS value in a side channel, using a WeakMap for objects and a Map for primitives.
by ljharbJavaScript
Meet the team
See all 1 on GitHub →Commit activity
Last 12 weeks · 0 commits
Community health
4 of 6 standards met
Recent fixes
Draft: add the explicit entry and preserve the root API. Dependency: https://github.com/ljharb/side-channel-map/pull/2 must be released first. This branch uses its new storage subpath for primitive-key fallback. Before merge, the minimum side-channel-map dependency must be updated to the first published version with that subpath. No nonexistent release version has been placed in package.json. Registry-only CI cannot pass this integration until that dependency is released. This exposes a storage-only subpath while keeping the existing root API, assertion behavior, native-intrinsic captures, and collection fallbacks. Consumers that do not call assert can avoid loading its formatter without changing their storage algorithm. The get/has/set/delete implementation is shared by the new subpath and the existing root entry. The root still supplies assert, including its existing error messages and dynamic lookup of channel.has. Validation with the coordinated source branches: Existing and new test suites pass on Node 16.20.2 and 24.19.0. ESLint passes (existing warnings remain); declarations and checked JS pass TypeScript 5.9.3 with dependency paths pointing to the coordinated source branches. An additional local before/after differential passes with WeakMap+Map, Map-only, WeakMap-only, and neither, including primitive/NaN keys, aliases/cycles, filter-created objects, Proxy access order, and late collection-prototype mutation. A cold-load regression test rejects any attempt by the storage entry to load object-inspect. Package dry runs include storage.js and storage.d.ts. The root now wraps a storage object to preserve its existing own-property order and closed-over assertion semantics. That adds one wrapper object for root-entry users; no runtime-performance improvement is claimed. The Node <16 CI matrix remains to be run upstream. The no-WeakMap export still falls back to the public Map factory for the root entry, and to Map storage for the storage entry. Existing WeakMap handling, primitive-key routing, native-method capture, and deletion behavior remain shared. Coordinated integration: https://github.com/ljharb/side-channel/pull/17; consumer: https://github.com/ljharb/qs/pull/632.
Repository: ljharb/side-channel-weakmap. Description: Store information about any JS value in a side channel, using a WeakMap for objects and a Map for primitives. Stars: 2, Forks: 2. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Open PRs: 0, open issues: 1. Last activity: 9mo ago. Community health: 85%. Top contributors: ljharb.