UNPKG

@wordpress/block-library

Version:
23 lines (22 loc) 700 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeRowColSpan = normalizeRowColSpan; /** * Normalize the rowspan/colspan value. * Returns undefined if the parameter is not a positive number * or the default value (1) for rowspan/colspan. * * @param {number|undefined} rowColSpan rowspan/colspan value. * * @return {string|undefined} normalized rowspan/colspan value. */ function normalizeRowColSpan(rowColSpan) { const parsedValue = parseInt(rowColSpan, 10); if (!Number.isInteger(parsedValue)) { return undefined; } return parsedValue < 0 || parsedValue === 1 ? undefined : parsedValue.toString(); } //# sourceMappingURL=utils.js.map