lib/prompt-filters.js
function (input, list) {
    debug('chooseOneStartsWithFilter(%s, %s)', input, JSON.stringify(list));
    if (input === true) return undefined;
    var retv;
    if (_.isString(input)) {
      if (input === '') return undefined;
      var ilc = input.toLocaleLowerCase();
      _.forEach(list, function (item) {
        var it = item.toLocaleLowerCase();
        if (_.startsWith(it, ilc)) retv = retv || item;
        if (it === ilc) retv = item;
      });
    }
    return retv;
  }
function (input, list) {
    debug('chooseOneStartsWithFilter(%s, %s)', input, JSON.stringify(list));
    if (input === true) return undefined;
    var retv;
    if (_.isString(input)) {
      if (input === '') return undefined;
      var ilc = input.toLocaleLowerCase();
      _.forEach(list, function (item) {
        var it = item.toLocaleLowerCase();
        if (_.startsWith(it, ilc)) retv = retv || item;
        if (it === ilc) retv = item;
      });
    }
    return retv;
  }
function ( input , list ) { debug ( 'chooseOneStartsWithFilter(%s, %s)' , input , JSON . stringify ( list ) ) ; if ( input === true ) return undefined ; var retv ; if ( _ . isString ( input ) ) { if ( input === '' ) return undefined ; var ilc = input . toLocaleLowerCase ( ) ; _ . forEach ( list , function ( item ) { var it = item . toLocaleLowerCase ( ) ; if ( _ . startsWith ( it , ilc ) ) retv = retv || item ; if ( it === ilc ) retv = item ; } ) ; } return retv ; }
Check if any items in the list start with the input in a case insensitive
manner. Will return the value from the list rather than the user input so
the list can control the final case.

NOTE 1: The list may not contain, undefined, null or the empty string.
NOTE 2: If there are multiple partial matches, the first one wins.
NOTE 3: If there is an exact match, it will be returned even if there is
a prior partial match.

@param {(string|boolean|undefined|null)} input
@param {string[]} list
@returns {(string|undefined)}
Check if any items in the list start with the input in a case insensitive manner . Will return the value from the list rather than the user input so the list can control the final case .