233
234
export function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {
235
>
// Exit early if it's one of these special cases which are meant to match
strings.ts
236
>
// against an empty string
237
>
if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\s*$') {
238
return false;
239
}
241
>
// We check against an empty string. If the regular expression doesn't advance
242
>
// (e.g. ends in an endless loop) it will match an empty string.
243
>
const match = regexp.exec('');
244
>
return !!(match && regexp.lastIndex === 0);
245
>
}
246
247
export function joinStrings(items: (string | undefined | null | false)[], separator: string): string {