Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
if (Array.isArray(dataSet) && dataSet.length === 1) {
return dataSet[0]
}
- dataSet = dataSet.slice().sort((a, b) => a - b)
- return (dataSet[(dataSet.length - 1) >> 1] + dataSet[dataSet.length >> 1]) / 2
+ const sortedDataSet = dataSet.slice().sort((a, b) => a - b)
+ return (
+ (sortedDataSet[(sortedDataSet.length - 1) >> 1] +
+ sortedDataSet[sortedDataSet.length >> 1]) /
+ 2
+ )
}
export const isPlainObject = (obj: unknown): boolean =>