Skip to content

Commit c4e08d6

Browse files
committed
Compare array index to -1 instead of >= 0 to determine element presence
See #1637 (comment)
1 parent d75906d commit c4e08d6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/doc-printer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ function printDocToString(doc, options) {
418418
}
419419

420420
const cursorPlaceholderIndex = out.indexOf(cursor.placeholder);
421-
if (cursorPlaceholderIndex >= 0) {
421+
if (cursorPlaceholderIndex !== -1) {
422422
const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
423423
options.cursorOffsetResult = beforeCursor.length;
424424
const afterCursor = out.slice(cursorPlaceholderIndex + 1).join("");

0 commit comments

Comments
 (0)