@@ -7,24 +7,19 @@ var Module = require("module"),
7
7
detectStrictMode = require ( "./detectStrictMode.js" ) ,
8
8
moduleEnv = require ( "./moduleEnv.js" ) ;
9
9
10
- var __get__Src = __get__ . toString ( ) ,
11
- __set__Src = __set__ . toString ( ) ,
12
- __with__Src = __with__ . toString ( ) ;
10
+ var srcs = {
11
+ "__get__" :__get__ . toString ( ) ,
12
+ "__set__" :__set__ . toString ( ) ,
13
+ "__with__" :__with__ . toString ( )
14
+ } ;
13
15
14
16
/**
15
17
* Does actual rewiring the module. For further documentation @see index.js
16
18
*/
17
19
function internalRewire ( parentModulePath , targetPath ) {
18
20
var targetModule ,
19
21
prelude ,
20
- appendix ,
21
- srcs ;
22
-
23
- srcs = {
24
- "__get__" :__get__Src ,
25
- "__set__" :__set__Src ,
26
- "__with__" :__with__Src
27
- } ;
22
+ appendix ;
28
23
29
24
// Checking params
30
25
if ( typeof targetPath !== "string" ) {
@@ -48,19 +43,15 @@ function internalRewire(parentModulePath, targetPath) {
48
43
// We prepend a list of all globals declared with var so they can be overridden (without changing original globals)
49
44
prelude = getImportGlobalsSrc ( ) ;
50
45
51
-
52
46
// We append our special setter and getter.
53
47
appendix = "\n" ;
54
48
55
- Object . keys ( srcs ) . forEach ( function ( key ) {
56
- var str = [
57
- "Object.defineProperty(module.exports, '" ,
58
- key ,
59
- "', {enumerable: false, value: " ,
60
- srcs [ key ] ,
61
- "}); "
62
- ] . join ( "" ) ;
63
- appendix += str ;
49
+ Object . keys ( srcs ) . forEach ( function forEachSrc ( key ) {
50
+ appendix += "Object.defineProperty(module.exports, '" +
51
+ key +
52
+ "', {enumerable: false, value: " +
53
+ srcs [ key ] +
54
+ "}); " ;
64
55
} ) ;
65
56
66
57
// Check if the module uses the strict mode.