asn1-ts
Version:
ASN.1 encoding and decoding, including BER, CER, and DER.
14 lines (13 loc) • 374 B
JavaScript
export default function compareSetOfElementsCanonically(a, b) {
const longestLength = (a.value.length > b.value.length)
? a.value.length
: b.value.length;
for (let i = 0; i < longestLength; i++) {
const x = a.value[i] ?? 0;
const y = b.value[i] ?? 0;
if (x !== y) {
return (x - y);
}
}
return 0;
}