node_modules/snyk/dist/cli/139.index.js
/**
   * Render the prompt to screen
   * @return {ListPrompt} self
   */
Render the prompt to screen
@return {ListPrompt} self
Render the prompt to screen @return { ListPrompt } self
render() {
    var message = this.getQuestion();
    if (this.firstRender) {
      message += chalk.dim('(Use arrow keys)');
    }
    if (this.status === 'answered') {
      message += chalk.cyan(this.opt.choices.getChoice(this.selected).short);
    } else {
      var choicesStr = listRender(this.opt.choices, this.selected);
      var indexPosition = this.opt.choices.indexOf(
        this.opt.choices.getChoice(this.selected)
      );
      var realIndexPosition =
        this.opt.choices.reduce(function (acc, value, i) {
          if (i > indexPosition) {
            return acc;
          }
          if (value.type === 'separator') {
            return acc + 1;
          }
          var l = value.name;
          if (typeof l !== 'string') {
            return acc + 1;
          }
          l = l.split('\n');
          return acc + l.length;
        }, 0) - 1;
      message +=
        '\n' + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
    }
    this.firstRender = false;
    this.screen.render(message);
  }
render ( ) { var message = this . getQuestion ( ) ; if ( this . firstRender ) { message += chalk . dim ( '(Use arrow keys)' ) ; } if ( this . status === 'answered' ) { message += chalk . cyan ( this . opt . choices . getChoice ( this . selected ) . short ) ; } else { var choicesStr = listRender ( this . opt . choices , this . selected ) ; var indexPosition = this . opt . choices . indexOf ( this . opt . choices . getChoice ( this . selected ) ) ; var realIndexPosition = this . opt . choices . reduce ( function ( acc , value , i ) { if ( i > indexPosition ) { return acc ; } if ( value . type === 'separator' ) { return acc + 1 ; } var l = value . name ; if ( typeof l !== 'string' ) { return acc + 1 ; } l = l . split ( '\n' ) ; return acc + l . length ; } , 0 ) - 1 ; message += '\n' + this . paginator . paginate ( choicesStr , realIndexPosition , this . opt . pageSize ) ; } this . firstRender = false ; this . screen . render ( message ) ; }
Render the prompt to screen
 @return {ListPrompt} self
Render the prompt to screen @return { ListPrompt } self
// Render question // Render choices or answer depending on the state // Dont count lines past the choice we are looking at // Add line if it's a separator // Non-strings take up one line // Calculate lines taken up by string