Skip to content

Commit

Permalink
fix trim
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanhofer authored and tanhauhau committed Oct 7, 2022
1 parent d84f315 commit d883e68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/compiler/utils/patterns.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const regex_whitespace = /\s/;
export const regex_whitespaces = /\s+/;
export const regex_starts_with_whitespace = /^\s/;
export const regex_starts_with_whitespaces = /^[ \t\r\n]*/;
export const regex_ends_with_whitespace = /\s$/;
export const regex_ends_with_whitespaces = /[ \t\r\n]*$/;
export const regex_only_whitespaces = /^\s+$/;

export const regex_whitespace_characters = /\s/g;
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/utils/trim.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { regex_starts_with_whitespace, regex_ends_with_whitespace } from './patterns';
import { regex_starts_with_whitespaces, regex_ends_with_whitespaces } from './patterns';

export function trim_start(str: string) {
return str.replace(regex_starts_with_whitespace, '');
return str.replace(regex_starts_with_whitespaces, '');
}

export function trim_end(str: string) {
return str.replace(regex_ends_with_whitespace, '');
return str.replace(regex_ends_with_whitespaces, '');
}

0 comments on commit d883e68

Please sign in to comment.