Files
podkop/fe-app-podkop/src/helpers/parseValueList.ts
2025-10-03 14:12:08 +03:00

10 lines
380 B
TypeScript

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
}