@nxtedition/lib 14.0.7 → 14.0.9
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/package.json +1 -1
- package/util/template/index.js +14 -2
package/package.json
CHANGED
package/util/template/index.js
CHANGED
|
@@ -76,6 +76,10 @@ module.exports = (options) => {
|
|
|
76
76
|
throw new Error('invalid argument')
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
if (!hash) {
|
|
80
|
+
return null
|
|
81
|
+
}
|
|
82
|
+
|
|
79
83
|
let resolvers
|
|
80
84
|
let indices
|
|
81
85
|
|
|
@@ -114,11 +118,15 @@ module.exports = (options) => {
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
const _compileObjectTemplate = weakCache(
|
|
117
|
-
(obj) => {
|
|
121
|
+
(obj, hash) => {
|
|
118
122
|
if (!fp.isPlainObject(obj)) {
|
|
119
123
|
throw new Error('invalid argument')
|
|
120
124
|
}
|
|
121
125
|
|
|
126
|
+
if (!hash) {
|
|
127
|
+
return null
|
|
128
|
+
}
|
|
129
|
+
|
|
122
130
|
let resolvers
|
|
123
131
|
let indices
|
|
124
132
|
|
|
@@ -165,6 +173,10 @@ module.exports = (options) => {
|
|
|
165
173
|
throw new Error('invalid argument')
|
|
166
174
|
}
|
|
167
175
|
|
|
176
|
+
if (!hash) {
|
|
177
|
+
return null
|
|
178
|
+
}
|
|
179
|
+
|
|
168
180
|
const match = inner(str)
|
|
169
181
|
if (!match) {
|
|
170
182
|
return null
|
|
@@ -218,7 +230,7 @@ module.exports = (options) => {
|
|
|
218
230
|
return typeof val === 'string' && val.indexOf('{{') !== -1
|
|
219
231
|
}
|
|
220
232
|
|
|
221
|
-
function compileTemplate(template
|
|
233
|
+
function compileTemplate(template) {
|
|
222
234
|
if (fp.isPlainObject(template)) {
|
|
223
235
|
return compileObjectTemplate(template)
|
|
224
236
|
} else if (fp.isArray(template)) {
|