File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,14 @@ export function uneval(value) {
30
30
throw new DevalueError ( `Cannot stringify a function` , keys ) ;
31
31
}
32
32
33
- if ( counts . has ( thing ) ) {
34
- counts . set ( thing , counts . get ( thing ) + 1 ) ;
35
- return ;
36
- }
33
+ if ( ! is_primitive ( thing ) ) {
34
+ if ( counts . has ( thing ) ) {
35
+ counts . set ( thing , counts . get ( thing ) + 1 ) ;
36
+ return ;
37
+ }
37
38
38
- counts . set ( thing , 1 ) ;
39
+ counts . set ( thing , 1 ) ;
39
40
40
- if ( ! is_primitive ( thing ) ) {
41
41
const type = get_type ( thing ) ;
42
42
43
43
switch ( type ) {
Original file line number Diff line number Diff line change @@ -299,9 +299,25 @@ const fixtures = {
299
299
{
300
300
name : 'String (repetition)' ,
301
301
value : [ 'a string' , 'a string' ] ,
302
- js : '(function(a){return [a,a]}( "a string")) ' ,
302
+ js : '["a string", "a string"] ' ,
303
303
json : '[[1,1],"a string"]'
304
- }
304
+ } ,
305
+
306
+ {
307
+ name : 'null (repetition)' ,
308
+ value : [ null , null ] ,
309
+ js : '[null,null]' ,
310
+ json : '[[1,1],null]'
311
+ } ,
312
+
313
+ ( ( object ) => {
314
+ return {
315
+ name : 'Object (repetition)' ,
316
+ value : [ object , object ] ,
317
+ js : '(function(a){return [a,a]}({}))' ,
318
+ json : '[[1,1],{}]'
319
+ } ;
320
+ } ) ( { } )
305
321
] ,
306
322
307
323
XSS : [
You can’t perform that action at this time.
0 commit comments