Skip to content

Commit

Permalink
Merge branch 'dev' into feat/PRT-1830
Browse files Browse the repository at this point in the history
  • Loading branch information
dsouza95 committed Jan 17, 2024
2 parents b1295e0 + ca24a22 commit d65ae8a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/editor/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ export class IaraEditorInferenceFormatter {
}

public _capitalize(text: string, wordBefore: string): string {
text = text.trimStart();
wordBefore = wordBefore.trimEnd();

const capitalize = !wordBefore.length || /[.:;?!]$/.test(wordBefore);
var capitalized_text = `${text.charAt(0).toLocaleUpperCase()}${text.slice(1)}`;

return capitalize
? `${text.charAt(0).toLocaleUpperCase()}${text.slice(1)}`
: text;
? wordBefore.length == 0 ? capitalized_text : ' ' + capitalized_text
: wordBefore.length == 0 ? text : ' ' + text;
}

protected _estimateVolume(text: string, regex: string): string {
Expand Down

0 comments on commit d65ae8a

Please sign in to comment.