@@ -13,10 +13,10 @@ const original = {
13
13
] ,
14
14
} ;
15
15
16
- // Make a copy to make sure original doesn't get altered by the function itself
16
+ // Make a copy to make sure original doesn't get altered by the function itself.
17
17
const backup = structuredClone ( original ) ;
18
18
19
- // Wrapper for convenience
19
+ // Wrapper for convenience:
20
20
const obj = ( ) => mustNotMutateObjectDeep ( original ) ;
21
21
22
22
function testOriginal ( root ) {
@@ -185,11 +185,11 @@ function setPrototypeOfQuux(root) {
185
185
{ code : 'ERR_ASSERTION' }
186
186
) ;
187
187
188
- // Test that no mutation happened
188
+ // Test that no mutation happened:
189
189
assert . ok ( testOriginal ( obj ( ) ) ) ;
190
190
}
191
191
192
- // Test various supported types, directly and nested
192
+ // Test various supported types, directly and nested:
193
193
[
194
194
undefined , null , false , true , 42 , 42n , Symbol ( '42' ) , NaN , Infinity , { } , [ ] ,
195
195
( ) => { } , async ( ) => { } , Promise . resolve ( ) , Math , Object . create ( null ) ,
@@ -199,27 +199,27 @@ function setPrototypeOfQuux(root) {
199
199
assert . deepStrictEqual ( mustNotMutateObjectDeep ( [ target ] ) , [ target ] ) ;
200
200
} ) ;
201
201
202
- // Test that passed functions keep working correctly
202
+ // Test that passed functions keep working correctly:
203
203
{
204
204
const fn = ( ) => 'blep' ;
205
205
fn . foo = { } ;
206
206
const fnImmutableView = mustNotMutateObjectDeep ( fn ) ;
207
207
assert . deepStrictEqual ( fnImmutableView , fn ) ;
208
208
209
- // The function works
209
+ // Test that the function still works:
210
210
assert . strictEqual ( fn ( ) , 'blep' ) ;
211
211
assert . strictEqual ( fnImmutableView ( ) , 'blep' ) ;
212
212
213
- // The original function is not deeply frozen
213
+ // The original function is not deeply frozen:
214
214
fn . foo . bar = 'baz' ;
215
215
assert . strictEqual ( fn . foo . bar , 'baz' ) ;
216
216
assert . strictEqual ( fnImmutableView . foo . bar , 'baz' ) ;
217
217
218
- // The original function is not frozen
218
+ // The original function is not frozen:
219
219
fn . qux = 'quux' ;
220
220
assert . strictEqual ( fn . qux , 'quux' ) ;
221
221
assert . strictEqual ( fnImmutableView . qux , 'quux' ) ;
222
222
223
- // Redefining util.promisify.custom also works
223
+ // Redefining util.promisify.custom also works:
224
224
await promisify ( promisify ( fn ) ) ( ) ;
225
225
}
0 commit comments