TypeError: Cannot read property 'match' of undefined on switcher.js:34
nelsonic opened this issue Β· comments
Oh undefined
my old nemesis how I've NOT missed you!
/dwyl/top/node_modules/github-scraper/lib/switcher.js:34
if(url.match(/\.atom/)) { // feed parser has its own request handler
^
TypeError: Cannot read property 'match' of undefined
at switcher (/dwyl/top/node_modules/github-scraper/lib/switcher.js:34:9)
at Timeout.<anonymous> (/dwyl/top/3_find_sheeple_who_follow.js:25:7)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
I'm so tempted to re-write this in Elixir or Haskell ... if only I could justify the time!!
Annoyingly there are a few users who have the word undefined
in their GitHub username
e.g: https://github.com/undefined and https://github.com/undefined-zola ...
so the check in url_validator.js#L13-L15
:
github-scraper/lib/url_validator.js
Lines 13 to 15 in 4c53e80
is always going to
400
... πOk I've found quite a few Jokers who think they are hilarious and have the word undefined
in their GitHub Username. I have two choices:
- continue to throw an error when
undefined
is in theurl
βοΈ - write a few tests for this condition and address the issue ... π
this
genius was super creative with his Username: https://github.com/nullnullundefined
π
the current test:
github-scraper/test/url_validator.test.js
Lines 25 to 31 in 4c53e80
Does not have any context ...
So I'm going to update it!
The benefits of being the "only user" of this module is that I can make changes. π