@@ -19,11 +19,14 @@ var Class = require('../utils/Class');
1919/**
2020 * @classdesc
2121 * The keys of a Map can be arbitrary values.
22+ *
23+ * ```javascript
2224 * var map = new Map([
2325 * [ 1, 'one' ],
2426 * [ 2, 'two' ],
2527 * [ 3, 'three' ]
2628 * ]);
29+ * ```
2730 *
2831 * @class Map
2932 * @memberOf Phaser.Structs
@@ -34,7 +37,7 @@ var Class = require('../utils/Class');
3437 * @generic V
3538 * @genericUse {V[]} - [elements]
3639 *
37- * @param {Array.<*> } elements - [description]
40+ * @param {Array.<*> } elements - An optional array of key-value pairs to populate this Map with.
3841 */
3942var Map = new Class ( {
4043
@@ -43,7 +46,7 @@ var Map = new Class({
4346 function Map ( elements )
4447 {
4548 /**
46- * [description]
49+ * The entries in this Map.
4750 *
4851 * @genericUse {Object.<string, V>} - [$type]
4952 *
@@ -55,7 +58,7 @@ var Map = new Class({
5558 this . entries = { } ;
5659
5760 /**
58- * [description]
61+ * The number of key / value pairs in this Map.
5962 *
6063 * @name Phaser.Structs.Map#size
6164 * @type {number }
@@ -74,7 +77,7 @@ var Map = new Class({
7477 } ,
7578
7679 /**
77- * [description]
80+ * Adds an element with a specified `key` and `value` to this Map.
7881 *
7982 * @method Phaser.Structs.Map#set
8083 * @since 3.0.0
@@ -83,8 +86,8 @@ var Map = new Class({
8386 * @genericUse {V} - [value]
8487 * @genericUse {Phaser.Structs.Map.<K, V>} - [$return]
8588 *
86- * @param {string } key - [description]
87- * @param {* } value - [description]
89+ * @param {string } key - The key of the element to be added to this Map.
90+ * @param {* } value - The value of the element to be added to this Map.
8891 *
8992 * @return {Phaser.Structs.Map } This Map object.
9093 */
@@ -100,17 +103,17 @@ var Map = new Class({
100103 } ,
101104
102105 /**
103- * [description]
106+ * Returns the value associated to the `key`, or `undefined` if there is none.
104107 *
105108 * @method Phaser.Structs.Map#get
106109 * @since 3.0.0
107110 *
108111 * @genericUse {K} - [key]
109112 * @genericUse {V} - [$return]
110113 *
111- * @param {string } key - [description]
114+ * @param {string } key - The key of the element to return from the `Map` object.
112115 *
113- * @return {* } [description]
116+ * @return {* } The element associated with the specified key or `undefined` if the key can't be found in this Map object.
114117 */
115118 get : function ( key )
116119 {
@@ -121,14 +124,14 @@ var Map = new Class({
121124 } ,
122125
123126 /**
124- * [description]
127+ * Returns an `Array` of all the values stored in this Map.
125128 *
126129 * @method Phaser.Structs.Map#getArray
127130 * @since 3.0.0
128131 *
129132 * @genericUse {V[]} - [$return]
130133 *
131- * @return {Array.<*> } [description]
134+ * @return {Array.<*> } An array of the values stored in this Map.
132135 */
133136 getArray : function ( )
134137 {
@@ -144,32 +147,32 @@ var Map = new Class({
144147 } ,
145148
146149 /**
147- * [description]
150+ * Returns a boolean indicating whether an element with the specified key exists or not.
148151 *
149152 * @method Phaser.Structs.Map#has
150153 * @since 3.0.0
151154 *
152155 * @genericUse {K} - [key]
153156 *
154- * @param {string } key - [description]
157+ * @param {string } key - The key of the element to test for presence of in this Map.
155158 *
156- * @return {boolean } [description]
159+ * @return {boolean } Returns `true` if an element with the specified key exists in this Map, otherwise `false`.
157160 */
158161 has : function ( key )
159162 {
160163 return ( this . entries . hasOwnProperty ( key ) ) ;
161164 } ,
162165
163166 /**
164- * [description]
167+ * Delete the specified element from this Map.
165168 *
166169 * @method Phaser.Structs.Map#delete
167170 * @since 3.0.0
168171 *
169172 * @genericUse {K} - [key]
170173 * @genericUse {Phaser.Structs.Map.<K, V>} - [$return]
171174 *
172- * @param {string } key - [description]
175+ * @param {string } key - The key of the element to delete from this Map.
173176 *
174177 * @return {Phaser.Structs.Map } This Map object.
175178 */
@@ -185,7 +188,7 @@ var Map = new Class({
185188 } ,
186189
187190 /**
188- * [description]
191+ * Delete all entries from this Map.
189192 *
190193 * @method Phaser.Structs.Map#clear
191194 * @since 3.0.0
@@ -208,29 +211,29 @@ var Map = new Class({
208211 } ,
209212
210213 /**
211- * [description]
214+ * Returns all entries keys in this Map.
212215 *
213216 * @method Phaser.Structs.Map#keys
214217 * @since 3.0.0
215218 *
216219 * @genericUse {K[]} - [$return]
217220 *
218- * @return {string[] } [description]
221+ * @return {string[] } Array containing entries' keys.
219222 */
220223 keys : function ( )
221224 {
222225 return Object . keys ( this . entries ) ;
223226 } ,
224227
225228 /**
226- * [description]
229+ * Returns an `Array` of all entries.
227230 *
228231 * @method Phaser.Structs.Map#values
229232 * @since 3.0.0
230233 *
231234 * @genericUse {V[]} - [$return]
232235 *
233- * @return {Array.<*> } [description]
236+ * @return {Array.<*> } An `Array` of entries.
234237 */
235238 values : function ( )
236239 {
@@ -246,7 +249,7 @@ var Map = new Class({
246249 } ,
247250
248251 /**
249- * [description]
252+ * Dumps the contents of this Map to the console via `console.group`.
250253 *
251254 * @method Phaser.Structs.Map#dump
252255 * @since 3.0.0
@@ -268,15 +271,15 @@ var Map = new Class({
268271 } ,
269272
270273 /**
271- * [description]
274+ * Passes all entries in this Map to the given callback.
272275 *
273276 * @method Phaser.Structs.Map#each
274277 * @since 3.0.0
275278 *
276279 * @genericUse {EachMapCallback.<V>} - [callback]
277280 * @genericUse {Phaser.Structs.Map.<K, V>} - [$return]
278281 *
279- * @param {EachMapCallback } callback - [description]
282+ * @param {EachMapCallback } callback - The callback which will receive the keys and entries held in this Map.
280283 *
281284 * @return {Phaser.Structs.Map } This Map object.
282285 */
@@ -296,16 +299,16 @@ var Map = new Class({
296299 } ,
297300
298301 /**
299- * [description]
302+ * Returns `true` if the value exists within this Map. Otherwise, returns `false`.
300303 *
301304 * @method Phaser.Structs.Map#contains
302305 * @since 3.0.0
303306 *
304307 * @genericUse {V} - [value]
305308 *
306- * @param {* } value - [description]
309+ * @param {* } value - The value to search for.
307310 *
308- * @return {boolean } [description]
311+ * @return {boolean } `true` if the value is found, otherwise `false`.
309312 */
310313 contains : function ( value )
311314 {
@@ -323,17 +326,16 @@ var Map = new Class({
323326 } ,
324327
325328 /**
326- * Merges all new keys from the given Map into this one
327- * If it encounters a key that already exists it will be skipped
328- * unless override = true.
329+ * Merges all new keys from the given Map into this one.
330+ * If it encounters a key that already exists it will be skipped unless override is set to `true`.
329331 *
330332 * @method Phaser.Structs.Map#merge
331333 * @since 3.0.0
332334 *
333335 * @genericUse {Phaser.Structs.Map.<K, V>} - [map,$return]
334336 *
335- * @param {Phaser.Structs.Map } map - [description]
336- * @param {boolean } [override=false] - [description]
337+ * @param {Phaser.Structs.Map } map - The Map to merge in to this Map.
338+ * @param {boolean } [override=false] - Set to `true` to replace values in this Map with those from the source map, or `false` to skip them.
337339 *
338340 * @return {Phaser.Structs.Map } This Map object.
339341 */
0 commit comments