@c-time/frelio-data-json-generator 3.8.0 → 3.9.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.
- package/dist/cli.js +15 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/preview/index.js +15 -1
- package/dist/preview/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -463,7 +463,8 @@ function formatValue(value, type, options2 = {}) {
|
|
|
463
463
|
case "last":
|
|
464
464
|
return Array.isArray(value) ? value[value.length - 1] : value;
|
|
465
465
|
case "join":
|
|
466
|
-
|
|
466
|
+
if (!Array.isArray(value)) return String(value);
|
|
467
|
+
return (options2.key ? pluckValues(value, options2.key) : value).join(options2.separator ?? ", ");
|
|
467
468
|
case "url":
|
|
468
469
|
return encodeURIComponent(String(value));
|
|
469
470
|
case "picture":
|
|
@@ -475,6 +476,18 @@ function formatValue(value, type, options2 = {}) {
|
|
|
475
476
|
return value;
|
|
476
477
|
}
|
|
477
478
|
}
|
|
479
|
+
function pluckValues(items, key) {
|
|
480
|
+
const parts = key.split(".");
|
|
481
|
+
const result = [];
|
|
482
|
+
for (const item of items) {
|
|
483
|
+
let v = item;
|
|
484
|
+
for (const part of parts) {
|
|
485
|
+
v = v !== null && typeof v === "object" ? v[part] : void 0;
|
|
486
|
+
}
|
|
487
|
+
if (v !== void 0 && v !== null && v !== "") result.push(v);
|
|
488
|
+
}
|
|
489
|
+
return result;
|
|
490
|
+
}
|
|
478
491
|
function parseOffsetMinutes(timezone) {
|
|
479
492
|
if (timezone === "Z") return 0;
|
|
480
493
|
const m = /^([+-])(\d{2}):(\d{2})$/.exec(timezone);
|
|
@@ -755,6 +768,7 @@ function applyTransformField(field, content, currentData, defaultTimezone) {
|
|
|
755
768
|
length: field.length,
|
|
756
769
|
suffix: field.suffix,
|
|
757
770
|
separator: field.separator,
|
|
771
|
+
key: field.key,
|
|
758
772
|
defaultValue: field.defaultValue
|
|
759
773
|
});
|
|
760
774
|
}
|