UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

34 lines (33 loc) 1.68 kB
/** * CodeAnalizerComment: Updated 1 imports on 2024-09-21 23:07:24 * Update:: import { getNumberArrayFromString } to '@mikezimm/fps-core-v7/lib/logic/Strings/arraysFromString;' */ import { getNumberArrayFromString } from '@mikezimm/fps-core-v7/lib/logic/Strings/arraysFromString'; //=>> address: https://github.com/mikezimm/drilldown7/issues/271 /** * This can be removed once the num version is validated */ export function getMaxRichHeight(autoRichHeight, richHeight, items) { const autoHeight = getNumberArrayFromString(autoRichHeight, ';', true, false, 'asis'); let maxQty = autoHeight.length >= 2 && autoHeight[0] > 0 ? autoHeight[0] : 3; let newRichHeight = `${richHeight}`; //Just added 0 so it does not mutate const richHeightNum = parseFloat(richHeight); if (items.length <= maxQty) { let maxHeight = autoHeight.length >= 2 && autoHeight[1] > 0 ? autoHeight[1] : 2.2; if (!richHeightNum || maxHeight > richHeightNum) newRichHeight = `${maxHeight}em`; } return newRichHeight; } export function getMaxRichHeightNum(autoRichHeight, richHeight, items) { const autoHeight = getNumberArrayFromString(autoRichHeight, ';', true, false, 'asis'); const maxQty = autoHeight.length >= 2 && autoHeight[0] > 0 ? autoHeight[0] : 3; let richHeightNum = richHeight ? richHeight + 0 : 0; if (items.length <= maxQty) { let maxHeight = autoHeight.length >= 2 && autoHeight[1] > 0 ? autoHeight[1] : 2.2; if (!richHeight || maxHeight > richHeight) richHeightNum = maxHeight; } return richHeightNum; } //# sourceMappingURL=richHeight.js.map