something is working

This commit is contained in:
quoije
2022-09-15 01:55:36 -04:00
parent a0aa251c27
commit f38e69883c
1123 changed files with 251731 additions and 11 deletions
+36
View File
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PromiseProvider = void 0;
const error_1 = require("./error");
/** @internal */
const kPromise = Symbol('promise');
const store = {
[kPromise]: undefined
};
/**
* Global promise store allowing user-provided promises
* @public
*/
class PromiseProvider {
/** Validates the passed in promise library */
static validate(lib) {
if (typeof lib !== 'function')
throw new error_1.MongoInvalidArgumentError(`Promise must be a function, got ${lib}`);
return !!lib;
}
/** Sets the promise library */
static set(lib) {
if (!PromiseProvider.validate(lib)) {
// validate
return;
}
store[kPromise] = lib;
}
/** Get the stored promise library, or resolves passed in */
static get() {
return store[kPromise];
}
}
exports.PromiseProvider = PromiseProvider;
PromiseProvider.set(global.Promise);
//# sourceMappingURL=promise_provider.js.map