blob: 64c467dfecb4065cbbaf34f76f7347b2c218548c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
"use strict"; // run code in ES5 strict mode
/**
* This function will be stringified and then injected into every rewired module.
* Then you can leak private variables by calling myModule.__get__("myPrivateVar");
*
* @param {!String} name name of the variable to retrieve
* @throws {TypeError}
* @return {*}
*/
module.exports = function __get__(name) {
if (typeof name !== "string" || name == false) {
throw new TypeError("__get__ expects a non-empty string");
}
return eval(name);
};
|