| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0a5969c commit 45dbcbe
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1236,6 +1236,11 @@ function cursorTo(stream, x, y, callback) { | |||
| 1236 | 1236 | y = undefined; | |
| 1237 | 1237 | } | |
| 1238 | 1238 | ||
| 1239 | + if (NumberIsNaN(x)) | ||
| 1240 | + throw new ERR_INVALID_ARG_VALUE('x', x); | ||
| 1241 | + if (NumberIsNaN(y)) | ||
| 1242 | + throw new ERR_INVALID_ARG_VALUE('y', y); | ||
| 1243 | + | ||
| 1239 | 1244 | if (stream == null || (typeof x !== 'number' && typeof y !== 'number')) { | |
| 1240 | 1245 | if (typeof callback === 'function') | |
| 1241 | 1246 | process.nextTick(callback, null); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -161,3 +161,16 @@ assert.strictEqual(writable.data, '\x1b[2G'); | |||
| 161 | 161 | assert.throws(() => { | |
| 162 | 162 | readline.cursorTo(writable, 1, 1, null); | |
| 163 | 163 | }, /ERR_INVALID_CALLBACK/); | |
| 164 | + | ||
| 165 | + // Verify that cursorTo() throws if x or y is NaN. | ||
| 166 | + assert.throws(() => { | ||
| 167 | + readline.cursorTo(writable, NaN); | ||
| 168 | + }, /ERR_INVALID_ARG_VALUE/); | ||
| 169 | + | ||
| 170 | + assert.throws(() => { | ||
| 171 | + readline.cursorTo(writable, 1, NaN); | ||
| 172 | + }, /ERR_INVALID_ARG_VALUE/); | ||
| 173 | + | ||
| 174 | + assert.throws(() => { | ||
| 175 | + readline.cursorTo(writable, NaN, NaN); | ||
| 176 | + }, /ERR_INVALID_ARG_VALUE/); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments