mirror of https://github.com/sveltejs/svelte
parent
595e6a773e
commit
7af638d971
@ -1,6 +1,22 @@
|
|||||||
export const regex_whitespace = /[ \t\r\n]/;
|
export const regex_whitespace = /\s/;
|
||||||
export const regex_start_whitespace = /^[ \t\r\n]*/;
|
export const regex_whitespaces = /\s+/;
|
||||||
export const regex_end_whitespace = /[ \t\r\n]*$/;
|
export const regex_starts_with_whitespace = /^\s/;
|
||||||
export const regex_start_newline = /^\r?\n/;
|
export const regex_ends_with_whitespace = /\s$/;
|
||||||
|
export const regex_only_whitespaces = /^\s+$/;
|
||||||
|
|
||||||
|
export const regex_whitespace_characters = /\s/g;
|
||||||
|
export const regex_non_whitespace_character = /\S/;
|
||||||
|
|
||||||
|
export const regex_starts_with_newline = /^\r?\n/;
|
||||||
|
export const regex_not_newline_characters = /[^\n]/g;
|
||||||
|
|
||||||
|
export const regex_double_quotes = /"/g;
|
||||||
|
|
||||||
|
export const regex_backslashes = /\\/g;
|
||||||
|
|
||||||
|
export const regex_starts_with_underscore = /^_/;
|
||||||
|
export const regex_ends_with_underscore = /_$/;
|
||||||
|
|
||||||
|
export const regex_invalid_variable_identifier_characters = /[^a-zA-Z0-9_$]/g;
|
||||||
|
|
||||||
export const regex_dimensions = /^(?:offset|client)(?:Width|Height)$/;
|
export const regex_dimensions = /^(?:offset|client)(?:Width|Height)$/;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { regex_start_whitespace, regex_end_whitespace } from './patterns';
|
import { regex_starts_with_whitespace, regex_ends_with_whitespace } from './patterns';
|
||||||
|
|
||||||
export function trim_start(str: string) {
|
export function trim_start(str: string) {
|
||||||
return str.replace(regex_start_whitespace, '');
|
return str.replace(regex_starts_with_whitespace, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function trim_end(str: string) {
|
export function trim_end(str: string) {
|
||||||
return str.replace(regex_end_whitespace, '');
|
return str.replace(regex_ends_with_whitespace, '');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in new issue