mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-02 22:17:18 +01:00
14 lines
405 B
JavaScript
14 lines
405 B
JavaScript
const path = require('path');
|
|
|
|
module.exports.get = function(templateName, options) {
|
|
return new Promise((resolve, reject) => {
|
|
const modulePath = path.join(__dirname, 'templates', templateName);
|
|
try {
|
|
const template = require(modulePath);
|
|
resolve(template(options));
|
|
} catch (e) {
|
|
reject(`${templateName} not found!`);
|
|
}
|
|
});
|
|
};
|