-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): fix suggestions when quoting a suggestion with no spaces
- Loading branch information
1 parent
6f1e040
commit 24dc2ab
Showing
4 changed files
with
53 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const START_QUOTE_PATTERN = `^(['"])`; | ||
const END_QUOTE_PATTERN = `(['"])%s*$`; | ||
|
||
export function containsSpace(text: string) { | ||
return !text.match("%s").isEmpty(); | ||
} | ||
|
||
export function stripQuotes(text: string) { | ||
return text.gsub(START_QUOTE_PATTERN, "")[0].gsub(END_QUOTE_PATTERN, "")[0]; | ||
} | ||
|
||
export function getQuoteChar(text: string) { | ||
return text.match(START_QUOTE_PATTERN)[0] as string; | ||
} | ||
|
||
export function isQuoteStarted(text: string) { | ||
return text.match(START_QUOTE_PATTERN)[0] !== undefined; | ||
} | ||
|
||
export function isQuoteEnded(text: string) { | ||
return text.match(END_QUOTE_PATTERN)[0] !== undefined; | ||
} |