Cannot edit code, runs only template
ManuelRCastroIglesias opened this issue · 4 comments
This is my code.
`
//#Source https://www.30secondsofcode.org/js/s/array-to-csv
//#License https://creativecommons.org/licenses/by/4.0/
const arrTOcvs = ( arr, delimiter = ',' ) =>
arr
.map( v =>
v.map( x => ( isNaN( x ) ? "${ x.replace( /"/g, '""' ) }"
: x ) ).join( delimiter )
)
.join( '\n' );
console.log( arrTOcvs( [ [ 'a', 'b' ], [ 'c', 'd' ] ] ) ); // '"a","b"\n"c","d"'
console.log(arrTOcvs( [ [ 'a', 'b' ], [ 'c', 'd' ] ], ';' ) ); // '"a";"b"\n"c";"d"'
console.log(arrTOcvs( [ [ 'a', '"b" great' ], [ 'c', 3.1415 ] ] ) ); // '"a","""b"" great"\n"c",3.1415'
`
I think the problem is that it won't currently support code written in ES6 (so const
, arrow functions, argument defaults). But it doesn't make that very clear what's going on for sure.
Same problem with code
console.log(1)
setTimeout(() => { console.log(2) })
const prom1 = new Promise(resolve => {
console.log(3)
resolve(4)
})
const prom2 = new Promise(resolve => {
console.log(5)
resolve(6)
})
prom1.then(console.log)
prom2.then(console.log)
console.log(7)
I think the problem is that it won't currently support code written in ES6 (so
const
, arrow functions, argument defaults). But it doesn't make that very clear what's going on for sure.
This is a super useful tool that I'm directing newer devs to - any chance you could get it updated to accommodate modern syntax? It also showed up in a course I took, and it was disappointing to see it not work with ES6 code.