@@ -13,10 +13,10 @@ const original = {
1313 ] ,
1414} ;
1515
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.
1717const backup = structuredClone ( original ) ;
1818
19- // Wrapper for convenience
19+ // Wrapper for convenience:
2020const obj = ( ) => mustNotMutateObjectDeep ( original ) ;
2121
2222function testOriginal ( root ) {
@@ -185,11 +185,11 @@ function setPrototypeOfQuux(root) {
185185 { code : 'ERR_ASSERTION' }
186186 ) ;
187187
188- // Test that no mutation happened
188+ // Test that no mutation happened:
189189 assert . ok ( testOriginal ( obj ( ) ) ) ;
190190}
191191
192- // Test various supported types, directly and nested
192+ // Test various supported types, directly and nested:
193193[
194194 undefined , null , false , true , 42 , 42n , Symbol ( '42' ) , NaN , Infinity , { } , [ ] ,
195195 ( ) => { } , async ( ) => { } , Promise . resolve ( ) , Math , Object . create ( null ) ,
@@ -199,27 +199,27 @@ function setPrototypeOfQuux(root) {
199199 assert . deepStrictEqual ( mustNotMutateObjectDeep ( [ target ] ) , [ target ] ) ;
200200} ) ;
201201
202- // Test that passed functions keep working correctly
202+ // Test that passed functions keep working correctly:
203203{
204204 const fn = ( ) => 'blep' ;
205205 fn . foo = { } ;
206206 const fnImmutableView = mustNotMutateObjectDeep ( fn ) ;
207207 assert . deepStrictEqual ( fnImmutableView , fn ) ;
208208
209- // The function works
209+ // Test that the function still works:
210210 assert . strictEqual ( fn ( ) , 'blep' ) ;
211211 assert . strictEqual ( fnImmutableView ( ) , 'blep' ) ;
212212
213- // The original function is not deeply frozen
213+ // The original function is not deeply frozen:
214214 fn . foo . bar = 'baz' ;
215215 assert . strictEqual ( fn . foo . bar , 'baz' ) ;
216216 assert . strictEqual ( fnImmutableView . foo . bar , 'baz' ) ;
217217
218- // The original function is not frozen
218+ // The original function is not frozen:
219219 fn . qux = 'quux' ;
220220 assert . strictEqual ( fn . qux , 'quux' ) ;
221221 assert . strictEqual ( fnImmutableView . qux , 'quux' ) ;
222222
223- // Redefining util.promisify.custom also works
223+ // Redefining util.promisify.custom also works:
224224 await promisify ( promisify ( fn ) ) ( ) ;
225225}
0 commit comments