Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

weakmap-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weakmap-polyfill

ECMAScript6 WeakMap polyfill


Version published
Weekly downloads
215K
decreased by-16.24%
Maintainers
1
Weekly downloads
 
Created

What is weakmap-polyfill?

The weakmap-polyfill npm package provides a polyfill for the WeakMap object, which is a collection of key/value pairs where the keys are objects and the values can be arbitrary values. This polyfill is useful for environments that do not natively support WeakMap.

What are weakmap-polyfill's main functionalities?

Creating a WeakMap

This feature allows you to create a new instance of a WeakMap using the polyfill.

const WeakMapPolyfill = require('weakmap-polyfill');
const wm = new WeakMapPolyfill();

Setting a value

This feature allows you to set a value in the WeakMap for a specific object key.

const obj = {};
wm.set(obj, 'value');

Getting a value

This feature allows you to retrieve a value from the WeakMap using an object key.

const value = wm.get(obj);

Checking for a key

This feature allows you to check if a specific object key exists in the WeakMap.

const hasKey = wm.has(obj);

Deleting a key

This feature allows you to remove a key/value pair from the WeakMap.

wm.delete(obj);

Other packages similar to weakmap-polyfill

Keywords

FAQs

Package last updated on 06 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc