1 | const error = require('../error');
|
2 |
|
3 | let destination;
|
4 |
|
5 | const destinationRegistry = {
|
6 | set(dest) {
|
7 | if (destination) {
|
8 | throw error('set destination twice.');
|
9 | }
|
10 | destination = dest;
|
11 | },
|
12 | get() {
|
13 | return destination;
|
14 | },
|
15 | has() {
|
16 | return !!destination;
|
17 | },
|
18 | reset() {
|
19 | destination = undefined;
|
20 | }
|
21 | };
|
22 |
|
23 | module.exports = destinationRegistry;
|