fix(ejs): add missing options property (#42422)

* fix(ejs): add missing options property

- `outputFunctionName` configuration option
- test updated

Thanks!

* Update types/ejs/index.d.ts

Resolve PR comments

Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

* Update types/ejs/index.d.ts

Resolve PR comments

Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

* Update types/ejs/index.d.ts

Resolve PR comments

Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

* Update authors as per PR comment

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-02-19 20:19:11 +01:00 committed by GitHub
parent 21df3e7084
commit 039151ba67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@
// Project: http://ejs.co/, https://github.com/mde/ejs
// Definitions by: Ben Liddicott <https://github.com/benliddicott>
// ExE Boss <https://github.com/ExE-Boss>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@ -415,6 +416,9 @@ export interface Options {
* @default ejs.localsName
*/
localsName?: string;
/** Set to a string (e.g., 'echo' or 'print') for a function to print output inside scriptlet tags. */
outputFunctionName?: string;
}
export interface Cache {

View File

@ -24,6 +24,7 @@ const SimpleCallback = (err: any, html: string) => {
result = ejs.render(template);
result = ejs.render(template, data);
result = ejs.render(template, data, options);
ejs.render('<% echo(\'foo\'); %>', {}, { outputFunctionName: 'echo' });
result = ejs.renderFile(fileName, SimpleCallback);
result = ejs.renderFile(fileName, data, SimpleCallback);