Search code examples
javascriptlistalphabeticalfuse.js

Fuse.js library - Order results alphabetically


I'm using Kiro Risk's Fuse.js to search a bunch of objects within an array. I don't know exactly how its algorythm works, but I can see that uses a score to sort the result list depending on the word match.

I looked if it had any property for these cases but does not. Fuse.js url: http://fusejs.io/

Someone had been in the same situation and knows a trick, or should be better to get Fuse result and then pass it into another function to sort it alphabetically?


Solution

  • Okey, I just parsed the objects result and pushed to an array. Then I just used the javascript function sort() to sort it alphabetically.

    result = result.sort();