mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Chore: new way to attach description
This commit is contained in:
@@ -9,6 +9,7 @@ import { merge as mergeCidr } from 'fast-cidr-tools';
|
||||
import { createRetrieKeywordFilter as createKeywordFilter } from 'foxts/retrie';
|
||||
import path from 'node:path';
|
||||
import { SurgeMitmSgmodule } from '../writing-strategy/surge';
|
||||
import { appendArrayInPlace } from 'foxts/append-array-in-place';
|
||||
|
||||
/**
|
||||
* Holds the universal rule data (domain, ip, url-regex, etc. etc.)
|
||||
@@ -86,6 +87,21 @@ export class FileOutput {
|
||||
return this;
|
||||
}
|
||||
|
||||
appendDescription(description: string | string[], ...rest: string[]) {
|
||||
this.description ??= [];
|
||||
if (typeof description === 'string') {
|
||||
this.description.push(description);
|
||||
} else {
|
||||
appendArrayInPlace(this.description, description);
|
||||
}
|
||||
|
||||
if (rest.length) {
|
||||
appendArrayInPlace(this.description, rest);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected date = new Date();
|
||||
withDate(date: Date) {
|
||||
this.date = date;
|
||||
|
||||
Reference in New Issue
Block a user