-
Notifications
You must be signed in to change notification settings - Fork 3
/
lice.js
32 lines (27 loc) · 902 Bytes
/
lice.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
26
27
28
29
30
31
32
var _=require("underscore"); //use for string interpolation out of laziness
var template=require("./licenseTemplate.js");
var templates =require('./templates.json');
//http://underscorejs.org/#template // a la mustache
_.templateSettings = {
interpolate : /\{\{(.+?)\}\}/g
};
var licenseTypes=function(){
var types=[];
for (var key in templates){
types.push(key);
}
return types;
}
var createLicense=function(licenseType, options, callback){
var templateInput=templates[licenseType];
var licenseTemplate=new template(templateInput);
var license=licenseTemplate.licenseWithOptions(options);
callback(null, license);
}
var licenseVars=function(licenseType, callback){
var licenseTemplate=new template(templateInput);
return licenseTemplate.vars;
}
exports.createLicense=createLicense;
exports.licenseTypes=licenseTypes;
exports.createLicense=createLicense;