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.
Files changed (2) hide show
  1. package/halfcab.mjs +17 -8
  2. 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' && value.strings) {
89
- let result = ''
90
- const { strings, values } = value
91
- for (let i = 0; i < strings.length; i++) {
92
- result += strings[i]
93
- if (i < values.length) {
94
- result += resolveTemplate(values[i])
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "halfcab",
3
- "version": "14.0.1",
3
+ "version": "14.0.2",
4
4
  "type": "module",
5
5
  "description": "A simple universal JavaScript framework focused on making use of es2015 template strings to build components.",
6
6
  "main": "halfcab.mjs",