als-layout 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/layout.js +6 -4
- package/package.json +1 -1
package/layout.js
CHANGED
|
@@ -11,16 +11,18 @@ class Layout {
|
|
|
11
11
|
`
|
|
12
12
|
constructor(options={}) {
|
|
13
13
|
if(Layout.minify) this.tab = this.n = ''
|
|
14
|
-
options =
|
|
14
|
+
options = {...this.defaults,...options}
|
|
15
15
|
for(let key in options) {
|
|
16
16
|
this[key] = options[key]
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
get(options={}) {
|
|
21
|
-
options = Object.assign(this.defaults,options)
|
|
22
21
|
for(let key in options) {
|
|
23
|
-
if(key == 'scripts' || key == 'links')
|
|
22
|
+
if(key == 'scripts' || key == 'links') {
|
|
23
|
+
if(!Array.isArray(options[key])) options[key] = []
|
|
24
|
+
this[key] = [...this[key],...options[key]]
|
|
25
|
+
}
|
|
24
26
|
else this[key] = options[key]
|
|
25
27
|
}
|
|
26
28
|
return this.template()
|
|
@@ -106,7 +108,7 @@ class Layout {
|
|
|
106
108
|
if(href && v) link.href = href+'?'+v
|
|
107
109
|
return this.tab+'<link '
|
|
108
110
|
+Object.entries(link).map(([key,value]) => `${key}="${value}"`).join(' ')
|
|
109
|
-
+'
|
|
111
|
+
+'>'
|
|
110
112
|
}).join(this.n)
|
|
111
113
|
}
|
|
112
114
|
}
|