Skip to content

Commit

Permalink
refactor: Use object destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
serg3295 committed Dec 22, 2023
1 parent 28aecde commit 81840e8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ type FinderFunc = (currentPosition: Position, lineContent: string, document: Tex
export function activate(context: ExtensionContext): void {
const targets = ["(", ")", "{", "}", "[", "]", '"', "'"]

const findBracketForward = (currentPosition: Position, lineContent: string, document: TextDocument): Position => {
const { line, character } = currentPosition
let lineNumber = currentPosition.line
let charNumber = currentPosition.character
const findBracketForward = ({ line, character }: Position, lineContent: string, document: TextDocument): Position => {
let lineNumber = line
let charNumber = character

while (lineNumber < document.lineCount) {
while (charNumber < lineContent.length) {
Expand All @@ -31,10 +30,9 @@ export function activate(context: ExtensionContext): void {
return new Position(line, character)
}

const findBracketBackwards = (currentPosition: Position, lineContent: string, document: TextDocument): Position => {
const { line, character } = currentPosition
let lineNumber = currentPosition.line
let charNumber = currentPosition.character
const findBracketBackwards = ({ line, character }: Position, lineContent: string, document: TextDocument): Position => {
let lineNumber = line
let charNumber = character

while (lineNumber > -1) {
while (--charNumber >= 0) {
Expand Down

0 comments on commit 81840e8

Please sign in to comment.