-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (32 loc) · 915 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Created by karl on 14/07/15.
*/
/// <reference path="typings/tsd.d.ts" />
'use strict';
var e = require('express');
var CBPromiseRequest = require('./lib/cb-promise-request');
var StreamRequest = require('./lib/stream-request');
function RequestWrap(config) {
return function getRequest(stream, requestOpts) {
if (stream === void 0) { stream = false; }
var $this = this;
if (stream) {
return new StreamRequest({
req: $this,
config: config,
requestOpts: requestOpts
});
}
return new CBPromiseRequest({
req: $this,
config: config,
requestOpts: requestOpts
});
};
}
function create(opts) {
var express = opts.express || e;
express.request[opts.name] = RequestWrap(opts.config);
}
exports.create = create;
//# sourceMappingURL=index.js.map