Big news!Introducing Socket AI - ChatGPT-Powered Threat Analysis.Learn more
Socket
Socket

internal-slot

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Issues
File Explorer

Advanced tools

internal-slot

ES spec-like internal slots

    1.0.5latest
    GitHub
    npm

Version published
Maintainers
1
Weekly downloads
26,598,278
increased by6.47%

Weekly downloads

Changelog

Source

v1.0.5

9 February 2023

  • [Dev Deps] update @ljharb/eslint-config, aud, object-inspect, tape e427703
  • [Deps] update get-intrinsic aa652f0
  • [Fix] improve assertion message 8df86e3

Readme

Source

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.

Keywords

FAQs

Last updated on 09 Feb 2023

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
Socket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc