UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

25 lines (23 loc) 743 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function isBlankLineAtPos(sourceFile, pos) { const fullText = sourceFile.getFullText(); let foundBlankLine = false; for (let i = pos; i < fullText.length; i++) { const char = fullText[i]; if (char === " " || char === "\t") continue; if (char === "\r" && fullText[i + 1] === "\n" || char === "\n") { if (foundBlankLine) return true; foundBlankLine = true; if (char === "\r") i++; continue; } return false; } return false; } exports.isBlankLineAtPos = isBlankLineAtPos; //# sourceMappingURL=isBlankLineAtPos.js.map