You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Readline 'cursorTo' function incorrectly treats 'NaN' as a number #36301
/** * moves the cursor to the x and y coordinate on the given stream */functioncursorTo(stream,x,y,callback){if(callback!==undefined&&typeofcallback!=='function')thrownewERR_INVALID_CALLBACK(callback);if(typeofy==='function'){callback=y;y=undefined;}if(stream==null||(typeofx!=='number'&&typeofy!=='number')){if(typeofcallback==='function')process.nextTick(callback,null);returntrue;}if(typeofx!=='number')thrownewERR_INVALID_CURSOR_POS();constdata=typeofy!=='number' ? CSI`${x+1}G` : CSI`${y+1};${x+1}H`;returnstream.write(data,callback);}
Into:
/** * moves the cursor to the x and y coordinate on the given stream */functioncursorTo(stream,x,y,callback){if(callback!==undefined&&typeofcallback!=='function')thrownewERR_INVALID_CALLBACK(callback);if(typeofy==='function'){callback=y;y=undefined;}if(stream==null||(isNaN(x)&&isNaN(y))){if(typeofcallback==='function')process.nextTick(callback,null);returntrue;}if(isNaN(x))thrownewERR_INVALID_CURSOR_POS();constdata=isNaN(y) ? CSI`${x+1}G` : CSI`${y+1};${x+1}H`;returnstream.write(data,callback);}
changed the title [-]Readline 'cursorTo' function incorrectly treats NaN as number[/-][+]Readline 'cursorTo' function incorrectly treats 'NaN' as a number[/+]on Nov 28, 2020
Activity
[-]Readline 'cursorTo' function incorrectly treats NaN as number[/-][+]Readline 'cursorTo' function incorrectly treats 'NaN' as a number[/+]aduh95 commentedon Nov 28, 2020
Do you want to send a Pull Request?
unitario commentedon Nov 28, 2020
Alright, I'll have a look at it. Weren't able to find the test-files for
cursorTobut managed to do that now.Lxxyx commentedon Nov 29, 2020
@unitario
The test files is: https://github.com/nodejs/node/blob/master/test/parallel/test-readline-csi.js
readline: cursorTo throw error on NaN