ahp-calc
Version:
AHP (Analytical Hierarchy Process) is a decision-making method that helps break down complex problems into a hierarchy of simpler comparisons. It uses pairwise comparisons and mathematical calculations to rank alternatives based on criteria.
17 lines (16 loc) • 552 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertCell = convertCell;
/**
* Mengubah nilai sel string (misalnya "1/3") menjadi number.
* @param cell Nilai string yang merepresentasikan rasio
* @returns Nilai numerik
*/
function convertCell(cell) {
const roundTo3Decimals = (num) => Math.round(num * 1000) / 1000;
if (cell.includes("/")) {
const [num, denom] = cell.split("/").map(Number);
return roundTo3Decimals(num / denom);
}
return roundTo3Decimals(parseFloat(cell));
}