odeum-app
Version:
ODEUM Code Web App foundation modules
63 lines (60 loc) • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.spanRowCalc = spanRowCalc;
exports.spanCalc = spanCalc;
exports.rowColCalc = rowColCalc;
function spanRowCalc(grid, gridName) {
var rows = 0;
var grids = grid.split('"');
grids = grids.filter(function (c) {
return c.length > 0;
});
grids.forEach(function (child, i) {
if (child.includes(gridName)) rows = rows + 1;
});
return rows;
}
function spanCalc(grid, gridName, pos) {
var r = 0;
var col = 0;
var grids = grid.split('"');
grids = grids.filter(function (c) {
return c.length > 0;
});
grids.forEach(function (child, row) {
child.split(' ').forEach(function (c, column) {
if (c.includes(gridName)) {
r = r + 1;
col = col + 1;
}
});
});
if (pos === 'column') return col;else return r;
}
function rowColCalc(grid, gridName, pos) {
var r = 0;
var col = 0;
var grids = grid.split('"');
grids = grids.filter(function (c) {
return c.length > 0;
});
grids.forEach(function (child, row) {
child.split(' ').forEach(function (c, column) {
if (c.includes(gridName)) {
r = r === 0 ? row + 1 : r;
col = col === 0 ? column + 1 : col;
}
});
});
if (pos === 'column') return col;else return r;
}
var convertLabelToRoute = exports.convertLabelToRoute = function convertLabelToRoute(label) {
var route = label.replace(/\s+/g, '-').toLowerCase();
route = '/' + route;
return route;
};
var isExact = exports.isExact = function isExact(route) {
if (route === "" || route === "/") return true;else return false;
};