File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,18 @@ const promisify = require('promisify-es6')
4
4
const moduleConfig = require ( './utils/module-config' )
5
5
const streamToValue = require ( './utils/stream-to-value' )
6
6
7
+ // Transform the response stream to a value:
8
+ // [{ Success: <boolean>, Time: <number>, Text: <string> }]
9
+ const transform = ( res , callback ) => {
10
+ streamToValue ( res , ( err , res ) => {
11
+ if ( err ) {
12
+ return callback ( err )
13
+ }
14
+
15
+ callback ( null , res )
16
+ } )
17
+ }
18
+
7
19
module . exports = ( arg ) => {
8
20
const send = moduleConfig ( arg )
9
21
@@ -22,24 +34,10 @@ module.exports = (arg) => {
22
34
opts . n = 1
23
35
}
24
36
25
- const request = {
37
+ send . andTransform ( {
26
38
path : 'ping' ,
27
39
args : id ,
28
40
qs : opts
29
- }
30
-
31
- // Transform the response stream to a value:
32
- // [{ Success: <boolean>, Time: <number>, Text: <string> }]
33
- const transform = ( res , callback ) => {
34
- streamToValue ( res , ( err , res ) => {
35
- if ( err ) {
36
- return callback ( err )
37
- }
38
-
39
- callback ( null , res )
40
- } )
41
- }
42
-
43
- send . andTransform ( request , transform , callback )
41
+ } , transform , callback )
44
42
} )
45
43
}
You can’t perform that action at this time.
0 commit comments