Projektstart

This commit is contained in:
2026-01-22 15:49:12 +01:00
parent 7212eb6f7a
commit 57e5f652f8
10637 changed files with 2598792 additions and 64 deletions

79
backend/node_modules/mnemonist/utils/comparators.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
/**
* Mnemonist Heap Comparators
* ===========================
*
* Default comparators & functions dealing with comparators reversing etc.
*/
var DEFAULT_COMPARATOR = function(a, b) {
if (a < b)
return -1;
if (a > b)
return 1;
return 0;
};
var DEFAULT_REVERSE_COMPARATOR = function(a, b) {
if (a < b)
return 1;
if (a > b)
return -1;
return 0;
};
/**
* Function used to reverse a comparator.
*/
function reverseComparator(comparator) {
return function(a, b) {
return comparator(b, a);
};
}
/**
* Function returning a tuple comparator.
*/
function createTupleComparator(size) {
if (size === 2) {
return function(a, b) {
if (a[0] < b[0])
return -1;
if (a[0] > b[0])
return 1;
if (a[1] < b[1])
return -1;
if (a[1] > b[1])
return 1;
return 0;
};
}
return function(a, b) {
var i = 0;
while (i < size) {
if (a[i] < b[i])
return -1;
if (a[i] > b[i])
return 1;
i++;
}
return 0;
};
}
/**
* Exporting.
*/
exports.DEFAULT_COMPARATOR = DEFAULT_COMPARATOR;
exports.DEFAULT_REVERSE_COMPARATOR = DEFAULT_REVERSE_COMPARATOR;
exports.reverseComparator = reverseComparator;
exports.createTupleComparator = createTupleComparator;