Skip to content

Commit

Permalink
Merge pull request #40 from takanotume24/fix/#36_support_vs
Browse files Browse the repository at this point in the history
add support for "vs. "
  • Loading branch information
takanotume24 authored Jan 30, 2024
2 parents 051265d + 914d441 commit 9617499
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/format_and_split_text_Into_columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function formatAndSplitTextIntoColumns(
[RegExp(`Sec${dummy}`, "g"), "Sec. "], // Formats abbreviation for "Section"
[RegExp(`Sect${dummy}`, "g"), "Sect. "], // Formats abbreviation for "Section"
[RegExp(`Section${dummy}`, "g"), "Section. "], // Formats abbreviation for "Section"
[RegExp(`vs${dummy}`, "g"), "vs. "], // Formats abbreviation for "vs."
[RegExp(`2\.4 GHz`, "g"), "2.4GHz"], // Formats specific frequency value
[RegExp(`I${dummy}`, "g"), "I. "],
[RegExp(`II${dummy}`, "g"), "II. "],
Expand Down
10 changes: 10 additions & 0 deletions src/lib/test/format_and_split_text_into_columns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ describe('formatAndSplitTextIntoColumns', () => {
expect(result).toEqual(expectedResult);
});

it('should process and split text correctly [vs. ]', () => {
const testString = "In the heated debate of cats vs. dogs, each side presents compelling arguments for their favorite pet. The classic battle of wits vs. strength is often portrayed in heroic tales, where cunning often triumphs over brute force.";
const charLimit = 10;
const expectedResult = [
['In the heated debate of cats vs. dogs, each side presents compelling arguments for their favorite pet.'],
['The classic battle of wits vs. strength is often portrayed in heroic tales, where cunning often triumphs over brute force.']
];
const result = formatAndSplitTextIntoColumns(testString, charLimit);
expect(result).toEqual(expectedResult);
});

// Test for hyphen followed by newline
it('should remove hyphen followed by newline', () => {
Expand Down

0 comments on commit 9617499

Please sign in to comment.