1 | module.exports = exports = {};
|
2 |
|
3 | exports.set = function set(key, value) {
|
4 |
|
5 | var format_key = generate_key(key);
|
6 | var key_symbol = Symbol.for(format_key);
|
7 |
|
8 | var globalSymbols = Object.getOwnPropertySymbols(global);
|
9 | var hasValue = globalSymbols.indexOf(key_symbol) > -1;
|
10 | if (!hasValue) {
|
11 | global[key_symbol] = value;
|
12 | }
|
13 | };
|
14 |
|
15 | exports.get = function(key) {
|
16 |
|
17 | var format_key = generate_key(key);
|
18 | var key_symbol = Symbol.for(format_key);
|
19 | return global[key_symbol];
|
20 | }
|
21 |
|
22 | function generate_key(key) {
|
23 |
|
24 |
|
25 | return key;
|
26 | }
|