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) {
8484
8585 var exportJs = "" ;
8686 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 ) {
8889 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" ) ;
9397 exportJs = "exports.locals = {\n" + exportJs + "\n};" ;
9498 }
9599
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ describe("camelCase", function() {
1313 ]
1414 } ;
1515 exports . with . locals = { 'btn-info' : '_38r5hlPyrqKLodJwWOdM1k' } ;
16- exports . without . locals = { btnInfo : '_38r5hlPyrqKLodJwWOdM1k' } ;
16+ exports . without . locals = { btnInfo : '_38r5hlPyrqKLodJwWOdM1k' , 'btn-info' : '_38r5hlPyrqKLodJwWOdM1k' } ;
1717 test ( "with" , css , exports . with , "?modules" ) ;
1818 test ( "without" , css , exports . without , "?modules&camelCase" ) ;
1919} ) ;
You can’t perform that action at this time.
0 commit comments