e2ed
Version:
E2E testing framework over Playwright
18 lines (17 loc) • 846 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFunctionPresentationForLogs = void 0;
const valueToString_1 = require("../valueToString");
const getFunctionCode_1 = require("./getFunctionCode");
/**
* Get custom function string presentation for logs.
*/
const getFunctionPresentationForLogs = (fn) => {
const { length, name } = fn;
const code = (0, getFunctionCode_1.getFunctionCode)(fn);
const withName = name ? `: ${name}` : '';
const printedValue = { code: (0, valueToString_1.wrapStringForLogs)(code), length, name: name || 'anonymous' };
const printedString = (0, valueToString_1.valueToString)(printedValue);
return (0, valueToString_1.wrapStringForLogs)(`[Function${withName}] ${printedString}`);
};
exports.getFunctionPresentationForLogs = getFunctionPresentationForLogs;