ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
15 lines (14 loc) • 366 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// todo: tests
function getPreviousMatchingPos(text, pos, condition) {
while (pos > 0) {
var char = text[pos - 1];
if (!condition(char))
pos--;
else
break;
}
return pos;
}
exports.getPreviousMatchingPos = getPreviousMatchingPos;