e2ed
Version:
E2E testing framework over Playwright
22 lines (21 loc) • 787 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLinesArrayTrimmedToMaxLength = void 0;
const internal_1 = require("../../constants/internal");
/**
* Get lines array trimmed to max lines count in printed value.
* @internal
*/
const getLinesArrayTrimmedToMaxLength = (lines) => {
if (lines.length <= internal_1.MAX_LINES_COUNT_IN_PRINTED_VALUE) {
return lines;
}
const halfOfLines = Math.floor(internal_1.MAX_LINES_COUNT_IN_PRINTED_VALUE / 2);
const cuttedLinesCount = lines.length - 2 * halfOfLines;
return [
...lines.slice(0, halfOfLines),
`...(${cuttedLinesCount} lines)...`,
...lines.slice(-halfOfLines),
];
};
exports.getLinesArrayTrimmedToMaxLength = getLinesArrayTrimmedToMaxLength;