[gjs: 2/6] pretty print string value with double quotes
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 2/6] pretty print string value with double quotes
- Date: Mon, 25 Jul 2022 03:38:21 +0000 (UTC)
commit 003eb50f3963737c5162f19c111077b746d5f7a1
Author: Nasah <nasahnash19 gmail com>
Date: Sat Jul 16 00:43:35 2022 +0100
pretty print string value with double quotes
modules/script/_bootstrap/default.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/modules/script/_bootstrap/default.js b/modules/script/_bootstrap/default.js
index e5543df3a..d334a741b 100644
--- a/modules/script/_bootstrap/default.js
+++ b/modules/script/_bootstrap/default.js
@@ -14,13 +14,13 @@
} = imports._print;
function log(...args) {
- return nativeLog(args.map(prettyPrint).join(' '));
+ return nativeLog(args.map(arg => typeof arg === 'string' ? arg : prettyPrint(arg)).join(' '));
}
function logError(e, ...args) {
if (args.length === 0)
return nativeLogError(e);
- return nativeLogError(e, args.map(prettyPrint).join(' '));
+ return nativeLogError(e, args.map(arg => typeof arg === 'string' ? arg : prettyPrint(arg)).join('
'));
}
function prettyPrint(value) {
@@ -35,6 +35,8 @@
return value.toString();
}
} else {
+ if (typeof value === 'string')
+ return JSON.stringify(value);
return value.toString();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]