-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
25 lines (24 loc) · 813 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var _ = require('underscore'),
path = require('path');
module.exports = function () {
"use strict";
return function (files) {
var file,
templateData;
for (file in files) {
if (files.hasOwnProperty(file) && files[file].dataFile) {
try {
templateData = require(path.join(process.cwd(), files[file].dataFile));
} catch (e) {
switch (e.code) {
case "MODULE_NOT_FOUND":
throw ('Could not find data file ' + files[file].dataFile + '. Check file path ' + file);
default:
throw e;
}
}
_.extend(files[file], templateData);
}
}
};
};