Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c0294d

Browse files
committed
Add note on illegal global variable names
1 parent ad3689f commit 0c0294d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ Be careful, if you do something like this you'll change your global console inst
151151
myModule.__set__("console.log", function () { /* be quiet */ });
152152
```
153153

154+
**Globals with invalid variable names**<br>
155+
rewire imports global variables into the local scope by prepending a list of `var` declarations:
156+
157+
```javascript
158+
var someGlobalVar = global.someGlobalVar;
159+
```
160+
161+
If `someGlobalVar` is not a valid variable name, rewire just ignores it. **In this case you're not able to override the global variable locally**.
162+
154163
<br />
155164

156165
API

0 commit comments

Comments
 (0)