You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/compiler/parse/utils/trim.js

16 lines
303 B

import { whitespace } from '../patterns.js';
export function trimStart ( str ) {
let i = 0;
while ( whitespace.test( str[i] ) ) i += 1;
return str.slice( i );
}
export function trimEnd ( str ) {
let i = str.length;
while ( whitespace.test( str[ i - 1 ] ) ) i -= 1;
return str.slice( 0, i );
}