1. weakmap-polyfill
ECMAScript6 WeakMap polyfill
weakmap-polyfill
Package: weakmap-polyfill
Created by: polygonplanet
Last modified: Tue, 28 Jun 2022 22:37:01 GMT
Version: 2.0.4
License: MIT
Downloads: 1,448,798
Repository: https://github.com/polygonplanet/weakmap-polyfill

Install

npm install weakmap-polyfill
yarn add weakmap-polyfill

weakmap-polyfill

NPM Version
Build Status
Bundle Size (minified)
GitHub License

ECMAScript6 WeakMap polyfill.

Installation

npm

 $ npm install --save weakmap-polyfill

Usage

Import or require weakmap-polyfill, then WeakMap will be defined in the global scope if native WeakMap is not supported in running environment.

using import

 import 'weakmap-polyfill';
const weakMap = new WeakMap();

using require

 require('weakmap-polyfill');
var weakMap = new WeakMap();

browser (standalone)

 <script src="weakmap-polyfill.min.js"></script>
<script>
var weakMap = new WeakMap();
</script>

Compatibility

  • Chrome 15
  • Firefox 3
  • IE 7
  • Safari 4
  • Opera 11.5
  • Edge

Browser Tests

Limitations

This polyfill has following few limitations.

  • WeakMap iterable argument is not supported. (23.3.1.1 WeakMap ( [ iterable ] ))
  • Frozen and sealed objects are not supported.
  • The values held by a WeakMap can't be collected once the map itself is GCed, since the values here are tied to the keys. #4

License

MIT

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code