sokko-g/website/src/features/toolboxes/modules/textImport.js
Shinuwa 895fec2b40
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s
structure refacto & file documentation
2026-07-25 17:51:53 +02:00

16 lines
534 B
JavaScript

// Rôle : parse les imports texte en listes exploitables par les outils.
export function parseColonImportLines(text) {
return String(text || "")
.split(/\r?\n/)
.map((line) => line.trim())
.filter(Boolean)
.map((line) => {
const separatorIndex = line.indexOf(":");
if (separatorIndex === -1) return { label: line, value: "" };
return {
label: line.slice(0, separatorIndex).trim(),
value: line.slice(separatorIndex + 1).trim()
};
})
.filter((entry) => entry.label);
}