internal-slot (1.1.0)

Published 2026-02-24 13:58:11 +00:00 by atheaadmin

Installation

registry=
npm install internal-slot@1.1.0
"internal-slot": "1.1.0"

About this package

internal-slot Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Truly private storage, akin to the JS spec’s concept of internal slots.

Uses a WeakMap when available; a Map when not; and a regular object in even older engines. Performance and garbage collection behavior will reflect the environment’s capabilities accordingly.

Example

var SLOT = require('internal-slot');
var assert = require('assert');

var o = {};

assert.throws(function () { SLOT.assert(o, 'foo'); });

assert.equal(SLOT.has(o, 'foo'), false);
assert.equal(SLOT.get(o, 'foo'), undefined);

SLOT.set(o, 'foo', 42);

assert.equal(SLOT.has(o, 'foo'), true);
assert.equal(SLOT.get(o, 'foo'), 42);

assert.doesNotThrow(function () { SLOT.assert(o, 'foo'); });

Tests

Simply clone the repo, npm install, and run npm test

Security

Please email @ljharb or see https://tidelift.com/security if you have a potential security vulnerability to report.

Dependencies

Dependencies

ID Version
es-errors ^1.3.0
hasown ^2.0.2
side-channel ^1.1.0

Development Dependencies

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

Keywords

internal slot internal slot ecmascript es spec private data private data weakmap
Details
npm
2026-02-24 13:58:11 +00:00
1
Jordan Harband
MIT
latest
7.7 KiB
Assets (1)
Versions (1) View all
1.1.0 2026-02-24