summaryrefslogtreecommitdiff
path: root/school/node_modules/agent-base/src/promisify.ts
diff options
context:
space:
mode:
Diffstat (limited to 'school/node_modules/agent-base/src/promisify.ts')
-rw-r--r--school/node_modules/agent-base/src/promisify.ts33
1 files changed, 0 insertions, 33 deletions
diff --git a/school/node_modules/agent-base/src/promisify.ts b/school/node_modules/agent-base/src/promisify.ts
deleted file mode 100644
index 60cc662..0000000
--- a/school/node_modules/agent-base/src/promisify.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import {
- Agent,
- ClientRequest,
- RequestOptions,
- AgentCallbackCallback,
- AgentCallbackPromise,
- AgentCallbackReturn
-} from './index';
-
-type LegacyCallback = (
- req: ClientRequest,
- opts: RequestOptions,
- fn: AgentCallbackCallback
-) => void;
-
-export default function promisify(fn: LegacyCallback): AgentCallbackPromise {
- return function(this: Agent, req: ClientRequest, opts: RequestOptions) {
- return new Promise((resolve, reject) => {
- fn.call(
- this,
- req,
- opts,
- (err: Error | null | undefined, rtn?: AgentCallbackReturn) => {
- if (err) {
- reject(err);
- } else {
- resolve(rtn);
- }
- }
- );
- });
- };
-}