@nsnanocat/util 2.6.9 → 2.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,6 @@ import { $app } from "./app.mjs";
42
42
  */
43
43
  export function notification(title = `ℹ️ ${$app} 通知`, subtitle = "", body = "", content = {}) {
44
44
  const mutableContent = MutableContent(content);
45
- const bodyLines = body.split(/\r?\n/u);
46
45
  switch ($app) {
47
46
  case "Surge":
48
47
  case "Loon":
@@ -60,7 +59,7 @@ export function notification(title = `ℹ️ ${$app} 通知`, subtitle = "", bod
60
59
  break;
61
60
  }
62
61
  Console.group("📣 系统通知");
63
- Console.log(title, subtitle, bodyLines, JSON.stringify(mutableContent, null, 2));
62
+ Console.log(title, subtitle, body, JSON.stringify(mutableContent, null, 2));
64
63
  Console.groupEnd();
65
64
  }
66
65
 
package/package.json CHANGED
@@ -63,5 +63,5 @@
63
63
  "registry": "https://registry.npmjs.org/",
64
64
  "access": "public"
65
65
  },
66
- "version": "2.6.9"
66
+ "version": "2.6.10"
67
67
  }
@@ -94,8 +94,8 @@ export class Console {
94
94
  *
95
95
  * 说明:
96
96
  * Notes:
97
- * - 顶层数组参数会按多个独立日志项展开。
98
- * - Top-level array arguments are expanded into multiple log entries.
97
+ * - 多行字符串参数会按换行拆分为多个独立日志项。
98
+ * - Multi-line string arguments are split into multiple log entries by line breaks.
99
99
  *
100
100
  * @param msg 日志内容 / Log payloads.
101
101
  */
@@ -226,31 +226,28 @@ export class Console {
226
226
  *
227
227
  * 说明:
228
228
  * Notes:
229
- * - 顶层数组参数会按多个独立日志项展开。
230
- * - Top-level array arguments are expanded into multiple log entries.
229
+ * - 多行字符串参数会按换行拆分为多个独立日志项。
230
+ * - Multi-line string arguments are split into multiple log entries by line breaks.
231
231
  *
232
232
  * @param {...any} msg 日志内容 / Log messages.
233
233
  * @returns {void}
234
234
  */
235
235
  static log = (...msg) => {
236
236
  if (Console.#level === 0) return;
237
- msg = msg.flatMap(log => (Array.isArray(log) ? log : [log]));
238
- msg = msg.map(log => {
237
+ msg = msg.flatMap(log => {
239
238
  switch (typeof log) {
240
239
  case "object":
241
- log = JSON.stringify(log);
242
- break;
240
+ return [JSON.stringify(log)];
243
241
  case "bigint":
244
242
  case "number":
245
243
  case "boolean":
244
+ return [log.toString()];
246
245
  case "string":
247
- log = log.toString();
248
- break;
246
+ return log.split(/\r?\n/u);
249
247
  case "undefined":
250
248
  default:
251
- break;
249
+ return [log];
252
250
  }
253
- return log;
254
251
  });
255
252
  Console.#groups.forEach(group => {
256
253
  msg = msg.map(log => ` ${log}`);