Update merge script to remove duplicates
All checks were successful
Generate Release / validate_and_release (push) Successful in 12s
All checks were successful
Generate Release / validate_and_release (push) Successful in 12s
This commit is contained in:
parent
970894c5d3
commit
6873cb2c44
@ -31,12 +31,14 @@ function sortAndMergeYAMLFiles() {
|
||||
return codeA - codeB
|
||||
})
|
||||
|
||||
const mergedYaml = yaml.stringify(mergedData);
|
||||
|
||||
|
||||
// Construct the output string
|
||||
// Construct the output string, removing duplicates
|
||||
let outputString = "pis:\n";
|
||||
const seenCodes = new Set();
|
||||
mergedData.forEach(item => {
|
||||
if (item.stops.length > 0) {
|
||||
if (!seenCodes.has(item.code) && item.stops.length > 0) {
|
||||
seenCodes.add(item.code);
|
||||
outputString += ` - code: "${item.code}"\n`;
|
||||
outputString += ` stops: [${item.stops.map(stop => `${stop}`).join(',')}]\n`;
|
||||
outputString += ` toc: "${item.toc || "gw"}"\n`;
|
||||
|
Loading…
Reference in New Issue
Block a user