doc/issue-service/sample.js
function createToken (client) {
  return ask([
    {"type": "input",     "message": "Username", "name": "user"},
    {"type": "password",  "message": "Password", "name": "password"}
  ]).then(function (answers) {
    return client.createToken(answers.username, answers.password)
      .then(saveToken)
      .then(function (token) {
        // Authorize client…
        client.setToken(token);
        // …and send it back to connect()
        return client;
      });
  });
}
function createToken (client) {
  return ask([
    {"type": "input",     "message": "Username", "name": "user"},
    {"type": "password",  "message": "Password", "name": "password"}
  ]).then(function (answers) {
    return client.createToken(answers.username, answers.password)
      .then(saveToken)
      .then(function (token) {
        // Authorize client…
        client.setToken(token);
        // …and send it back to connect()
        return client;
      });
  });
}
function createToken ( client ) { return ask ( [ { "type" : "input" , "message" : "Username" , "name" : "user" } , { "type" : "password" , "message" : "Password" , "name" : "password" } ] ) . then ( function ( answers ) { return client . createToken ( answers . username , answers . password ) . then ( saveToken ) . then ( function ( token ) { // Authorize client… client . setToken ( token ) ; // …and send it back to connect() return client ; } ) ; } ) ; }
Assuming client.createToken returns a promise of string
Assuming client . createToken returns a promise of string