Skip to content

Commit 4605669

Browse files
committed
feat(api): improved parsing of LISTE_COMPETENCES from rncp referential
1 parent 2b70080 commit 4605669

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/reva-api/modules/referential/rncp/referential.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,19 @@ function splitString(value: string): string[] {
226226
}
227227

228228
// Jump line + UpperFirst regEx
229-
const regExDefault = new RegExp(/(?=\n[A-ZÀ-Ö])/g);
230-
if (cleanedValue.match(regExDefault)) {
229+
const regExJumpline_R = new RegExp(/(?=\r\n\r\n)/g);
230+
if (cleanedValue.match(regExJumpline_R)) {
231231
let list: string[] = [];
232-
list = cleanedValue.split(regExDefault);
232+
list = cleanedValue.split(regExJumpline_R);
233+
list = list.map((v) => v.replace(new RegExp(/^\r\n\r\n/), ""));
234+
return list;
235+
}
236+
237+
// Jump line + UpperFirst regEx
238+
const regExJumpline_N = new RegExp(/(?=\n)/g);
239+
if (cleanedValue.match(regExJumpline_N)) {
240+
let list: string[] = [];
241+
list = cleanedValue.split(regExJumpline_N);
233242
list = list.map((v) => v.replace(new RegExp(/^\n/), ""));
234243
return list;
235244
}

0 commit comments

Comments
 (0)