Skip to content

Commit d07db79

Browse files
authored
Merge pull request #12 from danyill/issue-1-sorting
Ensure supervisions and unused CBs are sorted (closes #1)
2 parents 365edc9 + 27ad6df commit d07db79

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

oscd-supervision.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ function getOtherIedControlElements(
233233
const iedName = getNameAttribute(ied!);
234234
return Array.from(
235235
ied.ownerDocument.querySelectorAll(`LN0 > ${controlTag[controlType]}`)
236-
).filter(cb => getNameAttribute(cb.closest('IED')!) !== iedName);
236+
)
237+
.filter(cb => getNameAttribute(cb.closest('IED')!) !== iedName)
238+
.sort((a, b) => `${identity(a)}`.localeCompare(`${identity(b)}`));
237239
}
238240

239241
/**
@@ -250,7 +252,7 @@ function getSupervisionLNs(
250252

251253
return Array.from(
252254
ied.querySelectorAll(`LN[lnClass="${supervisionLnType[controlType]}"]`)
253-
);
255+
).sort((a, b) => `${identity(a)}`.localeCompare(`${identity(b)}`));
254256
}
255257

256258
/**

0 commit comments

Comments
 (0)