UNPKG

@gleif-it/did-webs-ts

Version:
14 lines (13 loc) 764 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calculateThreshold = void 0; const R = require("remeda"); const findLowestCommonMultiple_js_1 = require("../math/findLowestCommonMultiple.js"); const divideByTwo_js_1 = require("../math/divideByTwo.js"); const extractDenominator_js_1 = require("../math/extractDenominator.js"); // currently being tested in the generateDocument function // calculate the threshold for the conditional proof const calculateThreshold = (kt) => Array.isArray(kt) ? R.pipe(kt, R.map(extractDenominator_js_1.extractDenominator), R.reduce(findLowestCommonMultiple_js_1.findLowestCommonMultiple, 1), divideByTwo_js_1.divideByTwo) : parseInt(kt); exports.calculateThreshold = calculateThreshold;