File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 5
5
* Usage declaration
6
6
*/
7
7
module . exports = function ( node , indent ) {
8
- var str = 'use' + this . ws , items = [ ] , glue ;
8
+ var str = 'use' + this . ws , items , glue ;
9
9
if ( node . type ) {
10
10
str += node . type + this . ws ;
11
11
}
12
- node . items . forEach ( function ( item ) {
12
+
13
+ items = ( node . items || [ ] ) . map ( function ( item ) {
13
14
var useItem = item . name ;
14
15
if ( item . alias ) {
15
16
useItem += ' as ' + item . alias ;
16
17
}
17
- useItem += ';' ;
18
- items . push ( useItem ) ;
18
+ return useItem ;
19
19
} ) ;
20
+
20
21
if ( node . items . length > 1 ) {
21
22
glue = this . nl + indent + this . indent ;
22
23
str += node . name + this . ws + '{' + glue ;
23
- str += items . join ( glue ) + this . nl ;
24
+ str += items . join ( ',' + glue ) + this . nl ;
24
25
str += indent + '};' + this . nl ;
25
26
} else {
26
- str += items [ 0 ] + this . nl ;
27
+ str += items [ 0 ] + ';' + this . nl ;
27
28
}
28
29
return str ;
29
30
} ;
You can’t perform that action at this time.
0 commit comments