{"aliases":["default"],"browsers":{"ie":"<12","firefox":"<29","safari":"<8","ios_saf":"<7.1","chrome":"<38","firefox_mob":"<29"},"dependencies":["Array.prototype.indexOf","Symbol","Symbol.iterator","Symbol.species","Object.defineProperty","Number.isNaN"],"notes":["For compatibility with very old engines, `Map.prototype.delete` must be accessed using square bracket notation because 'delete' is a reserved word. `myMap.delete()` is an error in IE8. Use `myMap['delete']()` instead.","The test suite for this polyfill is derived from work of Andrea Giammarchi which is [published under an MIT licence](https://github.com/WebReflection/es6-collections)"],"baseDir":"Map","hasTests":true,"rawSource":"\n// Map\n(function(global) {\n\n\n\t// Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.\n\tvar undefMarker = Symbol('undef');\n\n\t// NaN cannot be found in an array using indexOf, so we encode NaNs using a private symbol.\n\tvar NaNMarker = Symbol('NaN');\n\n\tfunction encodeKey(key) {\n\t\treturn Number.isNaN(key) ? NaNMarker : key;\n\t}\n\tfunction decodeKey(encodedKey) {\n\t\treturn (encodedKey === NaNMarker) ? NaN : encodedKey;\n\t}\n\n\tfunction makeIterator(mapInst, getter) {\n\t\tvar nextIdx = 0;\n\t\tvar done = false;\n\t\treturn {\n\t\t\tnext: function() {\n\t\t\t\tif (nextIdx === mapInst._keys.length) done = true;\n\t\t\t\tif (!done) {\n\t\t\t\t\twhile (mapInst._keys[nextIdx] === undefMarker) nextIdx++;\n\t\t\t\t\treturn {value: getter.call(mapInst, nextIdx++), done: false};\n\t\t\t\t} else {\n\t\t\t\t\treturn {done:true};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction calcSize(mapInst) {\n\t\tvar size = 0;\n\t\tfor (var i=0, s=mapInst._keys.length; i<s; i++) {\n\t\t\tif (mapInst._keys[i] !== undefMarker) size++;\n\t\t}\n\t\treturn size;\n\t}\n\n\tvar ACCESSOR_SUPPORT = true;\n\n\tvar Map = function(data) {\n\t\tthis._keys = [];\n\t\tthis._values = [];\n\n\t\t// If `data` is iterable (indicated by presence of a forEach method), pre-populate the map\n\t\tdata && (typeof data.forEach === 'function') && data.forEach(function (item) {\n\t\t\tthis.set.apply(this, item);\n\t\t}, this);\n\n\t\tif (!ACCESSOR_SUPPORT) this.size = calcSize(this);\n\t};\n\tMap.prototype = {};\n\n\t// Some old engines do not support ES5 getters/setters.  Since Map only requires these for the size property, we can fall back to setting the size property statically each time the size of the map changes.\n\ttry {\n\t\tObject.defineProperty(Map.prototype, 'size', {\n\t\t\tget: function() {\n\t\t\t\treturn calcSize(this);\n\t\t\t}\n\t\t});\n\t} catch(e) {\n\t\tACCESSOR_SUPPORT = false;\n\t}\n\n\tMap.prototype['get'] = function(key) {\n\t\tvar idx = this._keys.indexOf(encodeKey(key));\n\t\treturn (idx !== -1) ? this._values[idx] : undefined;\n\t};\n\tMap.prototype['set'] = function(key, value) {\n\t\tvar idx = this._keys.indexOf(encodeKey(key));\n\t\tif (idx !== -1) {\n\t\t\tthis._values[idx] = value;\n\t\t} else {\n\t\t\tthis._keys.push(encodeKey(key));\n\t\t\tthis._values.push(value);\n\t\t\tif (!ACCESSOR_SUPPORT) this.size = calcSize(this);\n\t\t}\n\t\treturn this;\n\t};\n\tMap.prototype['has'] = function(key) {\n\t\treturn (this._keys.indexOf(encodeKey(key)) !== -1);\n\t};\n\tMap.prototype['delete'] = function(key) {\n\t\tvar idx = this._keys.indexOf(encodeKey(key));\n\t\tif (idx === -1) return false;\n\t\tthis._keys[idx] = undefMarker;\n\t\tthis._values[idx] = undefMarker;\n\t\tif (!ACCESSOR_SUPPORT) this.size = calcSize(this);\n\t\treturn true;\n\t};\n\tMap.prototype['clear'] = function() {\n\t\tthis._keys = this._values = [];\n\t\tif (!ACCESSOR_SUPPORT) this.size = 0;\n\t};\n\tMap.prototype['values'] = function() {\n\t\treturn makeIterator(this, function(i) { return this._values[i]; });\n\t};\n\tMap.prototype['keys'] = function() {\n\t\treturn makeIterator(this, function(i) { return decodeKey(this._keys[i]); });\n\t};\n\tMap.prototype['entries'] =\n\tMap.prototype[Symbol.iterator] = function() {\n\t\treturn makeIterator(this, function(i) { return [decodeKey(this._keys[i]), this._values[i]]; });\n\t};\n\tMap.prototype['forEach'] = function(callbackFn, thisArg) {\n\t\tthisArg = thisArg || global;\n\t\tvar iterator = this.entries();\n\t\tresult = iterator.next();\n\t\twhile (result.done === false) {\n\t\t\tcallbackFn.call(thisArg, result.value[1], result.value[0], this);\n\t\t\tresult = iterator.next();\n\t\t}\n\t};\n\tMap.prototype['constructor'] =\n\tMap.prototype[Symbol.species] = Map;\n\n\tMap.length = 0;\n\n\t// Export the object\n\tthis.Map = Map;\n\n})(this);\n","minSource":"!function(t){function e(t){return Number.isNaN(t)?o:t}function s(t){return t===o?NaN:t}function n(t,e){var s=0,n=!1;return{next:function(){if(s===t._keys.length&&(n=!0),n)return{done:!0};for(;t._keys[s]===i;)s++;return{value:e.call(t,s++),done:!1}}}}function r(t){for(var e=0,s=0,n=t._keys.length;n>s;s++)t._keys[s]!==i&&e++;return e}var i=Symbol(\"undef\"),o=Symbol(\"NaN\"),u=!0,h=function(t){this._keys=[],this._values=[],t&&\"function\"==typeof t.forEach&&t.forEach(function(t){this.set.apply(this,t)},this),u||(this.size=r(this))};h.prototype={};try{Object.defineProperty(h.prototype,\"size\",{get:function(){return r(this)}})}catch(y){u=!1}h.prototype.get=function(t){var s=this._keys.indexOf(e(t));return-1!==s?this._values[s]:void 0},h.prototype.set=function(t,s){var n=this._keys.indexOf(e(t));return-1!==n?this._values[n]=s:(this._keys.push(e(t)),this._values.push(s),u||(this.size=r(this))),this},h.prototype.has=function(t){return-1!==this._keys.indexOf(e(t))},h.prototype[\"delete\"]=function(t){var s=this._keys.indexOf(e(t));return-1===s?!1:(this._keys[s]=i,this._values[s]=i,u||(this.size=r(this)),!0)},h.prototype.clear=function(){this._keys=this._values=[],u||(this.size=0)},h.prototype.values=function(){return n(this,function(t){return this._values[t]})},h.prototype.keys=function(){return n(this,function(t){return s(this._keys[t])})},h.prototype.entries=h.prototype[Symbol.iterator]=function(){return n(this,function(t){return[s(this._keys[t]),this._values[t]]})},h.prototype.forEach=function(e,s){s=s||t;var n=this.entries();for(result=n.next();result.done===!1;)e.call(s,result.value[1],result.value[0],this),result=n.next()},h.prototype.constructor=h.prototype[Symbol.species]=h,h.length=0,this.Map=h}(this);","detectSource":"'Map' in this && (function() {\n\treturn (new Map([[1,1], [2,2]])).size === 2;\n}())"}