spread-array-decompile.js (327B)
1 var samples = [ 2 "[...a]", 3 "[...[1]]", 4 "[1, ...a, 2]", 5 "[1, ...[2, 3], 4]", 6 "[...[1], , ]", 7 "[1, , ...[2]]", 8 "[, 1, ...[2], ...[3], , 4, 5, , ]" 9 ]; 10 for (var sample of samples) { 11 var source = "function f() {\n return " + sample + ";\n}"; 12 eval(source); 13 assertEq(f.toString(), source); 14 }