segmentio/is-url

latest patch version (1.2.3) changes behavior if string is undefined

Closed this issue · 3 comments

The change from re.test(string) to string.match(re) result in a different behavior if string is undefined (calling .test on undefined will throw a TypeError).
Maybe put a guard like if (typeof string == 'string') return false to avoid that or consider bumping the major version as 1.2.3 can be considered as a change introducing a breaking change.

@sballesteros @cadente-nd Thank you for pointing this out.

This is a bug in #18. I was trying to keep all existing behavior the same, but there was no test case for this so I missed it.

#20 will fix this issue.

@sballesteros If #20 solves your problem, can you close this issue?

#20 is available in is-url version 1.2.4 on npm.