You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This can take two different function signatures:
175
170
*
176
-
* - `renderFile(filename, dataAndConfig, [cb])`
177
-
* - Eta will merge `dataAndConfig` into `eta.config`
171
+
* - `renderFile(filename, data, [cb])`
178
172
* - `renderFile(filename, data, [config], [cb])`
179
173
*
180
174
* Note that renderFile does not immediately return the rendered result. If you pass in a callback function, it will be called with `(err, res)`. Otherwise, `renderFile` will return a `Promise` that resolves to the render result.
@@ -189,7 +183,6 @@ function includeFile(
189
183
*
190
184
* let rendered = await eta.renderFile("./template.eta", data, {cache: true})
191
185
*
192
-
* let rendered = await eta.renderFile("./template", {...data, cache: true})
193
186
* ```
194
187
*/
195
188
@@ -224,14 +217,13 @@ function renderFile(
224
217
/*
225
218
Here we have some function overloading.
226
219
Essentially, the first 2 arguments to renderFile should always be the filename and data
227
-
However, with Express, configuration options will be passed along with the data.
228
-
Thus, Express will call renderFile with (filename, dataAndOptions, cb)
229
-
And we want to also make (filename, data, options, cb) available
220
+
Express will call renderFile with (filename, data, cb)
221
+
We also want to make (filename, data, options, cb) available
230
222
*/
231
223
232
224
letrenderConfig: EtaConfigWithFilename;
233
225
letcallback: CallbackFn|undefined;
234
-
data=data||{};// If data is undefined, we don't want accessing data.settings to error
226
+
data=data||{};
235
227
236
228
// First, assign our callback function to `callback`
237
229
// We can leave it undefined if neither parameter is a function;
@@ -250,26 +242,8 @@ function renderFile(
250
242
(configasPartialConfig)||{},
251
243
)asEtaConfigWithFilename;
252
244
}else{
253
-
// Otherwise, get the config from the data object
254
-
// And then grab some config options from data.settings
* This can take two different function signatures:
288
262
*
289
-
* - `renderFile(filename, dataAndConfig, [cb])`
290
-
* - Eta will merge `dataAndConfig` into `eta.config`
263
+
* - `renderFile(filename, data, [cb])`
291
264
* - `renderFile(filename, data, [config], [cb])`
292
265
*
293
266
* Note that renderFile does not immediately return the rendered result. If you pass in a callback function, it will be called with `(err, res)`. Otherwise, `renderFile` will return a `Promise` that resolves to the render result.
@@ -302,7 +275,6 @@ function renderFile(
302
275
*
303
276
* let rendered = await eta.renderFile("./template.eta", data, {cache: true})
304
277
*
305
-
* let rendered = await eta.renderFile("./template", {...data, cache: true})
* This can take two different function signatures:
152
147
*
153
-
* - `renderFile(filename, dataAndConfig, [cb])`
154
-
* - Eta will merge `dataAndConfig` into `eta.config`
148
+
* - `renderFile(filename, data, [cb])`
155
149
* - `renderFile(filename, data, [config], [cb])`
156
150
*
157
151
* Note that renderFile does not immediately return the rendered result. If you pass in a callback function, it will be called with `(err, res)`. Otherwise, `renderFile` will return a `Promise` that resolves to the render result.
* This can take two different function signatures:
254
228
*
255
-
* - `renderFile(filename, dataAndConfig, [cb])`
256
-
* - Eta will merge `dataAndConfig` into `eta.config`
229
+
* - `renderFile(filename, data, [cb])`
257
230
* - `renderFile(filename, data, [config], [cb])`
258
231
*
259
232
* Note that renderFile does not immediately return the rendered result. If you pass in a callback function, it will be called with `(err, res)`. Otherwise, `renderFile` will return a `Promise` that resolves to the render result.
@@ -268,7 +241,6 @@ function renderFile(
268
241
*
269
242
* let rendered = await eta.renderFile("./template.eta", data, {cache: true})
270
243
*
271
-
* let rendered = await eta.renderFile("./template", {...data, cache: true})
0 commit comments