mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-15 10:40:33 +08:00
Perf: limit split when parsing hosts
This commit is contained in:
parent
be063f09a7
commit
b1912c89ac
@ -3,8 +3,10 @@ import { fetchAssets } from '../fetch-assets';
|
|||||||
import { fastNormalizeDomainWithoutWww } from '../normalize-domain';
|
import { fastNormalizeDomainWithoutWww } from '../normalize-domain';
|
||||||
import { onBlackFound } from './shared';
|
import { onBlackFound } from './shared';
|
||||||
|
|
||||||
|
const rSpace = /\s+/;
|
||||||
|
|
||||||
function hostsLineCb(line: string, set: string[], includeAllSubDomain: boolean, meta: string) {
|
function hostsLineCb(line: string, set: string[], includeAllSubDomain: boolean, meta: string) {
|
||||||
const _domain = line.split(/\s/)[1]?.trim();
|
const _domain = line.split(rSpace, 3)[1]?.trim();
|
||||||
if (!_domain) {
|
if (!_domain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user