1- 'use strict' ;
2- let { Rx} = require ( '@cycle/core' ) ;
3- let jsonp = require ( 'jsonp' ) ;
1+ let { Rx} = require ( `@cycle/core` )
2+ let jsonp = require ( `jsonp` )
43
54function createResponse$ ( url ) {
65 return Rx . Observable . create ( observer => {
7- if ( typeof url !== ' string' ) {
8- observer . onError ( new Error ( ' Observable of requests given to JSONP ' +
9- ' Driver must emit URL strings.' ) ) ;
10- return ( ) => { } ; // noop
6+ if ( typeof url !== ` string` ) {
7+ observer . onError ( new Error ( ` Observable of requests given to JSONP ` +
8+ ` Driver must emit URL strings.` ) )
9+ return ( ) => { } // noop
1110 }
1211
1312 try {
1413 jsonp ( url , ( err , res ) => {
1514 if ( err ) {
16- observer . onError ( err ) ;
15+ observer . onError ( err )
1716 } else {
18- observer . onNext ( res ) ;
19- observer . onCompleted ( ) ;
17+ observer . onNext ( res )
18+ observer . onCompleted ( )
2019 }
21- } ) ;
20+ } )
2221 } catch ( err ) {
23- observer . onError ( err ) ;
22+ observer . onError ( err )
2423 }
25- } ) ;
24+ } )
2625}
2726
2827function makeJSONPDriver ( ) {
2928 return function jsonpDriver ( request$ ) {
3029 return request$ . map ( url => {
31- let response$ = createResponse$ ( url ) ;
32- response$ . request = url ;
33- return response$ ;
34- } ) ;
35- } ;
30+ let response$ = createResponse$ ( url )
31+ response$ . request = url
32+ return response$
33+ } )
34+ }
3635}
3736
3837module . exports = {
@@ -56,5 +55,5 @@ module.exports = {
5655 * @return {Function } the JSONP Driver function
5756 * @function makeJSONPDriver
5857 */
59- makeJSONPDriver
60- } ;
58+ makeJSONPDriver,
59+ }
0 commit comments