mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add definition for "email-templates".
Update definition for "helmet".
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
///<reference path="email-templates.d.ts"/>
|
||||
|
||||
import EmailTemplates = require('email-templates');
|
||||
|
||||
var EmailTemplate = EmailTemplates.EmailTemplate;
|
||||
var template = new EmailTemplate("./");
|
||||
var users = [
|
||||
{
|
||||
email: 'pappa.pizza@spaghetti.com',
|
||||
name: {
|
||||
first: 'Pappa',
|
||||
last: 'Pizza'
|
||||
}
|
||||
},
|
||||
{
|
||||
email: 'mister.geppetto@spaghetti.com',
|
||||
name: {
|
||||
first: 'Mister',
|
||||
last: 'Geppetto'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
var templates = users.map(function(user) {
|
||||
return template.render(user);
|
||||
})
|
||||
Vendored
+54
@@ -0,0 +1,54 @@
|
||||
// Type definitions for node-email-templates
|
||||
// Project: https://github.com/niftylettuce/node-email-templates
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* @summary Interface for result of email template.
|
||||
* @interface
|
||||
*/
|
||||
interface EmailTemplateResults {
|
||||
/**
|
||||
* @summary HTML result.
|
||||
* @type {string}
|
||||
*/
|
||||
html: string;
|
||||
|
||||
/**
|
||||
* @summary Text result.
|
||||
* @type {string}
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Interface for callback of email callback.
|
||||
* @interface
|
||||
*/
|
||||
interface EmailTemplateCallback {
|
||||
/**
|
||||
* @summary Callback signature.
|
||||
*/
|
||||
(err: Object, results: EmailTemplateResults): void;
|
||||
}
|
||||
|
||||
declare module "email-templates" {
|
||||
/**
|
||||
* @summary Email template class.
|
||||
* @class
|
||||
*/
|
||||
export class EmailTemplate {
|
||||
/**
|
||||
* @summary Constructor.
|
||||
* @param {string} templateDir The template directory.
|
||||
*/
|
||||
constructor(templateDir: string);
|
||||
|
||||
/**
|
||||
* @summary Render a single template.
|
||||
* @param {EmailTemplateCallback|Object} locals The variables or callback function.
|
||||
* @param {EmailTemplateCallback} callback The callback function.
|
||||
*/
|
||||
render(locals: EmailTemplateCallback|Object, callback?: EmailTemplateCallback): void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user