Kylart / MalScraper

Scrape everything you can from MyAnimeList.net
MIT License
175 stars 50 forks source link

Fix match-sorter import #114

Closed Muunatic closed 1 year ago

Muunatic commented 1 year ago

hello, maintainers!

in version 2.13.0, match-sorter bumped from 4.0.2 to 6.3.1. seems like the match-sorter@6.3.1 doesn't work as it should.

mal-scraper\src\info.js:229
          const bestMatch = match(items, name, { keys: ['name'] })
                            ^

TypeError: match is not a function
    at D:\File\Visual Studio Code\react-pages\node_modules\mal-scraper\src\info.js:229:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

this pull request fixes the import statements, it ensures that the module are imported according to the documentation stated in the match-sorter.

[GitHub] Default export no longer supported [Imgur] Fix Result

Muunatic commented 1 year ago

since require('match-sorter').default is no longer working, there is 2 solution to import match-sorter. I have tested both and they work.

alternative 1 (import matchSorter as match)

const match = require('match-sorter').matchSorter

alternative 2 (import matchSorter)

const { matchSorter } = require('match-sorter')
Kylart commented 1 year ago

I guess I forgot to update my dependencies before running the tests locally, thanks!