summaryrefslogtreecommitdiff
path: root/client/node_modules/got/dist/source/core/utils/weakable-map.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/node_modules/got/dist/source/core/utils/weakable-map.js')
-rw-r--r--client/node_modules/got/dist/source/core/utils/weakable-map.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/client/node_modules/got/dist/source/core/utils/weakable-map.js b/client/node_modules/got/dist/source/core/utils/weakable-map.js
new file mode 100644
index 0000000..5c5da7f
--- /dev/null
+++ b/client/node_modules/got/dist/source/core/utils/weakable-map.js
@@ -0,0 +1,29 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+class WeakableMap {
+ constructor() {
+ this.weakMap = new WeakMap();
+ this.map = new Map();
+ }
+ set(key, value) {
+ if (typeof key === 'object') {
+ this.weakMap.set(key, value);
+ }
+ else {
+ this.map.set(key, value);
+ }
+ }
+ get(key) {
+ if (typeof key === 'object') {
+ return this.weakMap.get(key);
+ }
+ return this.map.get(key);
+ }
+ has(key) {
+ if (typeof key === 'object') {
+ return this.weakMap.has(key);
+ }
+ return this.map.has(key);
+ }
+}
+exports.default = WeakableMap;