lib/autocomplete.js
function filterData(str, data) {
  data = data || [];
  var ctx = String(str || '').trim();
  var slashParts = ctx.split('/');
  ctx = slashParts.pop();
  var wordParts = String(ctx).trim().split(' ');
  var res = data.filter(function (item) {
    return (strip(item).slice(0, ctx.length) === ctx);
  });
  res = res.map(function (item) {
    var parts = String(item).trim().split(' ');
    if (parts.length > 1) {
      parts = parts.slice(wordParts.length);
      return parts.join(' ');
    }
    return item;
  });
  return res;
}
function filterData(str, data) {
  data = data || [];
  var ctx = String(str || '').trim();
  var slashParts = ctx.split('/');
  ctx = slashParts.pop();
  var wordParts = String(ctx).trim().split(' ');
  var res = data.filter(function (item) {
    return (strip(item).slice(0, ctx.length) === ctx);
  });
  res = res.map(function (item) {
    var parts = String(item).trim().split(' ');
    if (parts.length > 1) {
      parts = parts.slice(wordParts.length);
      return parts.join(' ');
    }
    return item;
  });
  return res;
}
function filterData ( str , data ) { data = data || [ ] ; var ctx = String ( str || '' ) . trim ( ) ; var slashParts = ctx . split ( '/' ) ; ctx = slashParts . pop ( ) ; var wordParts = String ( ctx ) . trim ( ) . split ( ' ' ) ; var res = data . filter ( function ( item ) { return ( strip ( item ) . slice ( 0 , ctx . length ) === ctx ) ; } ) ; res = res . map ( function ( item ) { var parts = String ( item ) . trim ( ) . split ( ' ' ) ; if ( parts . length > 1 ) { parts = parts . slice ( wordParts . length ) ; return parts . join ( ' ' ) ; } return item ; } ) ; return res ; }
Reduces an array of possible
matches to list based on a given
string.

@param {String} str
@param {Array} data
@return {Array}
@api private
Reduces an array of possible matches to list based on a given string .