AtoraSuunva / booru

Searches boorus for images using some js magic
https://www.npmjs.com/package/booru
MIT License
78 stars 19 forks source link

Cannot read property 'page' of undefined, #34

Closed KR0WLEY closed 4 years ago

KR0WLEY commented 5 years ago

Code: https://pastr.io/view/1NNYwx Error: https://i.imgur.com/wtCG640.png

AtoraSuunva commented 5 years ago

Seems to be due to how I made SearchResults act like an array, it calls the constructor with the wrong arguments.

I'll see how I can work around this without needing to just re-implement every array function.

KR0WLEY commented 5 years ago

The error started when I made the filter. const images = i.filter(img => img.data.rating === 'e')

nfearnley commented 4 years ago

Any progress on this? I found the same issue with the results.map().

AtoraSuunva commented 4 years ago

With how busy I've been, this issue kinda dropped from my todo list.

I'll try and have a fix out this weekend

AtoraSuunva commented 4 years ago

Fixed in booru@2.0.4

The workaround itself is somewhat hacky, but should work fine.

Only downside is that calling array methods on SearchResults returns an array of Posts, meaning you lose all the SearchResults methods (although that shouldn't be a problem?)

https://github.com/AtlasTheBot/booru/pull/37