Skip to content

Commit 321cd62

Browse files
committed
Update trim_characters.ts
1 parent 3cc1a46 commit 321cd62

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/format/trim_characters.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
import trimCharactersEnd from "./trim_characters_end.ts";
2+
import trimCharactersStart from "./trim_characters_start.ts";
3+
4+
/**
5+
* This function is similar to the standard `String.prototype.trim()` function. With this function, several characters
6+
* can be specified as a string which are then trimmed at the start and end of the `inputString`.
7+
*
8+
* @param inputString The input string to trim the start and end
9+
* @param characters The characters to trim
10+
* @returns The trimmed input string
11+
*/
112
export default function trimCharacters(
213
inputString : string,
314
characters : string
415
) : string {
5-
const charactersArray = characters.split('');
6-
16+
return trimCharactersStart(trimCharactersEnd(inputString, characters), characters)
717
}

0 commit comments

Comments
 (0)