|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
531 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @fileoverview Shared utilities for error messages.
|
|---|
| 3 | * @author Josh Goldberg
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | /**
|
|---|
| 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.
|
|---|
| 13 | */
|
|---|
| 14 | function stringifyValueForError(value, indentation) {
|
|---|
| 15 | return value ? JSON.stringify(value, null, 4).replace(/\n/gu, `\n${" ".repeat(indentation)}`) : `${value}`;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | module.exports = { stringifyValueForError };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.