Skip to content

Commit

Permalink
more-predictable-truncate-behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Dec 17, 2024
1 parent 02477cc commit 4ed3566
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/string.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Deno.test("both sides", () => {
});

Deno.test("truncate", () => {
assertEquals(truncate(3)("Test"), "Tes...");
assertEquals(truncate(3)("Test"), "Tes");
});

Deno.test("testRegExp", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/string.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const truncate = (maxLength: number) => (input: string) =>
input.length > maxLength ? `${input.substring(0, maxLength)}...` : input;
input.length > maxLength ? input.substring(0, maxLength) : input;

export const split = (x: string | RegExp) => (s: string) => s.split(x);

Expand Down

0 comments on commit 4ed3566

Please sign in to comment.