All Downloads are FREE. Search and download functionalities are using the official Maven repository.

polyfills.WeakMap.meta.json Maven / Gradle / Ivy

The newest version!
{"aliases":["es6"],"browsers":{"ie":"7 - 11","ie_mob":"10 - 11","safari":"<9","chrome":"<38","firefox":"<36","android":"*","ios_saf":"<9","opera":"<25","firefox_mob":"<36","bb":"10 - *"},"dependencies":["Object.defineProperty","Array.prototype.forEach","Date.now"],"license":"https://github.com/webcomponents/webcomponentsjs/blob/master/LICENSE.md","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap","detectSource":"(function(global) {\n\tif (!(\"WeakMap\" in global)) return false;\n\tvar o = {};\n\tvar wm = new WeakMap([[o, 'test']]);\n\treturn (wm.get(o) === 'test');\n}(this))","testSource":"","baseDir":"WeakMap","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nit('has get, set, delete, and has functions', function() {\n\tproclaim.notEqual(WeakMap.prototype['get'], undefined);\n\tproclaim.notEqual(WeakMap.prototype['set'], undefined);\n\tproclaim.notEqual(WeakMap.prototype['delete'], undefined);\n\tproclaim.notEqual(WeakMap.prototype['has'], undefined);\n});\nit('should perform as expected', function() {\n\tvar wm = new WeakMap();\n\tvar o1 = {};\n\tvar o2 = function(){};\n\tvar o3 = window;\n\twm.set(o1, 37);\n\tproclaim.equal(wm.get(o1), 37);\n\n\twm.set(o1, o2);\n\twm.set(o3, undefined);\n\tproclaim.deepEqual(wm.get(o1), o2);\n\n\t// `wm.get({})` should return undefined, because there is no value for the object on wm\n\tproclaim.equal(wm.get({}), undefined);\n\n\t// `wm.get(o3)` should return undefined, because that is the set value\n\tproclaim.equal(wm.get(o3), undefined);\n\n\tproclaim.equal(wm.has(o1), true);\n\tproclaim.equal(wm.has({}), false);\n\n\t// Ensure that delete returns true/false indicating if the value was removed\n\tproclaim.equal(wm['delete'](o1), true);\n\tproclaim.equal(wm['delete']({}), false);\n\n\tproclaim.equal(wm.get(o1), undefined);\n\tproclaim.equal(wm.has(o1), false);\n});\n\n// Fails in IE11, supported in the polyfill\nit('should be chainable', function() {\n\tvar wm = new WeakMap();\n\tvar o1 = {};\n\tvar o2 = function(){};\n\twm.set(o1, 37).set(o2, 'aoeui');\n\tproclaim.equal(wm.get(o2), 'aoeui');\n})\n\n// IE <= 8 does not allow invocation of delete as a property of an object using dot notation\nit.skip('should allow use of dot notation for delete method', function() {\n\tvar wm = new WeakMap();\n\tvar o1 = {};\n\twm.set(o1, 37);\n\t//wm.delete(o1);  // Causes an error during parse in IE<=8, which will prevent other tests from running even though this test is marked as skipped!\n\tproclaim.equal(wm.has(o1), false);\n})\n\n// Ealy native implementations do not support this, polyfill does\nit('should be possible to prepopulate the map', function() {\n\tvar o1 = {};\n\tvar wm = new WeakMap([\n\t\t[o1, 12],\n\t\t[function(){}, 'foo'],\n\t\t[window]\n\t]);\n\n\tproclaim.equal(wm.get(window), undefined);\n\tproclaim.equal(wm.get(o1), 12);\n});"}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy