Wondering what’s next for npm?Check out our public roadmap! »

    weakmap-polyfill

    2.0.3 • Public • Published

    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.

    node

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

    webpack etc.

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

    browser (standalone)

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

    Compatibility

    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

    Install

    npm i weakmap-polyfill

    DownloadsWeekly Downloads

    99,045

    Version

    2.0.3

    License

    MIT

    Unpacked Size

    9.57 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar