nl_tokens: arg1 = host ( optional ) arg2 = port ( optional ) arg3 = files ( required )
pl_tokens: function notify ( arg1 , arg2 , arg3 ) { var argsLength = arguments . length ; return new P ( function ( resolve , reject ) { var filesCsv = null ; var requestUrl = null ; var host = null ; var port = null ; var files = null ; if ( argsLength === 3 ) { host = arg1 ; port = arg2 ; files = arg3 ; } else if ( argsLength === 2 ) { <mask> = DEFAULT_HOST ; port = arg1 ; files = arg2 ; } else if ( argsLength === 1 ) { host = DEFAULT_HOST ; port = DEFAULT_PORT ; files = arg1 ; } requestUrl = 'http://' + host + ':' + port + '/changed?files=' ; if ( host == null || port == null || files == null ) { return reject ( new Error ( 'host, port and files are all required fields!' ) ) ; } // one file if ( _ . isString ( files ) ) { filesCsv = files ; } else if ( _ . isArray ( files ) ) { filesCsv = files . join ( ',' ) ; } else { return reject ( new Error ( 'files must be a string or an array of strings!' ) ) ; } requestUrl += filesCsv ; console . log ( requestUrl ) ; request . get ( requestUrl , function ( err , response , body ) { if ( err !== null ) { return reject ( err ) ; } else { return resolve ( { response : response , body : body } ) ; } } ) ; } ) ; }