function createFilterFor(query) {
      var lowercaseQuery = query.toLowerCase();

      return function filterFn(state) {
        return (state.value.indexOf(lowercaseQuery) === 0);
      };

    }
function createFilterFor(query) {
      var lowercaseQuery = query.toLowerCase();

      return function filterFn(state) {
        return (state.value.indexOf(lowercaseQuery) === 0);
      };

    }
function createFilterFor ( query ) { var lowercaseQuery = query . toLowerCase ( ) ; return function filterFn ( state ) { return ( state . value . indexOf ( lowercaseQuery ) === 0 ) ; } ; }
Create filter function for a query string
Create filter function for a query string
Create a filter function for a given query