feat: implement parseValueList helper

This commit is contained in:
divocat
2025-10-03 02:01:06 +03:00
parent 260b7b9558
commit 327c3d2b68
3 changed files with 16 additions and 0 deletions

View 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
}