-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhead.js
33 lines (31 loc) · 925 Bytes
/
head.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
33
/**
* Head class.
* @class
*/
class Head {
constructor() {}
/**
* The document head.
*
* @param {Object} charset The character encoding
* @param {String} title The HTML language
*
* @return {String}
*/
head(charset, title) {
if (!charset) {
this.code = String(`<head>
<meta charset="${charset}">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${title === undefined ? 'Document' : title}</title>
</head>`);
} else {
this.code = String(`<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${title === undefined ? 'Document' : title}</title>
</head>`);
}
return this.code;
}
}
module.exports = Head;