UNPKG

368 BJavaScriptView Raw
1const error = require('../error');
2
3let destination;
4
5const 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
23module.exports = destinationRegistry;