mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 19:46:52 +03:00
feat: implement parseValueList helper
This commit is contained in:
@@ -1 +1,2 @@
|
||||
export * from './getBaseUrl';
|
||||
export * from './parseValueList';
|
||||
|
||||
9
fe-app-podkop/src/helpers/parseValueList.ts
Normal file
9
fe-app-podkop/src/helpers/parseValueList.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function parseValueList(value: string): string[] {
|
||||
return value
|
||||
.split(/\n/) // Split to array by newline separator
|
||||
.map((line) => line.split('//')[0]) // Remove comments
|
||||
.join(' ') // Build clean string
|
||||
.split(/[,\s]+/) // Split to array by comma and space
|
||||
.map((s) => s.trim()) // Remove extra spaces
|
||||
.filter(Boolean); // Leave nonempty items
|
||||
}
|
||||
@@ -233,6 +233,11 @@ function getBaseUrl() {
|
||||
const { protocol, hostname } = window.location;
|
||||
return `${protocol}//${hostname}`;
|
||||
}
|
||||
|
||||
// src/helpers/parseValueList.ts
|
||||
function parseValueList(value) {
|
||||
return value.split(/\n/).map((line) => line.split("//")[0]).join(" ").split(/[,\s]+/).map((s) => s.trim()).filter(Boolean);
|
||||
}
|
||||
return baseclass.extend({
|
||||
ALLOWED_WITH_RUSSIA_INSIDE,
|
||||
BOOTSTRAP_DNS_SERVER_OPTIONS,
|
||||
@@ -253,6 +258,7 @@ return baseclass.extend({
|
||||
UPDATE_INTERVAL_OPTIONS,
|
||||
bulkValidate,
|
||||
getBaseUrl,
|
||||
parseValueList,
|
||||
validateDNS,
|
||||
validateDomain,
|
||||
validateIPV4,
|
||||
|
||||
Reference in New Issue
Block a user