Innovenergy_trunk/frontend/node_modules/testcafe/lib/utils/diff/util.js

24 lines
3.0 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringify = exports.cleanUpFilter = void 0;
const util_1 = require("util");
const lodash_1 = require("lodash");
function cleanUpFilter(line) {
return !line.match(/\\ No newline/);
}
exports.cleanUpFilter = cleanUpFilter;
function stringify(value) {
if ((0, lodash_1.isString)(value) && value !== '')
return value;
if ((0, lodash_1.isFunction)(value))
return value.toString();
let valueToStringify = value;
if ((0, lodash_1.isBuffer)(value))
valueToStringify = Buffer.prototype.toJSON.call(value).data;
return (0, util_1.inspect)(valueToStringify, { compact: false, sorted: true, depth: null })
.split('\n')
.map(line => line.replace(/,\s*$/, ''))
.join('\n') || valueToStringify.toString;
}
exports.stringify = stringify;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy91dGlscy9kaWZmL3V0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQStCO0FBQy9CLG1DQUlnQjtBQUVoQixTQUFnQixhQUFhLENBQUUsSUFBWTtJQUN2QyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUN4QyxDQUFDO0FBRkQsc0NBRUM7QUFFRCxTQUFnQixTQUFTLENBQUUsS0FBVTtJQUNqQyxJQUFJLElBQUEsaUJBQVEsRUFBQyxLQUFLLENBQUMsSUFBSSxLQUFLLEtBQUssRUFBRTtRQUMvQixPQUFPLEtBQUssQ0FBQztJQUVqQixJQUFJLElBQUEsbUJBQVUsRUFBQyxLQUFLLENBQUM7UUFDakIsT0FBTyxLQUFLLENBQUMsUUFBUSxFQUFFLENBQUM7SUFFNUIsSUFBSSxnQkFBZ0IsR0FBRyxLQUFLLENBQUM7SUFFN0IsSU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