-
Notifications
You must be signed in to change notification settings - Fork 0
/
MITLicense.ts
46 lines (41 loc) · 2.22 KB
/
MITLicense.ts
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
33
34
35
36
37
38
39
40
41
42
43
44
45
class MITLicense {
static TEXT = 0;
static HTML = 1;
static src = "https://opensource.org/licenses/MIT";
static template(year: number, holders:number, format: number){
var prefix_license = "";
var license_image = "";
var copyright_sign = "(c)";
var break_line = "\n";
var start_paragraph = "";
var break_paragraph = "\n\n";
var postfix_license = "";
if (arguments.length>2) {
if (format==MITLicense.HTML) {
prefix_license = "";
license_image = "<p align='right'><img src='https://upload.wikimedia.org/wikipedia/commons/f/f8/License_icon-mit-88x31-2.svg'/></p>";
copyright_sign = "©";
break_line = " ";
start_paragraph = "<p>";
break_paragraph = "</p>";
postfix_license = "";
}
}
return prefix_license + license_image + start_paragraph + "Copyright "+ copyright_sign + " " + year + "-" + (new Date()).getFullYear() + " " + holders + break_paragraph +
start_paragraph + "Permission is hereby granted, free of charge, to any person obtaining a copy" + break_line +
"of this software and associated documentation files (the \"Software\"), to deal" + break_line +
"in the Software without restriction, including without limitation the rights" + break_line +
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell" + break_line +
"copies of the Software, and to permit persons to whom the Software is" + break_line +
"furnished to do so, subject to the following conditions:" + break_paragraph +
start_paragraph + "The above copyright notice and this permission notice shall be included in" + break_line +
"all copies or substantial portions of the Software." + break_paragraph +
start_paragraph + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR" + break_line +
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," + break_line +
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE" + break_line +
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER" + break_line +
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM," + break_line +
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN" + break_line +
"THE SOFTWARE." + break_paragraph;
}
}