Skip to content

Commit

Permalink
🎨 Move a check to the end
Browse files Browse the repository at this point in the history
  • Loading branch information
steelbrain committed Jul 18, 2016
1 parent c5dd5ca commit bb4e857
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ export function rangeFromLineNumber(textEditor: TextEditor, line: ?number, colum
const lineText = buffer.lineForRow(lineNumber)
let colEnd = lineText.length
let colStart = columnGiven ? column : 0
if (columnGiven && column > lineText.length) {
throw new Error(`Column start (${column}) greater than line length (${lineText.length})`)
}
if (columnGiven) {
const match = Helpers.getWordRegexp(textEditor, [lineNumber, colStart]).exec(lineText.substr(column))
if (match) {
Expand All @@ -45,6 +42,9 @@ export function rangeFromLineNumber(textEditor: TextEditor, line: ?number, colum
colStart = indentation[0].length
}
}
if (colStart > lineText.length) {
throw new Error(`Column start (${colStart}) greater than line length (${lineText.length})`)
}

return [
[lineNumber, colStart],
Expand Down

0 comments on commit bb4e857

Please sign in to comment.