Skip to content

Commit

Permalink
fix trim
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanhofer committed Sep 15, 2022
1 parent 1cf1a54 commit f36fc67
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 f36fc67

Please sign in to comment.