@@ -70,8 +70,9 @@ module.exports = {
70
70
} ;
71
71
72
72
redefineAll ( C . prototype , {
73
- // 23.1.3.1 Map.prototype.clear()
74
- // 23.2.3.2 Set.prototype.clear()
73
+ // `{ Map, Set }.prototype.clear()` methods
74
+ // https://tc39.es/ecma262/#sec-map.prototype.clear
75
+ // https://tc39.es/ecma262/#sec-set.prototype.clear
75
76
clear : function clear ( ) {
76
77
var that = this ;
77
78
var state = getInternalState ( that ) ;
@@ -87,8 +88,9 @@ module.exports = {
87
88
if ( DESCRIPTORS ) state . size = 0 ;
88
89
else that . size = 0 ;
89
90
} ,
90
- // 23.1.3.3 Map.prototype.delete(key)
91
- // 23.2.3.4 Set.prototype.delete(value)
91
+ // `{ Map, Set }.prototype.delete(key)` methods
92
+ // https://tc39.es/ecma262/#sec-map.prototype.delete
93
+ // https://tc39.es/ecma262/#sec-set.prototype.delete
92
94
'delete' : function ( key ) {
93
95
var that = this ;
94
96
var state = getInternalState ( that ) ;
@@ -106,8 +108,9 @@ module.exports = {
106
108
else that . size -- ;
107
109
} return ! ! entry ;
108
110
} ,
109
- // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
110
- // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
111
+ // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
112
+ // https://tc39.es/ecma262/#sec-map.prototype.foreach
113
+ // https://tc39.es/ecma262/#sec-set.prototype.foreach
111
114
forEach : function forEach ( callbackfn /* , that = undefined */ ) {
112
115
var state = getInternalState ( this ) ;
113
116
var boundFunction = bind ( callbackfn , arguments . length > 1 ? arguments [ 1 ] : undefined , 3 ) ;
@@ -118,25 +121,29 @@ module.exports = {
118
121
while ( entry && entry . removed ) entry = entry . previous ;
119
122
}
120
123
} ,
121
- // 23.1.3.7 Map.prototype.has(key)
122
- // 23.2.3.7 Set.prototype.has(value)
124
+ // `{ Map, Set}.prototype.has(key)` methods
125
+ // https://tc39.es/ecma262/#sec-map.prototype.has
126
+ // https://tc39.es/ecma262/#sec-set.prototype.has
123
127
has : function has ( key ) {
124
128
return ! ! getEntry ( this , key ) ;
125
129
}
126
130
} ) ;
127
131
128
132
redefineAll ( C . prototype , IS_MAP ? {
129
- // 23.1.3.6 Map.prototype.get(key)
133
+ // `Map.prototype.get(key)` method
134
+ // https://tc39.es/ecma262/#sec-map.prototype.get
130
135
get : function get ( key ) {
131
136
var entry = getEntry ( this , key ) ;
132
137
return entry && entry . value ;
133
138
} ,
134
- // 23.1.3.9 Map.prototype.set(key, value)
139
+ // `Map.prototype.set(key, value)` method
140
+ // https://tc39.es/ecma262/#sec-map.prototype.set
135
141
set : function set ( key , value ) {
136
142
return define ( this , key === 0 ? 0 : key , value ) ;
137
143
}
138
144
} : {
139
- // 23.2.3.1 Set.prototype.add(value)
145
+ // `Set.prototype.add(value)` method
146
+ // https://tc39.es/ecma262/#sec-set.prototype.add
140
147
add : function add ( value ) {
141
148
return define ( this , value = value === 0 ? 0 : value , value ) ;
142
149
}
@@ -152,8 +159,15 @@ module.exports = {
152
159
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator' ;
153
160
var getInternalCollectionState = internalStateGetterFor ( CONSTRUCTOR_NAME ) ;
154
161
var getInternalIteratorState = internalStateGetterFor ( ITERATOR_NAME ) ;
155
- // add .keys, .values, .entries, [@@iterator]
156
- // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
162
+ // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
163
+ // https://tc39.es/ecma262/#sec-map.prototype.entries
164
+ // https://tc39.es/ecma262/#sec-map.prototype.keys
165
+ // https://tc39.es/ecma262/#sec-map.prototype.values
166
+ // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
167
+ // https://tc39.es/ecma262/#sec-set.prototype.entries
168
+ // https://tc39.es/ecma262/#sec-set.prototype.keys
169
+ // https://tc39.es/ecma262/#sec-set.prototype.values
170
+ // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
157
171
defineIterator ( C , CONSTRUCTOR_NAME , function ( iterated , kind ) {
158
172
setInternalState ( this , {
159
173
type : ITERATOR_NAME ,
@@ -180,7 +194,9 @@ module.exports = {
180
194
return { value : [ entry . key , entry . value ] , done : false } ;
181
195
} , IS_MAP ? 'entries' : 'values' , ! IS_MAP , true ) ;
182
196
183
- // add [@@species ], 23.1.2.2, 23.2.2.2
197
+ // `{ Map, Set }.prototype[@@species]` accessors
198
+ // https://tc39.es/ecma262/#sec-get-map-@@species
199
+ // https://tc39.es/ecma262/#sec-get-set-@@species
184
200
setSpecies ( CONSTRUCTOR_NAME ) ;
185
201
}
186
202
} ;
0 commit comments