🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

weakmap-polyfill

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
w

weakmap-polyfill

ECMAScript6 WeakMap polyfill

2.0.4
latest
100

Supply Chain Security

100

Vulnerability

90

Quality

76

Maintenance

100

License

Version published
Weekly downloads
272K
-12.86%
Maintainers
1
Weekly downloads
 
Created
Issues
7

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

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