This repository was archived by the owner on Feb 6, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -84,12 +84,16 @@ module.exports = function(content, map) {
84
84
85
85
var exportJs = "" ;
86
86
if ( Object . keys ( result . exports ) . length > 0 ) {
87
- exportJs = Object . keys ( result . exports ) . map ( function ( key ) {
87
+ var boundImportItemMatcher = importItemMatcher . bind ( this ) ;
88
+ exportJs = Object . keys ( result . exports ) . reduce ( function ( res , key ) {
88
89
var valueAsString = JSON . stringify ( result . exports [ key ] ) ;
89
- valueAsString = valueAsString . replace ( result . importItemRegExpG , importItemMatcher . bind ( this ) ) ;
90
- var exportKey = camelCaseKeys ? camelCase ( key ) : key ;
91
- return "\t" + JSON . stringify ( exportKey ) + ": " + valueAsString ;
92
- } . bind ( this ) ) . join ( ",\n" ) ;
90
+ valueAsString = valueAsString . replace ( result . importItemRegExpG , boundImportItemMatcher ) ;
91
+ res . push ( "\t" + JSON . stringify ( key ) + ": " + valueAsString ) ;
92
+ if ( camelCaseKeys ) {
93
+ res . push ( "\t" + JSON . stringify ( camelCase ( key ) ) + ": " + valueAsString ) ;
94
+ }
95
+ return res ;
96
+ } , [ ] ) . join ( ",\n" ) ;
93
97
exportJs = "exports.locals = {\n" + exportJs + "\n};" ;
94
98
}
95
99
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ describe("camelCase", function() {
13
13
]
14
14
} ;
15
15
exports . with . locals = { 'btn-info' : '_38r5hlPyrqKLodJwWOdM1k' } ;
16
- exports . without . locals = { btnInfo : '_38r5hlPyrqKLodJwWOdM1k' } ;
16
+ exports . without . locals = { btnInfo : '_38r5hlPyrqKLodJwWOdM1k' , 'btn-info' : '_38r5hlPyrqKLodJwWOdM1k' } ;
17
17
test ( "with" , css , exports . with , "?modules" ) ;
18
18
test ( "without" , css , exports . without , "?modules&camelCase" ) ;
19
19
} ) ;
You can’t perform that action at this time.
0 commit comments