Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
}
const sortedDataSet = dataSet.slice().sort((a, b) => a - b);
const middleIndex = Math.floor(sortedDataSet.length / 2);
- if (sortedDataSet.length % 2) {
+ if (sortedDataSet.length % 2 === 0) {
return sortedDataSet[middleIndex / 2];
}
return (sortedDataSet[middleIndex - 1] + sortedDataSet[middleIndex]) / 2;
return this.length === this.size;
}
- private checkSize(size: number) {
+ private checkSize(size: number): void {
if (!Number.isSafeInteger(size)) {
throw new TypeError(`Invalid circular array size: ${size} is not a safe integer`);
}