]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/messages/shared.js
2 * @fileoverview Shared utilities for error messages.
3 * @author Josh Goldberg
9 * Converts a value to a string that may be printed in errors.
10 * @param {any} value The invalid value.
11 * @param {number} indentation How many spaces to indent
12 * @returns {string} The value, stringified.
14 function stringifyValueForError(value
, indentation
) {
15 return value
? JSON
.stringify(value
, null, 4).replace(/\n/gu, `\n${" ".repeat(indentation)}`) : `${value}`;
18 module
.exports
= { stringifyValueForError
};