@schukai/monster 3.107.0 → 3.108.0

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.
@@ -17,7 +17,7 @@ import { validateString } from "../types/validate.mjs";
17
17
  import { clone } from "../util/clone.mjs";
18
18
  import { DELIMITER, Pathfinder, WILDCARD } from "./pathfinder.mjs";
19
19
 
20
- export { buildMap, PARENT, assembleParts};
20
+ export { buildMap, PARENT, assembleParts };
21
21
 
22
22
  /**
23
23
  * @type {string}
@@ -19,7 +19,7 @@ import { Server } from "../server.mjs";
19
19
  import { WriteError } from "./restapi/writeerror.mjs";
20
20
  import { DataFetchError } from "./restapi/data-fetch-error.mjs";
21
21
  import { clone } from "../../../util/clone.mjs";
22
- import {getInternalLocalizationMessage} from "../../../i18n/internal.mjs";
22
+ import { getInternalLocalizationMessage } from "../../../i18n/internal.mjs";
23
23
 
24
24
  export { RestAPI };
25
25
 
@@ -226,7 +226,7 @@ function fetchData(init, key, callback) {
226
226
  if (acceptedStatus.indexOf(resp.status) === -1) {
227
227
  throw new DataFetchError(
228
228
  getInternalLocalizationMessage(
229
- `i18n{the-response-does-not-contain-an-accepted-status::status=${resp.status}}`
229
+ `i18n{the-response-does-not-contain-an-accepted-status::status=${resp.status}}`,
230
230
  ),
231
231
  response,
232
232
  );
@@ -248,7 +248,7 @@ function fetchData(init, key, callback) {
248
248
 
249
249
  throw new DataFetchError(
250
250
  getInternalLocalizationMessage(
251
- `i18n{the-response-does-not-contain-a-valid-json::actual=${body}}`
251
+ `i18n{the-response-does-not-contain-a-valid-json::actual=${body}}`,
252
252
  ),
253
253
  response,
254
254
  );
@@ -23,6 +23,7 @@ import {
23
23
  } from "../i18n/translations.mjs";
24
24
  import {
25
25
  validateFunction,
26
+ validateArray,
26
27
  validateInteger,
27
28
  validateObject,
28
29
  validatePrimitive,
@@ -286,6 +287,30 @@ function transform(value) {
286
287
  validateInteger(n);
287
288
  return n;
288
289
 
290
+ case "to-array":
291
+ case "toarray":
292
+ if (isArray(value)) {
293
+ return value;
294
+ }
295
+
296
+ if (isObject(value)) {
297
+ return Object.values(value);
298
+ }
299
+
300
+ return [value];
301
+
302
+ case "listtoarray":
303
+ case "list-to-array":
304
+ validateString(value);
305
+ const listDel = args.shift() || ",";
306
+ return value.split(listDel);
307
+
308
+ case "arraytolist":
309
+ case "array-to-list":
310
+ validateArray(value);
311
+ const listDel2 = args.shift() || ",";
312
+ return value.join(listDel2);
313
+
289
314
  case "to-json":
290
315
  case "tojson":
291
316
  return JSON.stringify(value);
@@ -398,7 +423,10 @@ function transform(value) {
398
423
 
399
424
  case "debug":
400
425
  if (isObject(console)) {
401
- console.log(value);
426
+ console.groupCollapsed("Transformer Debug");
427
+ console.log("Value", value);
428
+ console.log("Transformer", this);
429
+ console.groupEnd();
402
430
  }
403
431
 
404
432
  return value;
@@ -581,6 +609,11 @@ function transform(value) {
581
609
  defaultValue === "true" ||
582
610
  defaultValue === "true"
583
611
  );
612
+ case "array":
613
+ if (defaultValue === "") {
614
+ return [];
615
+ }
616
+ return defaultValue.split(",");
584
617
  case "string":
585
618
  return `${defaultValue}`;
586
619
  case "object":