Sha256: b199581471074102ec7b2c89dbbff48249b3c9c9f9261d9fe32a110d76f7a526
Contents?: true
Size: 649 Bytes
Versions: 50
Compression:
Stored size: 649 Bytes
Contents
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); } } ); }); }; }
Version data entries
50 entries across 50 versions & 3 rubygems