       for id, name of @_data
         results.push({id: id, name: name}) if match_func(re, name)
 
-      results = results.sort ((a, b) => sort_func(query, a, b))
+      results = results.sort ((a, b) -> sort_func(query, a, b))
       results.slice 0, @config.maxResultsNum
 
     _getRemoteData: (query, options)->

  # $.getScript "assets/json2.js" if StorageFreak.JSON_support() is false

  class StorageFreak
    # Sorts by exact query matching
    absolute_sort = (query, a, b) ->
      re_abs = @_createAccentIndependentRE(query, 'absolute')

      ((abs_match_a, abs_match_b) ->
        return -1 if abs_match_a
        return  1 if abs_match_b)(@config.match_func(re_abs, a.name),
                                  @config.match_func(re_abs, b.name))

    # Sorts by matching an exact token of the query
    token_sort = (query, a, b) ->
      re_t = @_createAccentIndependentRE(query, 'token')

      ((token_match_a, token_match_b) ->
          return -1 if token_match_a && !token_match_b
          return  1 if token_match_b && !token_match_a)(@config.match_func(re_t, a.name),
                                                        @config.match_func(re_t, b.name))

    # Sorts by matching query prefix
    prefix_sort = (query, a, b) ->
      re_p = @_createAccentIndependentRE(query, 'prefix')

      ((prefix_match_a, prefix_match_b) ->
        return -1 if prefix_match_a && !prefix_match_b
        return  1 if prefix_match_b && !prefix_match_a)(@config.match_func(re_p, a.name),
                                                        @config.match_func(re_p, b.name))

    # Sorts by aphabetical order
    lexicographical_sort = (a, b) ->

    # Compares a to b with respect to the query given by the user
    # Uses in order absolute, token, prefix and lexicographical sorting
    fuzzy_sort = (query, a, b) ->
      @sort_criteria_res ||= @_createSortingREs(query)

      for re in @sort_criteria_res
        regexp_result = regexp_sort.call(@, re, a, b)
        return regexp_result if regexp_result

      lexicographical_sort(a, b)

