Cannot read property 'pages' of undefined
See original GitHub issueconst d = wtf('2018', 'de');
I tried to fetch: https://de.wikipedia.org/wiki/2018
causes Unhandled Rejection at: Promise { <rejected> TypeError: Cannot read property ‘pages’ of undefined at postProcess (/var/task/node_modules/wtf_wikipedia/src/fetch.js:36:38)
root cause is the following check:
var lookup = 'titles';
if (isNumber.test(title) && title.length > 3) {
lookup = 'curid';
}
possible fix… hmm…
Object.prototype.toString.call(title) === '[object Number]'
would mean, I have to pass a real number as first argument.
wtf(1111111111, 'de');
? new option property?
wtf('2018', 'de', {
pageId: true
});
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Throws error: Cannot read property 'pages' of undefined #91
Describe the bug Running next-sitemap in a postbuild script errors out with the error Cannot read 'pages' of undefined .
Read more >TypeError: Cannot read property 'Page' of undefined
I resolved this error by making sure that the option to transfer the context of execution as the first parameter was ticked. enter...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >Cannot read property 'pages' of undefined
Cannot read property 'pages' of undefined. 03-06-2018 05:58 PM. Hello, I have a fresh Windows 10 system with Power Bi desktop 64 bit....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hey, sorry for missing this. Been getting swamped. hah, yeah- this looks like it’s just me being sloppy. How would you feel about it listening to
typeof
, so that'1984'
returns the title, but1984
returns the pageid. I like that over using another config param. that cool?@skipjack yep, that sounds plausible. i agree prs welcome