halfcab 14.0.1 → 14.0.2
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/halfcab.mjs +17 -8
- package/package.json +1 -1
package/halfcab.mjs
CHANGED
|
@@ -85,16 +85,25 @@ function resolveTemplate (value) {
|
|
|
85
85
|
if (Array.isArray(value)) {
|
|
86
86
|
return value.map(resolveTemplate).join('')
|
|
87
87
|
}
|
|
88
|
-
if (value && typeof value === 'object'
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
if (value && typeof value === 'object') {
|
|
89
|
+
if (value.strings) {
|
|
90
|
+
let result = ''
|
|
91
|
+
const { strings, values } = value
|
|
92
|
+
for (let i = 0; i < strings.length; i++) {
|
|
93
|
+
result += strings[i]
|
|
94
|
+
if (i < values.length) {
|
|
95
|
+
result += resolveTemplate(values[i])
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (value['_$litDirective$']) {
|
|
102
|
+
const directive = value['_$litDirective$']
|
|
103
|
+
if (directive.directiveName === 'unsafeHTML' && value.values && value.values.length > 0) {
|
|
104
|
+
return String(value.values[0])
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
|
-
return result
|
|
98
107
|
}
|
|
99
108
|
return value === undefined || value === null ? '' : String(value)
|
|
100
109
|
}
|
package/package.json
CHANGED