what-to-play
Version:
Score aggregator for lists of games
32 lines • 1.01 kB
JavaScript
;
/**
* The code assumes common spreadsheet syntax.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.toHyperlink = exports.insteadOfEmpty = exports.getCellInCol = exports.count = void 0;
const util_1 = require("./util");
function count(expressions) {
return `COUNT(${expressions.join(", ")})`;
}
exports.count = count;
/**
* @param col 1-indexed
*/
function getCellInCol(col) {
return `INDIRECT(ADDRESS(ROW(), ${col}))`;
}
exports.getCellInCol = getCellInCol;
function insteadOfEmpty(expr, instead) {
return `IF((${expr})="", ${instead}, ${expr})`;
}
exports.insteadOfEmpty = insteadOfEmpty;
function toHyperlink(url, text) {
// escape inputs to fit formula syntax
url = (0, util_1.escapeDoubleQuotes)(url, '""');
if (typeof text === "string") {
text = '"' + (0, util_1.escapeDoubleQuotes)(text, '""') + '"';
}
return `=HYPERLINK("${url}", ${text})`;
}
exports.toHyperlink = toHyperlink;
//# sourceMappingURL=spreadsheet.js.map