{ "name": "es6-weak-map", "version": "0.1.2", "description": "ECMAScript6 WeakMap polyfill", "author": { "name": "Mariusz Nowak", "email": "medyk@medikoo.com", "url": "http://www.medikoo.com/" }, "keywords": [ "map", "weakmap", "collection", "es6", "harmony", "list", "hash", "gc" ], "repository": { "type": "git", "url": "git://github.com/medikoo/es6-weak-map.git" }, "dependencies": { "d": "~0.1.1", "es5-ext": "~0.10.4", "es6-iterator": "~0.1.1", "es6-symbol": "0.1.x" }, "devDependencies": { "tad": "0.2.x" }, "scripts": { "test": "node ./node_modules/tad/bin/tad" }, "license": "MIT", "readme": "# es6-weak-map\n## WeakMap collection as specified in ECMAScript6\n\n_Roughly inspired by Mark Miller's and Kris Kowal's [WeakMap implementation](https://github.com/drses/weak-map)_.\n\nDifferences are:\n- Assumes compliant ES5 environment (no weird ES3 workarounds or hacks)\n- Well modularized CJS style\n- Based on one solution.\n\n### Limitations\n\n- Will fail on non extensible objects provided as keys\n- While `clear` method is provided, it's not perfectly spec compliant. If some objects were saved as _values_, they need to be removed via `delete`. Otherwise they'll remain infinitely attached to _key_ object (that means, they'll be free for GC only if _key_ object was collected as well).\n\n### Installation\n\n\t$ npm install es6-weak-map\n\nTo port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)\n\n### Usage\n\nIf you want to make sure your environment implements `WeakMap`, do:\n\n```javascript\nrequire('es6-weak-map/implement');\n```\n\nIf you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing `WeakMap` on global scope, do:\n\n```javascript\nvar WeakMap = require('es6-weak-map');\n```\n\nIf you strictly want to use polyfill even if native `WeakMap` exists, do:\n\n```javascript\nvar WeakMap = require('es6-weak-map/polyfill');\n```\n\n#### API\n\nBest is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-objects). Still if you want quick look, follow example:\n\n```javascript\nvar WeakMap = require('es6-weak-map');\n\nvar map = new WeakMap();\nvar obj = {};\n\nmap.set(obj, 'foo'); // map\nmap.get(obj); // 'foo'\nmap.has(obj); // true\nmap.delete(obj); // true\nmap.get(obj); // undefined\nmap.has(obj); // false\nmap.set(obj, 'bar'); // map\nmap.clear(); // undefined\nmap.has(obj); // false\n```\n\n## Tests [![Build Status](https://travis-ci.org/medikoo/es6-weak-map.png)](https://travis-ci.org/medikoo/es6-weak-map)\n\n\t$ npm test\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/medikoo/es6-weak-map/issues" }, "homepage": "https://github.com/medikoo/es6-weak-map", "_id": "es6-weak-map@0.1.2", "_shasum": "bc5b5fab73f68f6f77a6b39c481fce3d7856d385", "_from": "es6-weak-map@~0.1.2", "_resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-0.1.2.tgz" }